90revml2p4_0.t #12

  • //
  • guest/
  • perforce_software/
  • revml/
  • t/
  • 90revml2p4_0.t
  • View
  • Commits
  • Open Download .zip Download (2 KB)
#!/usr/local/bin/perl -w

=head1 NAME

p4.t - testing of vcp p4 i/o

=cut

use strict ;

use Carp ;
use Test ;
use VCP::TestUtils ;

my @vcp = vcp_cmd ;

my $t = -d 't' ? 't/' : '' ;

my $p4root_0  = "${t}p4root_0";
my $p4state_0 = "${t}p4state_0";
my $p4_spec = "p4:revml2p4\@$p4root_0://depot/foo/..." ;
my $p4_repo_id = "p4:test_repository";

my $infile  = $t . "test-p4-in-0.revml" ;

my @tests = (

##
## Empty import
##
sub {
   run [ @vcp, "revml:-", $p4_spec,
         "--init-p4d",
         "--delete-p4d-dir", 
         "--db-dir=$p4state_0",
         "--repo-id=$p4_repo_id",
       ],
       \"<revml/>" ;
   ok $?, 0, "`vcp revml:- $p4_spec` return value"  ;
},

##
## revml -> p4 bootstrap transfer
##
sub {
   ok run [ @vcp, "revml:$infile", $p4_spec,
            "--init-p4d",
            "--delete-p4d-dir",
            "--db-dir=$p4state_0",
            "--repo-id=$p4_repo_id",
         ];
},

## slurp $infile and analyze with regexps to count number of unique
## named files and the highest change number for each file, then check
## state db to see if the repository really contains all that.

## detailed analysis of this import is left to 91p42revml.t             

sub {
   my $revs1 = parse_files_and_revids_from_head_revs_db {
      state_dir => $p4state_0,
      repo_id => $p4_repo_id,
      remove_rev_root => "/ignored/",
   };
   my $revs2 = parse_files_and_revids_from_revml $infile ;

   ok_or_diff $revs1, $revs2;
},

) ;



plan tests => scalar @tests ;

my $why_skip ;
$why_skip .= p4_borken;
$why_skip .= p4d_borken;

$why_skip ? skip( $why_skip, '' ) : $_->() for @tests ;
# Change User Description Committed
#12 5403 Barrie Slaymaker - Misc logging, maintainability & debugging improvements
#11 3970 Barrie Slaymaker - VCP::Source handles rev queing, uses disk to reduce RAM
- Lots of other fixes
#10 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
#9 2960 John Fetkovich small fixup to previous change
#8 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.
#7 2926 John Fetkovich remove --state-location switch
       add --db-dir and --repo-id switches
       build state location from concatenation of those two.
#6 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).
#5 2721 Barrie Slaymaker VCP::Dest::p4 now uses RevMapDB
#4 2623 John Fetkovich added TODO: comments
#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.