#!/usr/local/bin/perl -w =head1 NAME 90revml2cvs_0.t - testing of vcp cvs i/o =cut use strict ; use Carp ; use Cwd ; use File::Path qw( rmtree ); use Test ; use VCP::TestUtils ; # use eq_or_diff from Test::Differences if available, # else just use ok. eval "use Test::Differences"; sub ok_or_diff { goto &eq_or_diff if defined &eq_or_diff; goto &Test::ok; } my @vcp = vcp_cmd ; my $t = -d 't' ? 't/' : '' ; my $module = 'foo' ; ## Must match the rev_root in the testrevml files my $infile_0 = $t . "test-cvs-in-0.revml"; my $cvsroot_0 = $t . "cvsroot_0"; my $cvs_spec_0 = "cvs:$cvsroot_0:$module/" ; # use to check result of ok sub check { croak "test failed and FATALTEST set" if ! $_[0]; } ## I'd like to just diff the RCS files between the one we're ## creating here and some known good ones, but ## I'm worried that different versions of cvs on different systems ## might have slightly different formats. Note that we can't compare ## to t/cvsroot_[01] because those are created with this tool and that ## would overlook any errors! ## ## We can, however, use direct read, since 90cvs2revml tests that ## against --use-cvs. rmtree [ $cvsroot_0 ] if -e $cvsroot_0; my @tests = ( ## ## Empty import ## sub { run [ @vcp, "revml:-", $cvs_spec_0, "--init-cvsroot" ], \"<revml/>" ; #"# de-confuse emacs' cperl mode check ok $?, 0, "`vcp revml:- $cvs_spec_0` return value" ; }, sub { check ok -d $cvsroot_0, 1, "$cvsroot_0 exists"; }, ## ## revml->cvs->revml (using direct read) idempotency ## sub { my ($out); if( -e $cvsroot_0 ) { rmtree [ $cvsroot_0 ] or die "failed to remove directory '$cvsroot_0'"; } run [ @vcp, "revml:$infile_0", $cvs_spec_0, "--init-cvsroot" ], \undef, \$out; my @matches = ( $out =~ /^(initial|new) revision: /mg ); my $num_revisions_made = @matches; my $revml = slurp $infile_0; @matches = ( $revml =~ /<rev id=/g ); my $num_revisions_expected = @matches; ok $num_revisions_made && $num_revisions_made == $num_revisions_expected; }, sub { my $dir = cwd; my $expected = parse_files_and_revids_from_revml $infile_0, { IGNORE_REVS_WITH_DELETE_FLAG => 1 }; my $got = parse_files_and_revids_from_cvs_history "$dir/$cvsroot_0", "foo"; ok_or_diff $got, $expected; }, ) ; plan tests => scalar( @tests ) ; my $why_skip ; $why_skip .= cvs_borken ; $why_skip ? skip( $why_skip, 0 ) : $_->() for @tests ;
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#12 | 3532 | John Fetkovich |
changed File::Spec->rel2abs( blah, start_dir ) to start_dir_rel2abs blah everywhere. which does the same thing and is defined in VCP::Utils |
||
#11 | 3428 | Barrie Slaymaker | - Test suite cleanup | ||
#10 | 2977 | John Fetkovich | temporary test suite hack | ||
#9 | 2974 | John Fetkovich |
fix parse_files_and_revids_from_revml to deal with branches and multiple dotted revs |
||
#8 | 2969 | John Fetkovich | added tweak to force test to pass | ||
#7 | 2968 | John Fetkovich |
altered tests to use parse_files_and_revids_from_head_revs_db change to that routine too. |
||
#6 | 2926 | John Fetkovich |
remove --state-location switch add --db-dir and --repo-id switches build state location from concatenation of those two. |
||
#5 | 2716 | Barrie Slaymaker | Shorten, standardize state dir names | ||
#4 | 2714 | Barrie Slaymaker |
Simplify t/90*cvs.t tests, remove make_cvsroots for speed and simplicity. |
||
#3 | 2649 | John Fetkovich | Change test suites because of unreliable 'cvs history' command. | ||
#2 | 2646 | John Fetkovich |
Added comparison of number of revisions in vcp output to number of revisions in revml. |
||
#1 | 2622 | John Fetkovich |
Split revml2cvs.t into three files, then improved; particularly made changes to use parse_files_and_revids_from_revml (already in TestUtils.pm) and parse_files_and_revids_from_cvs_history (newly added to TestUtils.pm) to do checks on changes. |