- eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
- & eval 'exec perl -S $0 $argv:q'
- if 0;
- # THE PRECEEDING STUFF EXECS perl via $PATH
- # -*-Fundamental-*-
- require 5.000;
- # $Id: //guest/richard_geiger/utils/cvs2p4/test/runtest#22 $
- #
- # Richard Geiger
- #
- sub dirname
- {
- local($dir) = @_;
- $dir =~ s%^$%.%; $dir = "$dir/";
- if ($dir =~ m%^/[^/]*//*$%) { return "/"; }
- if ($dir =~ m%^.*[^/]//*[^/][^/]*//*$%)
- { $dir =~ s%^(.*[^/])//*[^/][^/]*//*$%$1%; { return $dir; } }
- return ".";
- }
- sub start_p4d
- {
- my $pid = fork();
- if ($pid) { sleep 1; return $pid; }
- my $P4PORTNUM = $P4PORT;
- $P4PORTNUM =~ s/^.*://;
- my $cmd = "$P4D -r $P4ROOT -p $P4PORTNUM -q";
- print "$Myname> $cmd\n";
- exec $cmd;
- print "$Myname: exec \"$cmd\" failed: $!.\n";
- exit 1;
- }
- sub stop_p4d
- {
- if (&s("$P4 -p $P4PORT admin stop"))
- { print "$Myname: *** \"$P4 -p $P4PORT admin stop\" failed\n"; &bail(1); }
- sleep 2;
- }
- use Carp; # ...or flounder.
- $| = 1;
- ($Myname = $0) =~ s%^.*/%%;
- $Mydir = &dirname($0);
- $Here = `/bin/pwd`; chop $Here;
- if ($Mydir ne ".") { chdir "$Mydir" || die "$Myname: can't chdir \"$Mydir\": $!"; }
- chdir ".." || die "$Myname: can't chdir \"..\": $!";
- $Mydir = `/bin/pwd`; chop $Mydir;
- chdir $Here || die "$Myname: can't chdir \"$Here\": $!";
- require "$Mydir/lib/util.pl";
- $Usage = <<LIT;
- $Myname: usage: $Myname
- LIT
- sub usage
- {
- print STDERR $Usage;
- exit 1;
- }
- sub help
- {
- print STDERR <<LIT;
- $Usage
- $Myname is...
- LIT
- exit 1;
- }
- $Valopt = "default";
- $Gengood = 0;
- $Savegood = 0;
- while ($#ARGV >= 0)
- {
- if ($ARGV[0] eq "-gengood") { $Gengood = 1; shift; next; }
- elsif ($ARGV[0] eq "-savegood") { $Savegood = 1; shift; next; }
- elsif ($ARGV[0] eq "-valopt")
- {
- shift; if ($ARGV[0] < 0) { &usage; }
- $Valopt = $ARGV[0]; shift; next;
- }
- elsif ($ARGV[0] eq "-help")
- { &help; }
- elsif ($ARGV[0] =~ /^-/) { &usage; }
- if ($Args ne "") { $Args .= " "; }
- push(@Args, $ARGV[0]);
- shift;
- }
- $Convdir = "$Mydir/test_conv_dir";
- $Testdir = "$Mydir/test";
- ### Setup
- #
- if ( &s("rm -rf $Convdir") ||
- &s("mkdir $Convdir") ||
- &s("cp $Testdir/config.test $Convdir/config") ||
- &s("cp $Testdir/brmap.pl $Convdir") ||
- &s("cp $Testdir/exclude_branches $Convdir") ||
- &s("cp $Testdir/exclude_tags $Convdir"))
- { print "$Myname: *** setup failed\n"; exit 1; }
- # Make some files with nonprintables in the file names...
- #
- sub printnp
- {
- my ($s) = @_;
- my $o = "";
- my $l = length($s);
- for (my $i = 0; $i <= $l; $i++)
- {
- my $c = substr($s, $i, 1);
- if ($c =~ /[\000-\037\177-\377]/)
- { $o .= sprintf("\\%03o", ord($c)); }
- else
- { $o .= "$c"; }
- }
- return $o;
- }
- @bads = (
- "\002",
- "x\001y",
- "bad\177\377\324\003\004\005dab"
- );
- foreach $bad (@bads)
- {
- my $path = "$Testdir/$bad,v";
- printf "$Myname: create bad filename \"%s\"\n", &printnp($bad);
- open(BF, ">$path")
- || printf "$Myname: can't create: \"%s\": $!.\n", &printnp($path);
- print BF "$path\n";
- close BF;
- }
- sub bail
- {
- my ($st) = @_;
- foreach $bad (@bads)
- {
- my $path = "$Testdir/$bad,v";
- if (-e "$path") { &s("rm -f $path"); }
- }
- if (! $st) { print "$Myname: ok\n"; }
- exit ($st);
- }
- require "$Convdir/config";
- print "$Myname > chdir $Mydir\n";
- if (! chdir "$Mydir")
- { print "$Myname: ** can't \"chdir $Mydir\": $!\n"; &bail(1); }
- ### genmetadata
- #
- if (&s("bin/genmetadata test_conv_dir"))
- { print "$Myname: *** genmetadata failed\n"; &bail(1); }
- if (! $Gengood &&
- (&s("diff $Testdir/lines.good $Convdir/lines") ||
- &s("diff $Testdir/metadata.good $Convdir/metadata")))
- { print "$Myname: *** genmetadata bad results\n"; &bail(1); }
- ### genchanges
- #
- if (&s("bin/genchanges test_conv_dir"))
- { print "$Myname: *** genchanges failed\n"; &bail(1); }
- if (! $Gengood &&
- &s("diff $Testdir/changes.good $Convdir/changes"))
- { print "$Myname: *** genchanges bad results\n"; &bail(1); }
- ### dochanges
- #
- # Interlock to set up server here TBD
- #
- $P4 = "$P4 -p $P4PORT -c cvs2p4 -u $P4USER";
- my ($P4PORTNUM) = $P4PORT; $P4PORTNUM =~ s/^.*://;
- if (&s("bin/dochanges test_conv_dir"))
- { print "$Myname: *** dochanges failed\n"; &bail(1); }
- my $p4d_pid = &start_p4d;
- my $p4d_vers = `$P4D -V | grep '^Rev'`;
- $p4d_vers =~ m/\/(\d{4})\.(\d+)(\.BETA)?\//;
- $p4d_vers_year = $1;
- $p4d_vers_minor = $2;
- if ($p4d_vers_year >= 2003 || ($p4d_vers_year == 2002 && $p4d_vers_minor > 1))
- { $P4_DESCRIBE = "p4_describe-new"; }
- else
- { $P4_DESCRIBE = "p4_describe"; }
- $P4_DESCRIBE_GOOD = "$P4_DESCRIBE.good";
- if (&s("$P4 changes -l | $Testdir/norm > $Convdir/p4_changes_-l 2>&1") ||
- &s("$P4 describe 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ".
- "21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 2>&1".
- "| $Testdir/norm > $Convdir/$P4_DESCRIBE"))
- { print "$Myname: *** dochanges testing failed\n"; &stop_p4d; &bail(1); }
- &stop_p4d;
- if (! $Gengood &&
- (&s("diff $Testdir/p4_changes_-l.good $Convdir/p4_changes_-l") ||
- &s("diff $Testdir/$P4_DESCRIBE_GOOD $Convdir/$P4_DESCRIBE")))
- { print "$Myname: *** dochanges bad results\n"; &bail(1); }
- ### dolabels
- #
- if (&s("bin/dolabels test_conv_dir"))
- { print "$Myname: *** dolabels failed\n"; &bail(1); }
- print "$Myname: *** Note: the \"WARNING: no reverse rev map entry ...\" above is expected. ***\n";
- my $p4d_pid = &start_p4d;
- if (&s("$P4 labels | $Testdir/norm > $Convdir/p4_labels 2>&1") ||
- &s("$P4 files //...\@testlabel > $Convdir/p4_filesat") ||
- &s("$P4 files //...\@rtag >> $Convdir/p4_filesat"))
- { print "$Myname: *** dolabels testing failed\n"; &bail(1); }
- if (! $Gengood &&
- (&s("diff $Testdir/p4_labels.good $Convdir/p4_labels") ||
- &s("diff $Testdir/p4_filesat.good $Convdir/p4_filesat")))
- { print "$Myname: *** dolabels bad results\n"; &stop_p4d; &bail(1); }
- if ($Savegood)
- {
- &s("p4 edit $Testdir/\*.good");
- foreach $f (split(/\n/, `p4 opened $Testdir/\*.good | sed -e 's/#.*//' -e 's/^.*\\///' -e 's/\\.good\$//'`))
- { if (-f "$Convdir/$f") { &s("cp $Convdir/$f $Testdir/$f.good"); } }
- &s("p4 revert -a $Testdir/\*.good");
- }
- &stop_p4d;
- &bail(0);
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#22 | 5654 | Richard Geiger | Take care of David Birkhead's first two problem children :-) | 19 years ago | |
#21 | 5601 | Richard Geiger | Integrate 3.0 changes, preparing to publish. | 19 years ago | |
#20 | 5599 | Richard Geiger | About to unleash 3.0 upon an unsuspecting world... | 19 years ago | |
#19 | 5591 | Richard Geiger | Reverse the order of all diff args, so that "<" is the .good and ">" is what was ob...served in the test execution. Seems to read more intuitively that way. « |
19 years ago | |
#18 | 5575 | Richard Geiger | split config file. | 19 years ago | |
#17 | 5531 | Richard Geiger | A significant checkpoint commit, with new improved handling of import vendor branches, an...d revisions present in main by virtue of multiple vendor drops to a file with no local mods. test/runtest works, with new refernece results pretty well scrutinized. « |
19 years ago | |
#16 | 5467 | Richard Geiger |
checkpoint. Need to update the docs prior to release! |
19 years ago | |
#15 | 5465 | Richard Geiger | Add exclude list for tags & branches. | 19 years ago | |
#14 | 5448 | Richard Geiger |
Let's work with Perforce BETA servers... :-) |
19 years ago | |
#13 | 5426 | Richard Geiger | Add compilation of the tags and branch tags encountered. | 19 years ago | |
#12 | 5271 | Richard Geiger | Sleep in runtest to make it work more reliably on fast machines; And write to "p4 -jr -"... instead of "p4root/dblabels", to save space and maybe go faster... "for now, at least". « |
19 years ago | |
#11 | 4270 | Richard Geiger | Handle symbols name starting with a leading "num". | 21 years ago | |
#10 | 3708 | Richard Geiger | Changes for 2.3.6 | 21 years ago | |
#9 | 3596 | Richard Geiger |
Oops. Not so simple; the diff behavior changed with 2002.2, not 2003.1. So, we handle it. |
22 years ago | |
#8 | 3594 | Richard Geiger | Changes for 2.3.5 | 22 years ago | |
#7 | 1781 | Richard Geiger | This change reintegrates cvs2p4 2.0 developement work (through 2.0b6) back into my mainli...ne development. « |
23 years ago | |
#6 | 1185 | Richard Geiger |
Changes for 1.3 (Labels!) |
23 years ago | |
#5 | 791 | Richard Geiger |
Update for a new release; my change-of-venue noted; desensitized to conflicting P4CONFIG. |
24 years ago | |
#4 | 398 | Richard Geiger | Skip (and note) ,v files with nonprintable characters in the fileame. | 25 years ago | |
#3 | 249 | Richard Geiger | Changes in preparation for supporting spaces in filenames. (In fact, this may work as of... this change, but is not yet tested.) Also, add "runtest -gengood" to allow easier generatino of new *.good files. (It just doesn't quick on a miscompare!). « |
25 years ago | |
#2 | 240 | Richard Geiger | Version 1.2.5, to account for post-1999 RCS behavior. (Courtesy of David Simon, Goldman S...achs) « |
25 years ago | |
#1 | 130 | Richard Geiger | CVS-to-Perforce converter. This is release 1.2.2 (first submit to the Perforce Public Dep...ot) « |
26 years ago |