develooper Front page | perl.qa.cvs | Postings from August 2001

cvs commit: smoke mkovz.pl mktest.pl smoke.sh

Thread Next
From:
Ask Bjoern Hansen
Date:
August 20, 2001 18:25
Subject:
cvs commit: smoke mkovz.pl mktest.pl smoke.sh
Message ID:
E15Z0Hx-0003Av-00@usw-pr-cvs1.sourceforge.net
ask         01/08/20 18:25:04

  Added:       .        mkovz.pl mktest.pl smoke.sh
  Log:
  initial import from H.Merijn Brand
  
  Revision  Changes    Path
  1.1                  smoke/mkovz.pl
  
  Index: mkovz.pl
  ===================================================================
  #!/usr/bin/perl -w
  
  use Config;
  
  my $testd = "/usr/3gl/CPAN/perl-current";
  my (%rpt, @confs, %confs);
  
  open RPT, "> $testd/mktest.rpt" or die "mktest.rpt: $!";
  select RPT;
  
  my $perlio = "";
  my $conf   = "";
  my $debug  = "";
  $rpt{patch} = "?";
  my $out = "$testd/mktest.out";
  open OUT, "<$out" or next;
  for (<OUT>) {
      m/^\s*$/ and next;
      m/^-+$/  and next;
      if (m/^\s*Smoking patch (\d+)/) {
  	$rpt{patch} = $1;
  	next;
  	}
      if (s/^Configuration:\s*//) {
  	# Unable to build in previous conf was hidden by crash junk?
  	exists $rpt{$conf}{$debug}{stdio}  or $rpt{$conf}{$debug}{stdio}  = "-";
  	exists $rpt{$conf}{$debug}{perlio} or $rpt{$conf}{$debug}{perlio} = "-";
  
  	s/-Dusedevel\s+//;
  	$debug = s/-DDEBUGGING\s*// ? "D" : "";
  	s/\s+-des//;
  	s/\s+$//;
  	$conf = $_;
  	$confs{$_}++ or push @confs, $conf;
  	next;
  	}
      if (m/PERLIO\s*=\s*(\w+)/) {
  	$perlio = $1;
  	next;
  	}
      if (m/^\s*All tests successful/) {
  	$rpt{$conf}{$debug}{$perlio} = "O";
  	next;
  	}
      if (m/^\s*Skipped this configuration/) {
  	if ($os =~ m/^HP/) {
  	    (my $dup = $conf) =~ s/ -Duselongdouble//;
  	    if (exists $rpt{$dup}{$debug}{stdio}) {
  		@{$rpt{$conf}{$debug}}{qw(stdio perlio)} =
  		    @{$rpt{$dup}{$debug}}{qw(stdio perlio)};
  		next;
  		}
  	    $dup =~ s/ -Dusemorebits/ -Duse64bitint/;
  	    if (exists $rpt{$dup}{$debug}{stdio}) {
  		@{$rpt{$conf}{$debug}}{qw(stdio perlio)} =
  		    @{$rpt{$dup}{$debug}}{qw(stdio perlio)};
  		next;
  		}
  	    $dup =~ s/ -Duse64bitall/ -Duse64bitint/;
  	    if (exists $rpt{$dup}{$debug}{stdio}) {
  		@{$rpt{$conf}{$debug}}{qw(stdio perlio)} =
  		    @{$rpt{$dup}{$debug}}{qw(stdio perlio)};
  		next;
  		}
  	    }
  	$rpt{$conf}{$debug}{stdio}  = ".";
  	$rpt{$conf}{$debug}{perlio} = ".";
  	next;
  	}
      if (m/^\s*Unable to (?=([cbmt]))(?:build|configure|make|test) perl/) {
  	$rpt{$conf}{$debug}{stdio}  = $1;
  	$rpt{$conf}{$debug}{perlio} = $1;
  	next;
  	}
      if (m/FAILED/) {
  	push @{$rpt{$conf}{$debug}{$perlio}}, $_;
  	next;
  	}
      }
  
  my $ccv = $Config{ccversion}||$Config{gccversion};
  print <<EOH;
  Automated smoke report for patch $rpt{patch}
                          on $^O using $Config{cc} version $ccv
  O = OK
  F = Failure(s), extended report at the bottom
  ? = still running or test results not (yet) available
  Build failures during:       - = unknown
      c = Configure, m = make, t = make test-prep
  
           Configuration
  -------  --------------------------------------------------------------------
  EOH
  
  my @fail;
  for my $conf (@confs) {
      for my $debug ("", "D") {
  	for my $perlio ("stdio", "perlio") {
  	    my $res = $rpt{$conf}{$debug}{$perlio};
  	    if (ref $res) {
  		print "F ";
  		my $s_conf = $conf;
  		$debug and substr ($s_conf, 0, 0) = "-DDEBUGGING ";
  		if ($perlio eq "stdio" && ref $rpt{$conf}{$debug}{perlio} and
  		    "@{$rpt{$conf}{$debug}{perlio}}" eq "@{$rpt{$conf}{$debug}{stdio}}") {
  		    # Squeeze stdio/perlio errors together
  		    print "F ";
  		    push @fail, [ "stdio/perlio", $s_conf, $res ];
  		    last;
  		    }
  		push @fail, [ $perlio, $s_conf, $res ];
  		next;
  		}
  	    print $res ? $res : "?", " ";
  	    }
  	}
      print "$conf\n";
      }
  
  print <<EOE;
  | | | +- PERLIO = perlio -DDEBUGGING
  | | +--- PERLIO = stdio  -DDEBUGGING
  | +----- PERLIO = perlio
  +------- PERLIO = stdio
  EOE
  
  @fail and print "\nFailures:\n\n";
  for my $i (0 .. $#fail) {
      my $ref = $fail[$i];
      printf "%-12s %-16s %s\n", $os, @{$ref}[0,1];
      if ($i < $#fail) {	# More squeezing
  	my $nref = $fail[$i + 1];
  	$ref->[0] eq $nref->[0] and
  	    "@{$ref->[-1]}" eq "@{$nref->[-1]}" and next;
  	}
      print @{$ref->[-1]}, "\n";
      }
  close RPT;
  select STDOUT;
  system "mailx -s 'Report $testd' ". getpwuid ($<) ." < $testd/mktest.rpt";
  
  
  
  1.1                  smoke/mktest.pl
  
  Index: mktest.pl
  ===================================================================
  #!/usr/bin/perl -w
  
  # Smoke test for perl-current
  # (c)'01 H.Merijn Brand [18 August 2001]
  
  use strict;
  
  our $VERSION = "1.01";
  
  my $io    = 1;	# Test perlio vs. stdio
  my $thr   = 1;	# Test threads
  
  open TTY,    ">&STDERR";	select ((select (TTY),    $| = 1)[0]);
  open STDERR, ">&1";		select ((select (STDERR), $| = 1)[0]);
  open LOG,    "> mktest.out";	select ((select (LOG),    $| = 1)[0]);
  				select ((select (STDOUT), $| = 1)[0]);
  chomp (my $testdir = `pwd`);
  unlink qw(perl.ok perl.nok);
  
  my $patch;
  if (open OK, "<.patch") {
      chomp ($patch = <OK>);
      close OK;
      print LOG "Smoking patch $patch\n\n";
      }
  
  my $Policy = -f "../Policy.sh" && -r _
      ? do {
  	local $/ = undef;
  	open my $pol, "<../Policy.sh" or die "../Policy.sh: $!";
  	<$pol>;
  	}
      : join "", <DATA>;
  my @p_conf = ("", "");
  foreach my $tconf (
  	"",
  	"-Dusethreads -Duseithreads -Dusereentrant ",
  	) {
  foreach my $conf (
  	"-Uuseperlio",
  	"-Duseperlio",
  	"-Duseperlio -Duse64bitint",
  	"-Duseperlio -Duse64bitall",
  	"-Duseperlio -Duselongdouble",
  	"-Duseperlio -Dusemorebits",
  	"-Duseperlio -Duse64bitall -Duselongdouble",
  	) {
  foreach my $dconf (
  	"",
  	"-DDEBUGGING ",
  	) {
      my $uconf  = "";	# Room for -U...
      my $s_conf = join "\n" =>
  	"", "Configuration: $dconf-Dusedevel $conf $tconf$uconf", "-" x 78, "";
      print TTY $s_conf;
      print LOG $s_conf;
  
      # You can put some optimizations (skipping configurations) here
      if ($^O eq "hpux" && $conf =~ m/longdouble|morebits/) {
  	# longdouble is turned off in Configure for hpux, and since morebits
  	# is the same as 64bitint + longdouble, these have already been tested
  	print TTY " Skipped this configuration for this OS (duplicate test)\n";
  	print LOG " Skipped this configuration for this OS (duplicate test)\n";
  	next;
  	}
  
      print TTY "Make distclean ...";
      qx "make -i distclean 2>/dev/null";
  
      print TTY "\nCopy Policy.sh ...";
      {   my $Pol = $Policy;
  	$dconf or $Pol =~ s/-DDEBUGGING\s*//g;
  	unlink "Policy.sh";
  	open my $pol, "> Policy.sh";
  	print $pol $Pol;
  	close $pol;
  	}
  
      print TTY "\nConfigure ...";
      qx "Configure -Dusedevel $conf $tconf $uconf -des";
  
      unless (-f "Makefile" && -s "config.sh") {
  	print TTY " Unable to configure perl in this configuration\n";
  	print LOG " Unable to configure perl in this configuration\n";
  	next;
  	}
  
      print TTY "\nMake ...";
      qx "make 2>&1";
  
      unless (-s "perl" && -x _) {
  	print TTY " Unable to make perl in this configuration\n";
  	print LOG " Unable to make perl in this configuration\n";
  	next;
  	}
  
      unlink "t/perl";
      qx "make test-prep";
      unless (-l "t/perl") {
  	print TTY " Unable to test perl in this configuration\n";
  	print LOG " Unable to test perl in this configuration\n";
  	next;
  	}
  
      print TTY "\n Tests start here:\n";
  
      foreach my $perlio (qw(stdio perlio)) {
  	$ENV{PERLIO} = $perlio;
  	print TTY "PERLIO = $perlio\t";
  	print LOG "PERLIO = $perlio\t";
  
  	open TST, "make test |";
  	my @nok = ();
  	select ((select (TST), $| = 1)[0]);
  	while (<TST>) {
  	    # Still to be extended
  	    m,^ *$, ||
  	    m,^	AutoSplitting, ||
  	    m,^\./miniperl , ||
  	    m,^autosplit_lib, ||
  	    m,^	Making , ||
  	    m,^make\[[12], ||
  	    m,make( TEST_ARGS=)? (_test|TESTFILE=), ||
  	    m,^ *cd t &&, ||
  	    m,^if \(true, ||
  	    m,^else \\, ||
  	    m,^fi$, ||
  	    m,^lib/ftmp-security....File::Temp::_gettemp: Parent directory \((\.|/tmp/)\) is not safe, ||
  	    m,^File::Temp::_gettemp: Parent directory \((\.|/tmp/)\) is not safe, ||
  	    m,^ok$, ||
  	    m,^[-a-zA-Z0-9_/]+\.*(ok|skipping test on this platform)$, ||
  	    m,^(xlc|cc_r) -c , ||
  	    m,^\s+$testdir/, ||
  	    m,^sh mv-if-diff\b, ||
  	    m,File \S+ not changed, ||
  	    # Don't know why BSD's make does this
  	    m,^Extracting .*with variable substitutions, ||
  	    # Or this:
  	    m,cc\s+-o\s+perl.*perlmain.o\s+lib/auto/DynaLoader/DynaLoader\.a\s+libperl\.a, ||
  	    m,^   ### , and next;
  	    if (m/^u=.*tests=/) {
  		s/(\d\.\d*) /sprintf "%.2f ", $1/ge;
  		print LOG;
  		}
  	    else {
  		push @nok, $_;
  		};
  	    print;
  	    }
  	print LOG map { "    $_" } @nok;
  	if (grep m,^All tests successful, @nok) {
  	    print TTY "\nOK, archive results ...";
  	    $patch and $nok[0] =~ s/\./ for .patch = $patch./;
  	    # make {,n}okfile now, cause a failure might not be able to
  	    -f "perl.ok"  or qx "make okfile";
  	    qx "cp perl.ok perl.nok";
  	    open  OK, ">> perl.ok.$$";
  	    print OK $p_conf[0] eq $s_conf ? "\n" : ($p_conf[0] = $s_conf);
  	    print OK "PERLIO = $perlio\n", @nok;
  	    close OK;
  	    }
  	else {
  	    print TTY "\nExtending failures with Harness\n";
  	    my @harness;
  	    for (@nok) {
  		m:^(\w+/[-\w/]+).*: or next;
  		push @harness, "../$1.t";
  		}
  	    push @nok, "\n",
  		grep !m:\bFAILED tests\b: &&
  		     !m:% okay$: => qx "./perl t/harness @harness";
  
  	    open  NOK, ">> perl.nok.$$";
  	    print NOK $p_conf[1] eq $s_conf ? "\n" : ($p_conf[1] = $s_conf);
  	    print NOK "PERLIO = $perlio\n", @nok;
  	    close NOK;
  	    }
  	print TTY "\n";
  	$io or last;
  	}
      }
      }
      $thr or last;
      }
  close LOG;
  
  if (-s "perl.ok.$$") {
      print TTY "\nOK file ...";
      open OK, -s "perl.nok.$$" ? "< perl.ok.$$" : "< mktest.out";
      my @nok = <OK>;
      close OK;
      unlink "perl.ok.$$";
      open  OK, "< perl.ok";
      my @ok = <OK>;
      close OK;
      shift @ok;
      $ok[0] =~ s/Subject:\s+//;
      $patch and $ok[0] =~ s/\+DEVEL\d+/+DEVEL$patch/;
      $ok[0] =~ s/-stdio//;
      splice @ok, 1, 2;
      splice @ok, 8, 2, map { "    $_\n" } (
  	    "category=dailybuild",
  	    "category=install",
  	    "osname=$^O",
  	    "severity=none",
  	    "status=ok",
  	    "ack=no");
      splice @ok, 6, 0, "\n", @nok, "\n";
      open  OK, "> perl.ok";
      print OK @ok;
      close OK;
      }
  else {	# Let's hope not!
      unlink "perl.ok";
      }
  
  if (-s "perl.nok.$$") {
      print TTY "\nNot OK file ...";
      open NOK, "< perl.nok";
      my @nok = <NOK>;
      close NOK;
      shift @nok;
      $nok[0] =~ s/Subject:\s+//;
      $nok[0] =~ s/OK/Not OK/;
      $patch and $nok[0] =~ s/\+DEVEL\d+/+DEVEL$patch/;
      $nok[0] =~ s/-stdio//;
      splice @nok, 1, 2;
      $nok[2] =~ s/success/build failure/;
      splice @nok, 8, 2, map { "    $_\n" } (
  	    "category=dailybuild",
  	    "category=install",
  	    "osname=$^O",
  	    "severity=none",
  	    "status=open",
  	    "ack=no");
      open NOK, "< perl.nok.$$";
      splice @nok, 5, 1, (<NOK>);
      close NOK;
      unlink "perl.nok.$$";
      open  NOK, "> perl.nok";
      print NOK @nok;
      close NOK;
      }
  else {
      unlink "perl.nok";
      }
  
  __END__
  #!/usr/bin/sh
  
  # Default Policy.sh
  
  # Be sure to define -DDEBUGGING by default, it's easier to remove
  # it from Policy.sh than it is to add it in on the correct places
  
  ccflags='-DDEBUGGING'
  
  
  
  1.1                  smoke/smoke.sh
  
  Index: smoke.sh
  ===================================================================
  #!/usr/bin/sh
  
  # This should be run with cron
  
  # Change your base dir here
  export PC=/usr/3gl/CPAN/perl-current
  # Set environmental values here
  
  echo "Smoke $PC"
  umask 0
  
  cd $PC
  make -i distclean > /dev/null 2>&1
  rsync -avz --delete rsync://ftp.linux.activestate.com/perl-current/ .
  
  (mktest.pl 2>&1) >mktest.log
  
  
  

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About