graph_time should only be pulled once per run, b=342767, r=preed

This commit is contained in:
rhelmer%mozilla.com 2006-07-01 00:00:42 +00:00
Родитель 139e85228f
Коммит 974c723eed
1 изменённых файлов: 36 добавлений и 36 удалений

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

@ -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 "<a title=\"$test_title\" href=\"http://$Settings::results_server/graph/query.cgi?testname=" . $test_name . "&units=$units&tbox=" . get_graph_tbox_name() . "&autoscale=1&days=7&avg=1&showpoint=$time,$num_result\">";
} else {
print_log "<abbr title=\"$test_title\">";