diff options
author | jeliazkov_i <jeliazkov_i@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-05-22 21:16:49 +0000 |
---|---|---|
committer | jeliazkov_i <jeliazkov_i@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-05-22 21:16:49 +0000 |
commit | d29428b0f877a36a528b619d03dd9d3e9f2a4a18 (patch) | |
tree | d6b77a8512ead73e4d90e11a23562ad9b0b8e369 | |
parent | 36fe824c7bf194d3d0ef1af9002ed500f3e200d9 (diff) | |
download | ATCD-d29428b0f877a36a528b619d03dd9d3e9f2a4a18.tar.gz |
ChangeLogTag: Mon May 22 21:13:15 UTC 2006 Iliyan Jeliazkov <iliyan@ociweb.com>
-rw-r--r-- | ChangeLog | 8 | ||||
-rwxr-xr-x | bin/diff-builds.pl | 258 |
2 files changed, 171 insertions, 95 deletions
diff --git a/ChangeLog b/ChangeLog index 86cc37e7d72..f1a94939ec2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Mon May 22 21:13:15 UTC 2006 Iliyan Jeliazkov <iliyan@ociweb.com> + + * bin/diff-builds.pl: + + Updated to allow diff between the tests failures today and on a + specified date, for the clean builds (or, all the builds from + the build score). + Mon May 22 19:06:41 UTC 2006 Steve Huston <shuston@riverace.com> * ace/Log_Record.cpp (operator<<, operator>>): Have to use a different diff --git a/bin/diff-builds.pl b/bin/diff-builds.pl index 53d07e0d7ca..78e33d45773 100755 --- a/bin/diff-builds.pl +++ b/bin/diff-builds.pl @@ -6,22 +6,27 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use File::Temp qw/ tempfile tempdir /; - +use POSIX qw/ strftime /; my $debugging = 0; # Print additional info my $verbose = '-q'; # WGET verbosity my $new_errors_only = 0; # Show new errors only +my $clean_builds_only = 1; # Only diff todays clean builds # The root of the test statistics -my $teststaturl = "wget $verbose http://www.dre.vanderbilt.edu/~remedynl/teststat/builds/"; +my $teststaturl = "http://www.dre.vanderbilt.edu/~remedynl/teststat/builds/"; -# Determine the timestamp by scanning the index -sub find_timestamps { +my $allbuildsurl = "http://www.dre.vanderbilt.edu/~remedynl/teststat/buildscore.log"; +my $cleanbuildsurl = "http://www.dre.vanderbilt.edu/~remedynl/teststat/cleanbuildtests.log"; + +# Determine the available timestamps for a build on a date, +# by scanning the index page (build.html) +sub find_timestamps ($$) { my ($file,$date) = @_; # print "\nSearching for $file, $date\n"; - open (INDEX, $teststaturl . $file . ".html -O - |") + open (INDEX, "wget " . $verbose . " \'" . $teststaturl . $file . ".html\' -O - |") || die "Could not read the index page\n"; # Split at all HTML tags, except <a ..> @@ -30,7 +35,7 @@ sub find_timestamps { # Select only those of the "href=..." that match our file and date my $rx = quotemeta ( $file . '_' . $date); - my @temp = map { (/${rx}_([0-9][0-9]_[0-9][0-9])/) ? $1 : undef } @suffixes; + my @temp = map { (/${rx}_([0-9][0-9]_[0-9][0-9])/) ? $1 : "" } @suffixes; return grep /^[0-9]/, @temp; } @@ -39,7 +44,7 @@ sub find_closest_earlier { my ($file,$date) = @_; - open (INDEX, $teststaturl . $file . ".html -O - |") + open (INDEX, "wget " . $verbose . " \'" . $teststaturl . $file . ".html\' -O - |") || die "Could not read the index page\n"; # Split at all HTML tags, except <a ..> @@ -54,21 +59,127 @@ sub find_closest_earlier { } -my @dates, @builds, @files, @tmpfiles, @fh; +sub select_builds ($$$) +{ + my ($rdates, $rbuilds, $rfiles) = @_; + my @dates = @{$rdates}; + my @builds = @{$rbuilds}; + + if ($#dates eq 1) { + $rfiles->[0] = $rbuilds->[0]; + $rfiles->[1] = $rbuilds->[0]; + } + elsif ($#builds eq 1) { + $rfiles->[0] = $rbuilds->[0]; + $rfiles->[1] = $rbuilds->[1]; + + $rdates->[1] = $rdates->[0]; + + } + else { + die "Dates: $#dates, Builds: $#builds\n"; + } + + return 0; +} + + +sub load_failed_tests_list ($$) +{ + my ($file, $date) = @_; + + my @timestamps = find_timestamps ($file, $date); + print "Build times for $file on $date are " + . join (', ', @timestamps) . "\n" unless !$debugging; + + die "No builds for $file on $date. The closest ealier date is " + . find_closest_earlier ($file, $date) . "\n" + unless ($#timestamps > -1); + + my $fullfile = $file .'_' . $date . '_' . $timestamps[0]; + my ($fh, $tmpfile) = tempfile ($fullfile . ".XXXXXX", UNLINK => 1); + + print "wget " . $verbose . " \'" .$teststaturl + . $fullfile . ".log\' -O - | sort >\'" . $tmpfile . '\'' . "\n" unless !$debugging; + + system ("wget " . $verbose . " \'" .$teststaturl + . $fullfile . ".log\' -O - | sort >\'" . $tmpfile . '\''); + close ($fh); + + return $tmpfile; +} + +sub differentiate ($$) +{ + my ($rfiles, $rdates) = @_; + + open (DIFF, "diff -u \'" . load_failed_tests_list ($rfiles->[0], $rdates->[0]) + . "\' \'" . load_failed_tests_list ($rfiles->[1], $rdates->[1]) . "\' 2>&1 |") + || die "Could not diff the files.\n"; + + while (<DIFF>) { + if (/^[^\+]/) { + print unless ($new_errors_only == 1); + } else { + print; + } + } + + close (DIFF); + print "\n"; +} + + +sub find_builds ($$$) +{ + my ($rbuilds, $buildscoreurl, $selectcolumn) = @_; + + print "Reading from $buildscoreurl\n" unless !$debugging; + + open (CLEANS, "wget " . $verbose . " \'" . $buildscoreurl . "\' -O - |") + || die "Could not read builds score page $buildscoreurl\n"; + + # Split at all spaces + for(my $begin=0; <CLEANS>;) + { + chomp; + my @columns = split (/ +/); + + if (/=+/) { + $begin++; + next; + } + + push (@{$rbuilds}, $columns[$selectcolumn]) unless !$begin; + + } + close (CLEANS); + sort @{$rbuilds}; + + print "Using builds @{$rbuilds}\n" unless !$debugging; +} + +my @dates = (); +my @builds = (); +my @files = (); + while ($arg = shift(@ARGV)) { if ($arg eq "-h" || $arg eq "-?") { print "Prints a diff for the list of test failures, for two builds on a certain date\n\n"; - print "diff-builds [-n] [-d] [-D date] build [build ...]\n"; + print "diff-builds [-n] [-d] [-D date] [-A] [build ...]\n"; print "\n"; - print "-n -- show only new test failing (default=no)\n"; - print "-d -- show debug info\n"; - print "-h -- prints this information\n"; - print "-D date -- specify a date, format is YYYY_MM_DD\n"; - print " use two to specify an interval\n"; - print "build -- specify the build name, as it appears on the scoreboard\n"; - print " also can use two builds, with one date\n"; + print "-n -- Show only new test failing (default=no)\n"; + print "-d -- Show debug info\n"; + print "-h -- Prints this information\n"; + print "-D date -- Specify a date, format is YYYY_MM_DD\n"; + print " Use two to specify an interval\n"; + print "-A -- Use all builds from the score, not only the clean ones\n"; + print "build -- Specify the build name, as it appears on the scoreboard\n"; + print " also can use two builds, with one date.\n"; + print " No build and a single date, implies all builds from\n"; + print " todays build score page.\n"; exit 0; } if ($arg eq '-D') { @@ -83,94 +194,50 @@ while ($arg = shift(@ARGV)) { elsif ($arg eq '-n') { $new_errors_only = 1; } + elsif ($arg eq '-A') { + $clean_builds_only = 0; + } else { push (@builds, $arg); } } -die "More than one date or buld name are required" - unless ($#dates + $#builds ge 1); - -print "dates=@dates ($#dates)\n" - unless !$debugging; - -print "builds=@builds ($#builds)\n" - unless !$debugging; -if ($#dates eq 1) { - $files[0] = $builds[0]; - $files[1] = $builds[0]; -} -elsif ($#builds eq 1) { - $files[0] = $builds[0]; - $files[1] = $builds[1]; - - $dates[1] = $dates[0]; - -} -else { - die "Dates: $#dates, Builds: $#builds\n"; -} +# Diff the todays clean builds with the ones from a specific date +if ($#builds == -1 && $#dates == 0) +{ + if ($clean_builds_only) + { + find_builds (\@builds, $cleanbuildsurl, 7); + } + else + { + find_builds (\@builds, $allbuildsurl, 3); + } + + $dates[1] = strftime ("%Y_%m_%e", gmtime); -print "files[0]=$files[0]\n" - unless !$debugging; - -print "files[1]=$files[1]\n" - unless !$debugging; - -my @timestamps0 = find_timestamps ($files[0], $dates[0]); -print "Build times for $files[0] on $dates[0] are " . join (', ', @timestamps0) . "\n" - unless !$debugging; - -die "No builds for $files[0] on $dates[0]. The closest ealier date is " - . find_closest_earlier ($files[0], $dates[0]) . "\n" - unless ($#timestamps0 > -1); - -my @timestamps1 = find_timestamps ($files[1], $dates[1]); -print "Build times for $files[1] on $dates[1] are " . join (', ', @timestamps1) . "\n" - unless !$debugging; - -die "No builds for " . $files[1] . " on " . $dates[1] . ". The closest earlier date is " - . find_closest_earlier ($files[1], $dates[1]) . "\n" - unless ($#timestamps1 > -1); - - -# Retrieve the list of failed tests -($fh[0], $tmpfiles[0]) = tempfile(); -system ($teststaturl - . $files[0] - .'_' . $dates[0] - . '_' . $timestamps0[0] - . ".log -O - | sort >" - . $tmpfiles[0]); -close ($fh[0]); - -($fh[1], $tmpfiles[1]) = tempfile(); -system ($teststaturl - . $files[1] - .'_' . $dates[1] - . '_' . $timestamps1[0] - . ".log -O - | sort >" - . $tmpfiles[1]); -close ($fh[1]); - -print ("diff -u " . $tmpfiles[0] . ' ' . $tmpfiles[1] . " 2>&1 \n") - unless !$debugging; - -open (DIFF, "diff -u " . $tmpfiles[0] . ' ' . $tmpfiles[1] . " 2>&1 |") - || die "Could not diff the files\n"; - -while (<DIFF>) { - if (/^[^\+]/) { - print unless ($new_errors_only == 1); - } else { - print; + foreach $build (@builds) + { + $files[0] = $files[1] = $build; + differentiate (\@files, \@dates); } } - -close (DIFF); - - +else +{ + + die "More than one date or buld name are required" + unless ($#dates + $#builds ge 1); + + print "dates=@dates ($#dates)\n" + unless !$debugging; + + print "builds=@builds ($#builds)\n" + unless !$debugging; + + select_builds (\@dates, \@builds, \@files); + differentiate (\@files, \@dates); +} __END__ =head1 diff-builds.pl Diff the lists of failing tests @@ -186,3 +253,4 @@ diff-builds.pl WinXP_VC71_NET_Static_Debug -D 2006_04_17 -D 2006_05_12 =item AUTHOR Iliyan Jeliazkov <iliyan@ociweb.com> + |