Split regress tests into separate output files.

This commit is contained in:
Mark Santaniello 2015-08-25 11:41:08 -07:00
Родитель 7ef54c678d
Коммит 0e55770223
1 изменённых файлов: 42 добавлений и 40 удалений

Просмотреть файл

@ -38,6 +38,7 @@ use strict;
use warnings;
use File::Basename;
use Digest::MD5 'md5_hex';
use English;
my $script_name = basename( $PROGRAM_NAME );
@ -45,23 +46,56 @@ my $script_dir = dirname( $PROGRAM_NAME );
unless( scalar @ARGV == 1 )
{
warn "usage: $script_name OUTFILE\n";
warn "usage: $script_name OUTDIR\n";
exit(-1);
}
my $outfile = "$script_dir\\$ARGV[0]";
my $outdir = "$script_dir\\$ARGV[0]";
die "Directory $outdir exists\n" if -d $outdir;
mkdir( $outdir );
sub my_exec
{
my $cmd = shift;
# Unique filenames based on hash of command line
my $base_filename = "$outdir\\" . md5_hex( $cmd );
my $tmp_filename = "$base_filename.tmp";
my $out_filename = "$base_filename.txt";
system( "echo $cmd > $tmp_filename" );
system( "$cmd >> $tmp_filename 2>&1" );
system( "echo TEST_BEGIN >> $outfile" );
system( "echo $cmd >> $outfile" );
# Post process raw output file to remove noise
open( my $in, "<$tmp_filename" );
open( my $out, ">$out_filename" );
system( "$cmd >> $outfile 2>&1" );
while( my $line = <$in> )
{
# Remove random temp file names
$line =~ s/AppData\\\S*//;
system( "echo TEST_END >> $outfile" );
system( "echo. >> $outfile" );
# Remove ETA info
$line =~ s/\d{2}:\d{2}:\d{2} (AM|PM)//g;
# Remove time from autogenerated results dir
if( $line =~ /results/ )
{
$line =~ s/-\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}//g;
}
# Remove "Done" line with overall runtime
$line =~ s/^Done.*//;
print $out $line;
}
close $in;
close $out;
unlink( $tmp_filename );
}
sub run_one
@ -101,7 +135,6 @@ sub run_matrix
}
}
unlink( $outfile );
chdir( ".." );
# Preserve existing results directory
@ -153,35 +186,4 @@ run_matrix( "--io_generator=sqlio" );
system( "rmdir /S /Q results >NUL 2>&1" );
rename( "results.orig", "results" );
# Post process output file to remove noise
rename( $outfile, "$outfile.orig" );
open( my $in, "<$outfile.orig" );
open( my $out, ">$outfile" );
while( my $line = <$in> )
{
# Remove random temp file names
$line =~ s/AppData\\\S*//;
# Remove ETA info
$line =~ s/\d{2}:\d{2}:\d{2} (AM|PM)//g;
# Remove time from autogenerated results dir
if( $line =~ /results/ )
{
$line =~ s/-\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}//g;
}
# Remove "Done" line with overall runtime
$line =~ s/^Done.*//;
print $out $line;
}
close $in;
close $out;
unlink( "$outfile.orig" );
print "Done! Diff $outfile against another run.\n";
print "Done! Diff $outdir directory against another run.\n";