From 439801e1b48db414cb4e4c50b4ca1c1bf92a30e9 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Mon, 19 Oct 2009 13:20:13 +0000 Subject: NNT: Move build code into subroutine. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84490 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/NewNightlyTest.pl | 82 ++++++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 39 deletions(-) (limited to 'utils/NewNightlyTest.pl') diff --git a/utils/NewNightlyTest.pl b/utils/NewNightlyTest.pl index e244aa3..28f57f4 100755 --- a/utils/NewNightlyTest.pl +++ b/utils/NewNightlyTest.pl @@ -584,49 +584,35 @@ ChangeDir( $LLVMSrcDir , "llvm source directory") ; # Build the entire tree, saving build messages to the build log # ############################################################## -if (!$NOCHECKOUT && !$NOBUILD) { - my $EXTRAFLAGS = "--enable-spec --with-objroot=."; - RunLoggedCommand("(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) ", - $BuildLog, "CONFIGURE"); - # Build the entire tree, capturing the output into $BuildLog - RunAppendingLoggedCommand("(time -p $NICE $MAKECMD clean)", $BuildLog, "BUILD CLEAN"); - RunAppendingLoggedCommand("(time -p $NICE $MAKECMD $MAKEOPTS)", $BuildLog, "BUILD"); -} - -############################################################## -# -# Get some statistics about the build... -# -############################################################## - -# Get the time taken by the configure script -my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog"; -my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog"; -my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System -my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog"; - -$ConfigTime=-1 unless $ConfigTime; -$ConfigWallTime=-1 unless $ConfigWallTime; - -my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog"; -my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog"; -my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System -my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog"; +sub BuildLLVM { + if (!$NOCHECKOUT && !$NOBUILD) { + my $EXTRAFLAGS = "--enable-spec --with-objroot=."; + RunLoggedCommand("(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) ", + $BuildLog, "CONFIGURE"); + # Build the entire tree, capturing the output into $BuildLog + RunAppendingLoggedCommand("(time -p $NICE $MAKECMD clean)", $BuildLog, "BUILD CLEAN"); + RunAppendingLoggedCommand("(time -p $NICE $MAKECMD $MAKEOPTS)", $BuildLog, "BUILD"); + } -$BuildTime=-1 unless $BuildTime; -$BuildWallTime=-1 unless $BuildWallTime; + # Check for build error. + my $HadError = 0, $Status = "OK"; + if ($NOBUILD) { + $Status = "Skipped by user"; + } + elsif (`grep '^$MAKECMD\[^:]*: .*Error' $BuildLog | wc -l` + 0 || + `grep '^$MAKECMD: \*\*\*.*Stop.' $BuildLog | wc -l`+0) { + $Status = "Error: compilation aborted"; + $HadError = 1; + } -my $BuildError = 0, $BuildStatus = "OK"; -if ($NOBUILD) { - $BuildStatus = "Skipped by user"; + return ($HadError, $Status); } -elsif (`grep '^$MAKECMD\[^:]*: .*Error' $BuildLog | wc -l` + 0 || - `grep '^$MAKECMD: \*\*\*.*Stop.' $BuildLog | wc -l`+0) { - $BuildStatus = "Error: compilation aborted"; - $BuildError = 1; - if( $VERBOSE) { print "\n***ERROR BUILDING TREE\n\n"; } +($BuildError, $BuildStatus) = BuildLLVM(); + +if ($BuildError) { + if( $VERBOSE) { print "\n***ERROR BUILDING TREE\n\n"; } + $NODEJAGNU=1; } -if ($BuildError) { $NODEJAGNU=1; } ############################################################## # @@ -844,11 +830,29 @@ if(!$BuildError){ if ( $VERBOSE ) { print "SEND THE DATA VIA THE POST REQUEST\n"; } +# Checkout info. my $CheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $COLog`; my $CheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $COLog`; my $CheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $COLog`; my $CheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys; +# Configure info. +my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog"; +my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog"; +my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System +my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog"; +$ConfigTime=-1 unless $ConfigTime; +$ConfigWallTime=-1 unless $ConfigWallTime; + +# Build info. +my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog"; +my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog"; +my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System +my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog"; +$BuildTime=-1 unless $BuildTime; +$BuildWallTime=-1 unless $BuildWallTime; + + my %hash_of_data = ( 'machine_data' => $machine_data, 'build_data' => $build_data, -- cgit v1.1