#!/usr/local/bin/perl -w =head1 NAME p4.t - testing of vcp p4 i/o =cut use strict ; use Carp ; use File::Path ; use File::Spec ; use POSIX ':sys_wait_h' ; use Test ; use VCP::TestUtils ; my @vcp = vcp_cmd ; my $t = -d 't' ? 't/' : '' ; my $p4_options ; my $p4_spec_base ; my $p4_spec ; my $incr_change ; # what change number to start incremental export at my @tests = ( ### # create p4 repository p4root_1 as copy of p4root_0 sub { $ENV{P4USER} = "foobar_user" ; $ENV{P4PORT} = "foobar_port" ; $ENV{P4CLIENT} = "foobar_client" ; $ENV{P4PASSWD} = "foobar_passwd" ; $p4_options = launch_p4d "p4_", { repo_dir => "${t}p4root_1", copy_from_dir => "${t}p4root_0", } ; $p4_spec_base = "p4:$p4_options->{user}:\@$p4_options->{port}:" ; $p4_spec = "$p4_spec_base" ; ok 1 ; }, ## ## revml -> p4 -> revml, incremental export ## ## !!! begin 90revml2p4.t sub {}, ## Two ok's in next test. sub { eval { ### --- number 4 in diagram my $p4_binary = $^O =~ /Win32/ ? "p4.exe" : "p4" ; run [ $p4_binary, "-u", $p4_options->{user}, "-p", $p4_options->{port}, qw( counter change ) ], \undef, \$incr_change ; chomp $incr_change ; die "Invalid change counter value: '$incr_change'" unless $incr_change =~ /^\d+$/ ; ++$incr_change ; my $infile = $t . "test-p4-in-1.revml" ; run [ @vcp, "revml:$infile", "$p4_spec" ], \undef; ok 1 ; # --- replace with p4 commands (number 5 in diagram) # --- also needs to be copied over to 91revml2p4.t # --- see also code like this in 90revml2p4_0.t (to (to here) ) # see if got the right # of files, changes # p42revml will do detailed checking (the following code) my $in = slurp $infile ; my $out = get_vcp_output "${p4_spec}...\@$incr_change,#head" ; $in =~ s{</rev_root>}{/foo</rev_root>} ; s_content qw( rep_desc time user_id p4_info ), \$in, \$out ; s_content qw( rev_root ), \$in, "depot/foo" ; rm_elts qw( label ), qr/r_\w+|ch_\w+/, \$in, \$out ; rm_elts qw( branches ), \$in ; ## TODO: This is an incremental export and perforce does not give us ## a trivial way to figure out what branch a file is on (since ## multiple branch views can cover the same file), so we bail ## on that for now. rm_elts qw( branch_id ), \$in ; $in =~ s{(id="|_id>)/+ignored}{$1//depot/foo}g; assert_eq $infile, $in, $out ; # --- (to here) } ; ok $@ || '', '', 'diff' ; # --- replace }, ) ; 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 | |
---|---|---|---|---|---|
#11 | 5403 | Barrie Slaymaker | - Misc logging, maintainability & debugging improvements | ||
#10 | 3970 | Barrie Slaymaker |
- VCP::Source handles rev queing, uses disk to reduce RAM - Lots of other fixes |
||
#9 | 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 |
||
#8 | 2961 | John Fetkovich | small fixup to previous change | ||
#7 | 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. |
||
#6 | 2926 | John Fetkovich |
remove --state-location switch add --db-dir and --repo-id switches build state location from concatenation of those two. |
||
#5 | 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). |
||
#4 | 2721 | Barrie Slaymaker | VCP::Dest::p4 now uses RevMapDB | ||
#3 | 2599 | John Fetkovich |
Changed parse_files_and_revids_from_p4_files to accept file_spec argument to p4 files command. Modified test suites to use it. Various documentation changes to TestUtils.pm. |
||
#2 | 2591 | John Fetkovich |
Changed 90revml2p4_1.t to use improvements previously done to 90revml2p4_0.t. Factored out parse_files_and_revids_from_p4_files common to both into TestUtils.pm. |
||
#1 | 2589 | John Fetkovich |
Split 90p4.t into 90revml2p4_0.t, 90revml2p4_1.t, 91p42revml.t, 95p42cvs.t. Added some utilities to the library files listed. |