#!/usr/local/bin/perl -w
=head1 NAME
revml2p4_2.t - testing of vcp p4 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-p4-in-0.revml";
my $p4root_2 = "${t}p4root_2";
my $p4state_2 = "${t}p4state_2";
my $p4_rev_root = "//depot/foo/";
my $deepdir = "one/two/three/four/five";
my $p4_spec = "p4:revml2p4\@$p4root_2:${p4_rev_root}${deepdir}/";
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", "--state-location=$p4state_2"
], \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_2",
};
my $got = parse_files_and_revids_from_p4_files $p4_rev_root, $p4_options, "//..." ;
my $exp = parse_files_and_revids_from_revml $infile_0 ;
my $re = quotemeta "$deepdir/";
$got =~ s/^$re//mg ;
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 | |
|---|---|---|---|---|---|
| #9 | 5403 | Barrie Slaymaker | - Misc logging, maintainability & debugging improvements | ||
| #8 | 3970 | Barrie Slaymaker |
- VCP::Source handles rev queing, uses disk to reduce RAM - Lots of other fixes |
||
| #7 | 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 |
||
| #6 | 2962 | John Fetkovich | small fixup to previous change | ||
| #5 | 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. |
||
| #4 | 2926 | John Fetkovich |
remove --state-location switch add --db-dir and --repo-id switches build state location from concatenation of those two. |
||
| #3 | 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). |
||
| #2 | 2864 | John Fetkovich | add quick check of revml->p4 re-rooting deeply test | ||
| #1 | 2763 | John Fetkovich |
test a rerooted revml->p4 to someplace deep in the p4 tree, to make sure that VCP is configuring p4 to map the files to the right place. |