Regenerate.
[oota-llvm.git] / utils / NewNightlyTest.pl
index a8cf8de86814e4edf3d2b1cb049e74fd869e3dcb..1b48168262a5f3354628b900b4b0ce76a1bb3bcb 100755 (executable)
@@ -24,6 +24,7 @@ use Socket;
 #                   IMPLEMENTED.
 #  -nickname NAME   The NAME argument specifieds the nickname this script
 #                   will submit to the nightlytest results repository.
+#  -nouname         Don't include uname data (machine will be identified by nickname only).
 #  -submit-server   Specifies a server to submit the test results too. If this
 #                   option is not specified it defaults to
 #                   llvm.org. This is basically just the address of the
@@ -46,8 +47,8 @@ use Socket;
 #  -noclean         Do not run 'make clean' before building.
 #  -nobuild         Do not build llvm. If tests are enabled perform them
 #                   on the llvm build specified in the build directory
-#  -release         Build an LLVM Release version
-#  -release-asserts Build an LLVM ReleaseAsserts version
+#  -release         Build an LLVM Release+Asserts version
+#  -release-asserts Build an LLVM Release version
 #  -disable-bindings     Disable building LLVM bindings.
 #  -with-clang      Checkout Clang source into tools/clang.
 #  -compileflags    Next argument specifies extra options passed to make when
@@ -220,6 +221,7 @@ while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
                              $LLVMGCCPATH = $ARGV[0] . '/bin';
                              shift; next;}
   if (/^-noexternals$/)    { $NOEXTERNALS = 1; next; }
+  if (/^-nouname$/)        { $NOUNAME = 1; next; }
   if (/^-use-gmake/)       { $MAKECMD = "gmake"; shift; next; }
   if (/^-extraflags/)      { $CONFIGUREARGS .=
                              " --with-extra-options=\'$ARGV[0]\'"; shift; next;}
@@ -317,9 +319,9 @@ sub RunLoggedCommand {
   } else {
       if ($VERBOSE) {
           print "$Title\n";
-          print "$Command 2>&1 > $Log\n";
+          print "$Command > $Log 2>&1\n";
       }
-      system "$Command 2>&1 > $Log";
+      system "$Command > $Log 2>&1";
   }
 }
 
@@ -336,9 +338,9 @@ sub RunAppendingLoggedCommand {
   } else {
       if ($VERBOSE) {
           print "$Title\n";
-          print "$Command 2>&1 > $Log\n";
+          print "$Command >> $Log 2>&1\n";
       }
-      system "$Command 2>&1 >> $Log";
+      system "$Command >> $Log 2>&1";
   }
 }
 
@@ -393,10 +395,8 @@ sub CopyFile { #filename, newfile
 # to our central server via the post method
 #
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-sub SendData {
-    $host = $_[0];
-    $file = $_[1];
-    $variables = $_[2];
+sub WriteSentData {
+    $variables = $_[0];
 
     # Write out the "...-sentdata.txt" file.
 
@@ -406,6 +406,12 @@ sub SendData {
         $sentdata.= "$x  => $value\n";
     }
     WriteFile "$Prefix-sentdata.txt", $sentdata;
+}
+
+sub SendData {
+    $host = $_[0];
+    $file = $_[1];
+    $variables = $_[2];
 
     if (!($SUBMITAUX eq "")) {
         system "$SUBMITAUX \"$Prefix-sentdata.txt\"";
@@ -503,8 +509,8 @@ sub BuildLLVM {
   }
   RunAppendingLoggedCommand("(time -p $NICE $MAKECMD $MAKEOPTS)", $BuildLog, "BUILD");
 
-  if (`grep '^$MAKECMD\[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
-      `grep '^$MAKECMD: \*\*\*.*Stop.' $BuildLog | wc -l` + 0) {
+  if (`grep -a '^$MAKECMD\[^:]*: .*Error' $BuildLog | wc -l` + 0 ||
+      `grep -a '^$MAKECMD: \*\*\*.*Stop.' $BuildLog | wc -l` + 0) {
     return 0;
   }
 
@@ -531,15 +537,15 @@ sub TestDirectory {
   $LLCBetaOpts = `$MAKECMD print-llcbeta-option`;
 
   my $ProgramsTable;
-  if (`grep '^$MAKECMD\[^:]: .*Error' $ProgramTestLog | wc -l` + 0) {
+  if (`grep -a '^$MAKECMD\[^:]: .*Error' $ProgramTestLog | wc -l` + 0) {
     $ProgramsTable="Error running test $SubDir\n";
     print "ERROR TESTING\n";
-  } elsif (`grep '^$MAKECMD\[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
+  } elsif (`grep -a '^$MAKECMD\[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) {
     $ProgramsTable="Makefile error running tests $SubDir!\n";
     print "ERROR TESTING\n";
   } else {
     # Create a list of the tests which were run...
-    system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog ".
+    system "egrep -a 'TEST-(PASS|FAIL)' < $ProgramTestLog ".
            "| sort > $Prefix-$SubDir-Tests.txt";
   }
   $ProgramsTable = ReadFile "report.nightly.csv";
@@ -689,12 +695,21 @@ $endtime = `date "+20%y-%m-%d %H:%M:%S"`;
 
 if ( $VERBOSE ) { print "PREPARING LOGS TO BE SENT TO SERVER\n"; }
 
-$machine_data = "uname: ".`uname -a`.
-                "hardware: ".`uname -m`.
-                "os: ".`uname -sr`.
-                "name: ".`uname -n`.
-                "date: ".`date \"+20%y-%m-%d\"`.
-                "time: ".`date +\"%H:%M:%S\"`;
+if ( ! $NOUNAME ) {
+    $machine_data = "uname: ".`uname -a`.
+        "hardware: ".`uname -m`.
+        "os: ".`uname -sr`.
+        "name: ".`uname -n`.
+        "date: ".`date \"+20%y-%m-%d\"`.
+        "time: ".`date +\"%H:%M:%S\"`;
+} else {
+    $machine_data = "uname: (excluded)\n".
+        "hardware: ".`uname -m`.
+        "os: ".`uname -sr`.
+        "name: $nickname\n".
+        "date: ".`date \"+20%y-%m-%d\"`.
+        "time: ".`date +\"%H:%M:%S\"`;
+}
 
 # Get gcc version.
 my $gcc_version_long = "";
@@ -797,6 +812,9 @@ my %hash_of_data = (
   'a_file_sizes' => ""
 );
 
+# Write out the "...-sentdata.txt" file.
+WriteSentData \%hash_of_data;
+
 if ($SUBMIT || !($SUBMITAUX eq "")) {
   my $response = SendData $SUBMITSERVER,$SUBMITSCRIPT,\%hash_of_data;
   if( $VERBOSE) { print "============================\n$response"; }