#!/usr/local/bin/perl -w =head1 NAME revml2cvs.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 $cvsroot_2 = $t . "cvsroot_2"; my $cvs_spec_2 = "cvs:$cvsroot_2:$module/newdir/" ; # use to check result of ok sub check { croak "test failed and FATALTEST set" if ! $_[0]; } my @tests = ( ## copy cvsroot_0 to cvsroot_2 sub { eval { rmtree [ $cvsroot_2 ] if -e $cvsroot_2; copy_dir_tree $cvsroot_0, $cvsroot_2; }; check ok $@ || '', '', 'diff' ; }, ## ## revml->cvs, re-rooting a dir tree sub { my ($stdout, $stderr) = ("", ""); eval { run [ @vcp, "revml:$infile_0", $cvs_spec_2 ], \undef or die "`vcp revml:$infile_0 $cvs_spec_2` returned $?" ; }; check ok $@ || '', '', 'diff' ; }, ## ## Idempotency test for an incremental revml->cvs->revml update ## sub { my $dir = cwd; my $expected = parse_files_and_revids_from_revml $infile_0, { IGNORE_REVS_WITH_DELETE_FLAG => 1 }; # previous sub put duplicates of all files in $expected re-rooted # under 'newdir', so put them in $expected. my $newdir_expected = $expected; $newdir_expected =~ s{^}{newdir/}gm ; $expected = ( join "\n", sort split /\n/, "$expected$newdir_expected" ) . "\n"; my $got = parse_files_and_revids_from_cvs_history "$dir/$cvsroot_2", "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 | |
---|---|---|---|---|---|
#6 | 3428 | Barrie Slaymaker | - Test suite cleanup | ||
#5 | 2926 | John Fetkovich |
remove --state-location switch add --db-dir and --repo-id switches build state location from concatenation of those two. |
||
#4 | 2716 | Barrie Slaymaker | Shorten, standardize state dir names | ||
#3 | 2715 | Barrie Slaymaker | Simplify test suite | ||
#2 | 2649 | John Fetkovich | Change test suites because of unreliable 'cvs history' command. | ||
#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. |