runtest #11

  • //
  • guest/
  • matthew_rice/
  • cvs2p4/
  • test/
  • runtest
  • View
  • Commits
  • Open Download .zip Download (4 KB)
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/matthew_rice/cvs2p4/test/runtest#11 $
#
#  Richard Geiger
#

sub dirname
{
  local($dir) = @_;
  $dir =~ s%^$%.%; $dir = "$dir/";
  if ($dir =~ m%^/[^/]*//*$%) { return "/"; }
  if ($dir =~ m%^.*[^/]//*[^/][^/]*//*$%)
  { $dir =~ s%^(.*[^/])//*[^/][^/]*//*$%$1%; { return $dir; } }
  return ".";
}

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;

while ($#ARGV >= 0)
  {
    if ($ARGV[0] eq "-gengood")    { $Gengood = 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 $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 = "$Convdir/$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;
  }

require "$Convdir/config";
$ENV{"P4PORT"} = $P4PORT;

print "$Myname > chdir $Mydir\n";
if (! chdir "$Mydir")
  { print "$Myname: ** can't \"chdir $Mydir\": $!\n"; exit 1; }

### genmetadata
#

if (&s("bin/genmetadata test_conv_dir"))
  { print "$Myname: *** genmetadata failed\n"; exit 1; }

if (! $Gengood && 
    (&s("diff $Convdir/lines $Testdir/lines.good") ||
     &s("diff $Convdir/metadata $Testdir/metadata.good")))
  { print "$Myname: *** genmetadata bad results\n"; exit 1; }

### genchanges
#

if (&s("bin/genchanges test_conv_dir"))
  { print "$Myname: *** genchanges failed\n"; exit 1; }

if (! $Gengood &&
    &s("diff $Convdir/changes $Testdir/changes.good"))
  { print "$Myname: *** genchanges bad results\n"; exit 1; }


### dochanges
#

#  Interlock to set up server here TBD
#

if (&s("bin/dochanges test_conv_dir") ||
    &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 2>&1".
          "| $Testdir/norm > $Convdir/p4_describe"))
  { print "$Myname: *** dochanges failed\n"; exit 1; }

if (! $Gengood &&
    (&s("diff $Convdir/p4_changes_-l $Testdir/p4_changes_-l.good") ||
     &s("diff $Convdir/p4_describe $Testdir/p4_describe.good")))
  { print "$Myname: *** dochanges bad results\n"; exit 1; }

print "$Myname: ok\n";

# Change User Description Committed
#22 861 Matthew Rice more screw ups
#21 860 Matthew Rice Matt's cvs2p4 1.2.16 release
#20 852 Matthew Rice Matt's cvs2p4 1.2.34 release
#19 851 Matthew Rice Matt's cvs2p4 1.2.33 release
#18 850 Matthew Rice Matt's cvs2p4 1.2.32 release
#17 849 Matthew Rice Matt's cvs2p4 1.2.31 release
#16 848 Matthew Rice Matt's cvs2p4 1.2.30 release
#15 847 Matthew Rice Matt's cvs2p4 1.2.29 release
#14 846 Matthew Rice Matt's cvs2p4 1.2.28 release
#13 845 Matthew Rice Matt's cvs2p4 1.2.27 release
#12 844 Matthew Rice Matt's cvs2p4 1.2.26 release
#11 843 Matthew Rice Matt's cvs2p4 1.2.25 release
#10 842 Matthew Rice Matt's cvs2p4 1.2.24 release
#9 841 Matthew Rice Matt's cvs2p4 1.2.23 release
#8 840 Matthew Rice Matt's cvs2p4 1.2.22 release
#7 839 Matthew Rice Matt's cvs2p4 1.2.21 release
#6 838 Matthew Rice Matt's cvs2p4 1.2.20 release
#5 837 Matthew Rice Matt's cvs2p4 1.2.19 release
#4 836 Matthew Rice Matt's cvs2p4 1.2.18 release
#3 835 Matthew Rice Matt's cvs2p4 1.2.17 release
#2 834 Matthew Rice Matt's cvs2p4 1.2.16.
#1 833 Matthew Rice Starting with Richard's 1.2.15 cvs2p4.
//guest/richard_geiger/utils/cvs2p4/test/runtest
#4 398 Richard Geiger Skip (and note) ,v files with nonprintable characters in the fileame.
#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!).
#2 240 Richard Geiger Version 1.2.5, to account for post-1999 RCS behavior.
(Courtesy of David Simon, Goldman Sachs)
#1 130 Richard Geiger CVS-to-Perforce converter.
This is release 1.2.2
(first submit to the Perforce Public Depot)