#!/usr/local/bin/perl -w =head1 NAME revml2p4_3.t - testing of vcp p4 i/o =head1 DESCRIPTION This tests revml->p4 *without* forcing changes on to the first revision of a branch (which is how the other test suites operate). Unlike the other t/90revml2p4_*.t files, t/91p42revml.t does not check the details of this transfer, that would be a pain without having bin/gentrevml emit custom revml just to test the output of this test with. That will make sense if we ever want to run tests using this mode and t/91p42revml.t should be expanded to cover this test case in that event. =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-p4-in-0.revml"; my $p4root_3 = "${t}p4root_3"; my $p4state_3 = "${t}p4state_3"; my $p4_rev_root = "//depot/foo/"; my $p4_spec = "p4:revml2p4\@$p4root_3:$p4_rev_root"; my @tests = ( ## ## revml->p4, re-rooting a dir tree deeply ## sub { my $out; run [ @vcp, "revml:$infile_0", $p4_spec, "--init-p4d", "--delete-p4d-dir", "--db-dir=$p4state_3", "--repo-id=p4:test_repository", ], \undef, \$out or die "`vcp revml:$infile_0 $p4_spec` returned $?" ; ok 1; }, ## ## check result previous sub ## sub { my $p4_options = launch_p4d "p4_", { repo_dir => "$p4root_3", }; my $got = parse_files_and_revids_from_p4_files $p4_rev_root, $p4_options, "//..." ; my $exp = parse_files_and_revids_from_revml $infile_0 ; $exp =~ s{(main-branch-1.*)(\d+)}{$1 . ( 1 + $2 ) }ge or die "unable to tweak expected output"; ok_or_diff $got, $exp; }, ); plan tests => scalar @tests ; my $p4d_borken = p4d_borken ; my $why_skip ; $why_skip .= "p4 command not found\n" unless ( `p4 -V` || 0 ) =~ /^Perforce/ ; $why_skip .= "$p4d_borken\n" if $p4d_borken ; $why_skip ? skip( $why_skip, '' ) : $_->() for @tests ;
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#8 | 5403 | Barrie Slaymaker | - Misc logging, maintainability & debugging improvements | ||
#7 | 3974 | Barrie Slaymaker | - IPC::Run no longer required | ||
#6 | 3428 | Barrie Slaymaker | - Test suite cleanup | ||
#5 | 3422 | Barrie Slaymaker |
- Factor some common code in to VCP::Utils::p4. - Add error when a p4 filespec ends in a '/' or '\' - Clean up revml2p4 test scripts |
||
#4 | 2963 | John Fetkovich | small fixup to previous change | ||
#3 | 2959 | John Fetkovich |
added dump method to lib/VCP/DB_File/sdbm.pm to dump keys => values from a sdbm file. removed similar code from bin/dump_head_revs, bin/dump_rev_map and bin/dump_main_branch_id and called this method instead. also made parse_files_and_revids_from_head_revs_db sub in TestUtils to use in test suites instead of parse_files_and_revids_from_p4_files et. al. |
||
#2 | 2926 | John Fetkovich |
remove --state-location switch add --db-dir and --repo-id switches build state location from concatenation of those two. |
||
#1 | 2915 | Barrie Slaymaker |
Default to *not* changing the first rev of a branch, add --change-branch-rev-1 to enable the non-default behavior (which is what is used by most of the test suite). |