summaryrefslogtreecommitdiff
path: root/utils/NightlyTest.pl
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2004-09-28 16:04:00 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2004-09-28 16:04:00 +0000
commit90c82b932278426a8c3485e87569dde1365e81b9 (patch)
tree2fa3500fb49e04af96c19ce5a789b686502b6609 /utils/NightlyTest.pl
parentef672a691c6489435f5d63d41b75fcfca153d630 (diff)
downloadllvm-90c82b932278426a8c3485e87569dde1365e81b9.tar.gz
llvm-90c82b932278426a8c3485e87569dde1365e81b9.tar.bz2
llvm-90c82b932278426a8c3485e87569dde1365e81b9.tar.xz
Touch output files before reading or writing them, so that they are
always guaranteed to exist. This fixes PR444. Thanks to Alkis for reporting the bug and testing the patch. AddRecord used to return a big list, but that return value was never used. So now it doesn't return anything. Create the WebDir if it does not exist. Fix a typo in a comment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16541 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/NightlyTest.pl')
-rwxr-xr-xutils/NightlyTest.pl29
1 files changed, 26 insertions, 3 deletions
diff --git a/utils/NightlyTest.pl b/utils/NightlyTest.pl
index 059d0c0b40..03c8554ded 100755
--- a/utils/NightlyTest.pl
+++ b/utils/NightlyTest.pl
@@ -44,7 +44,7 @@
# process and erased (unless -noremove is specified; see above.)
# WEBDIR is the directory into which the test results web page will be written,
# AND in which the "index.html" is assumed to be a symlink to the most recent
-# copy of the results. This directory MUST exist before the script is run.
+# copy of the results. This directory will be created if it does not exist.
# LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed
# to. This is the same as you would have for a normal LLVM build.
#
@@ -109,6 +109,18 @@ sub GetRegex { # (Regex with ()'s, value)
return "0";
}
+sub Touch {
+ my @files = @_;
+ my $now = time;
+ foreach my $file (@files) {
+ if (! -f $file) {
+ open (FILE, ">$file") or warn "Could not create new file $file";
+ close FILE;
+ }
+ utime $now, $now, $file;
+ }
+}
+
sub AddRecord {
my ($Val, $Filename) = @_;
my @Records;
@@ -118,7 +130,6 @@ sub AddRecord {
}
push @Records, "$DATE: $Val";
WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n";
- return @Records;
}
sub AddPreTag { # Add pre tags around nonempty list, or convert to "none"
@@ -315,6 +326,10 @@ if ($VERBOSE) {
print "BuildLog = $BuildLog\n";
}
+if (! -d $WebDir) {
+ mkdir $WebDir, 0777;
+ warn "Warning: $WebDir did not exist; creating it.\n";
+}
#
# Create the CVS repository directory
@@ -744,10 +759,18 @@ if ((scalar @PrevDays) > 20) {
my $PrevDaysList = join "\n ", map { "<a href=\"$_.html\">$_</a><br>" } @PrevDays;
#
-# Start outputing files into the web directory
+# Start outputting files into the web directory
#
ChangeDir( $WebDir, "Web Directory" );
+# Make sure we don't get errors running the nightly tester the first time
+# because of files that don't exist.
+Touch ('running_build_time.txt', 'running_Olden_llc_time.txt',
+ 'running_loc.txt', 'running_Olden_machcode.txt',
+ 'running_Olden_bytecode.txt', 'running_Olden_nat_time.txt',
+ 'running_Olden_cbe_time.txt', 'running_Olden_opt_time.txt',
+ 'running_Olden_jit_time.txt');
+
# Add information to the files which accumulate information for graphs...
AddRecord($LOC, "running_loc.txt");
AddRecord($BuildTime, "running_build_time.txt");