diff --git a/tools/tinderbox/build-seamonkey-util.pl b/tools/tinderbox/build-seamonkey-util.pl index 7bbec01689a..1eb5dc0d950 100644 --- a/tools/tinderbox/build-seamonkey-util.pl +++ b/tools/tinderbox/build-seamonkey-util.pl @@ -24,7 +24,7 @@ use Config; # for $Config{sig_name} and $Config{sig_num} use File::Find (); use File::Copy; -$::UtilsVersion = '$Revision: 1.323 $ '; +$::UtilsVersion = '$Revision: 1.324 $ '; package TinderUtils; @@ -55,6 +55,7 @@ require "gettime.pl"; my $co_time_str = 0; # Global, let tests send cvs co time to graph server. my $co_default_timeout = 300; +my $graph_time; sub Setup { InitVars(); @@ -864,40 +865,7 @@ sub BuildIt { print "\n\nSleeping $sleep_time seconds ...\n"; sleep $sleep_time; } - if ($Settings::TestOnlyTinderbox) { - print_log("Downloading $Settings::TinderboxServerURL\n"); - my $tbox_server_info = `wget -qO - \'$Settings::TinderboxServerURL\'`; - if (0 != ($? >> 8)) { - die("FetchBuild failed: $?\n"); - } - my $build_found = 0; - foreach my $line (split(/\n/,$tbox_server_info)) { - my @data = split('\|',$line); - my $buildname = $data[2]; - my $status = $data[3]; - if ($buildname eq $Settings::MatchBuildname){ - if ($status eq 'success') { - $start_time = $data[4]; - if ($start_time =~ /\d+/) { - $build_found = 1; - }else{ - print_log("Error - downloaded start time is no good: $start_time \n"); - } - }else{ - print_log("Found match: $buildname but status is not success: $status\n"); - } - } - } - unless ($start_time){ - unless ($build_found) { - print_log("Could not find $Settings::MatchBuildname at $Settings::TinderboxServerURL\n"); - } - print_log("Fall back start_time to current time()\n"); - $start_time = time(); - } - } else { - $start_time = time(); - } + $start_time = time(); # Set this each time, since post-mozilla.pl can reset this. $ENV{MOZILLA_FIVE_HOME} = "$binary_dir"; @@ -1140,6 +1108,7 @@ sub BuildIt { } } } elsif ($build_status ne 'busted' and $Settings::TestOnlyTinderbox) { + my $graph_time = get_build_time_from_server($start_time); my $prebuilt = "$build_dir/$Settings::DownloadBuildDir"; my $status = 0; if ( -f $prebuilt) { @@ -1692,12 +1661,43 @@ sub get_graph_tbox_name { return $name; } +sub get_build_time_from_server { + my ($time) = @_; + if ($Settings::TestOnlyTinderbox) { + print_log("Downloading $Settings::TinderboxServerURL\n"); + my $tbox_server_info = `wget -qO - '$Settings::TinderboxServerURL'`; + if (0 != ($? >> 8)) { + print_log("FetchBuild failed: $?\n"); + return $time; + } + foreach my $line (split(/\n/, $tbox_server_info)) { + my @data = split('\|', $line); + my $buildname = $data[2]; + my $status = $data[3]; + my $grabbed_time; + if ($buildname eq $Settings::MatchBuildname){ + if ($status eq 'success') { + $grabbed_time = $data[4]; + if (not $grabbed_time =~ /\d+/) { + print_log("Error - downloaded start time is no good: $time \n"); + } + }else{ + print_log("Found match: $buildname but status is not success: $status\n"); + } + $time = $grabbed_time; + } + } + } + return $time; +} + sub print_log_test_result { my ($test_name, $test_title, $num_result, $units, $print_name, $print_result) = @_; print_log "\nTinderboxPrint:"; if ($Settings::TestsPhoneHome) { - my $time = POSIX::strftime "%Y:%m:%d:%H:%M:%S", localtime; + + my $time = POSIX::strftime("%Y:%m:%d:%H:%M:%S", localtime($graph_time)); print_log ""; } else { print_log "";