Changes for LLVM coding standard compliance:

1. Remove tabs
  2. Wrap to 80 columns
  3. Put spaces between "if" or "elsif" and expression
  4. Put { on same line as if statement.
  5. Make indentation be 2 spaces.
Functionality change:
  Run utils/countloc.sh after the build is done. This is necessary because
  that script now uses llvm-config to find the top src directory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29651 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer
2006-08-13 09:53:02 +00:00
parent 52a51e38dc
commit fa34d7b3a7

View File

@@ -90,14 +90,11 @@ use Socket;
##############################################################
my $HOME = $ENV{'HOME'};
my $CVSRootDir = $ENV{'CVSROOT'};
$CVSRootDir = "/home/vadve/shared/PublicCVS"
unless $CVSRootDir;
$CVSRootDir = "/home/vadve/shared/PublicCVS" unless $CVSRootDir;
my $BuildDir = $ENV{'BUILDDIR'};
$BuildDir = "$HOME/buildtest"
unless $BuildDir;
$BuildDir = "$HOME/buildtest" unless $BuildDir;
my $WebDir = $ENV{'WEBDIR'};
$WebDir = "$HOME/cvs/testresults-X86"
unless $WebDir;
$WebDir = "$HOME/cvs/testresults-X86" unless $WebDir;
##############################################################
#
@@ -135,8 +132,7 @@ while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; }
if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; }
if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ".
"OPTIMIZE_OPTION=-O2";
$BUILDTYPE="release"; next; }
"OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release"; next;}
if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; }
if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1";
$CONFIGUREARGS .= " --disable-llc_diffs"; next; }
@@ -146,51 +142,32 @@ while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
if (/^-verbose$/) { $VERBOSE = 1; next; }
if (/^-debug$/) { $DEBUG = 1; next; }
if (/^-nice$/) { $NICE = "nice "; next; }
if (/^-f2c$/) {
$CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next;
}
if (/^-with-externals$/) {
$CONFIGUREARGS .= " --with-externals=$ARGV[0]"; shift; next;
}
if (/^-submit-server/) {
$SUBMITSERVER = "$ARGV[0]"; shift; next;
}
if (/^-submit-script/) {
$SUBMITSCRIPT = "$ARGV[0]"; shift; next;
}
if (/^-f2c$/) { $CONFIGUREARGS .= " --with-f2c=$ARGV[0]";
shift; next; }
if (/^-with-externals$/) { $CONFIGUREARGS .= " --with-externals=$ARGV[0]";
shift; next; }
if (/^-submit-server/) { $SUBMITSERVER = "$ARGV[0]"; shift; next; }
if (/^-submit-script/) { $SUBMITSCRIPT = "$ARGV[0]"; shift; next; }
if (/^-nickname$/) { $nickname = "$ARGV[0]"; shift; next; }
if (/^-gccpath/) { $CONFIGUREARGS .=
" CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++";
$GCCPATH=$ARGV[0];
shift;
next;}
$GCCPATH=$ARGV[0]; shift; next; }
else { $GCCPATH=""; }
if (/^-cvstag/) { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; }
else { $CVSCOOPT="";}
if (/^-target/) {
$CONFIGUREARGS .= " --target=$ARGV[0]"; shift; next;
}
if (/^-cflags/) {
$MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'"; shift; next;
}
if (/^-cxxflags/) {
$MAKEOPTS = "$MAKEOPTS CXX.Flags=\'$ARGV[0]\'"; shift; next;
}
if (/^-ldflags/) {
$MAKEOPTS = "$MAKEOPTS LD.Flags=\'$ARGV[0]\'"; shift; next;
}
if (/^-compileflags/) {
$MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next;
}
if (/^-use-gmake/) {
$MAKECMD = "gmake"; shift; next;
}
if (/^-compileflags/) {
$MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next;
}
if (/^-extraflags/) {
$CONFIGUREARGS .= " --with-extra-options=\'$ARGV[0]\'"; shift; next;
}
if (/^-target/) { $CONFIGUREARGS .= " --target=$ARGV[0]";
shift; next; }
if (/^-cflags/) { $MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'";
shift; next; }
if (/^-cxxflags/) { $MAKEOPTS = "$MAKEOPTS CXX.Flags=\'$ARGV[0]\'";
shift; next; }
if (/^-ldflags/) { $MAKEOPTS = "$MAKEOPTS LD.Flags=\'$ARGV[0]\'";
shift; next; }
if (/^-compileflags/) { $MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next; }
if (/^-use-gmake/) { $MAKECMD = "gmake"; shift; next; }
if (/^-compileflags/) { $MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next; }
if (/^-extraflags/) { $CONFIGUREARGS .=
" --with-extra-options=\'$ARGV[0]\'"; shift; next;}
if (/^-noexternals$/) { $NOEXTERNALS = 1; next; }
if (/^-nodejagnu$/) { $NODEJAGNU = 1; next; }
if (/^-nobuild$/) { $NOBUILD = 1; next; }
@@ -204,7 +181,6 @@ if ($CONFIGUREARGS !~ /--disable-jit/) {
$CONFIGUREARGS .= " --enable-jit";
}
if (@ARGV != 0 and @ARGV != 3 and $VERBOSE) {
foreach $x (@ARGV) {
print "$x\n";
@@ -226,7 +202,8 @@ if($CVSRootDir eq "" or
}
if ($nickname eq "") {
die ("Please invoke NewNightlyTest.pl with command line option \"-nickname <nickname>\"");
die ("Please invoke NewNightlyTest.pl with command line option " .
"\"-nickname <nickname>\"");
}
if ($BUILDTYPE ne "release") {
@@ -302,9 +279,8 @@ sub DiffFiles {
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub GetRegex { # (Regex with ()'s, value)
$_[1] =~ /$_[0]/m;
if (defined($1)) {
return $1;
}
return $1
if (defined($1));
return "0";
}
@@ -533,13 +509,14 @@ ChangeDir( $BuildDir, "CVS checkout directory" );
##############################################################
my $CVSOPT = "";
# Use compression if going over ssh.
$CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/;
$CVSOPT = "-z3"
if $CVSRootDir =~ /^:ext:/;
my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co $CVSCOOPT";
if (!$NOCHECKOUT) {
if ( $VERBOSE )
{
if ( $VERBOSE ) {
print "CHECKOUT STAGE:\n";
print "( time -p $CVSCMD llvm; cd llvm/projects ; $CVSCMD llvm-test ) > $CVSLog 2>&1\n";
print "( time -p $CVSCMD llvm; cd llvm/projects ; $CVSCMD llvm-test ) " .
"> $CVSLog 2>&1\n";
}
system "( time -p $CVSCMD llvm; cd llvm/projects ; " .
"$CVSCMD llvm-test ) > $CVSLog 2>&1";
@@ -564,14 +541,14 @@ my $CVSCheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $CVSLog`;
my $CVSCheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys;
my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0;
my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
my $LOC = `utils/countloc.sh`;
my $NumDirsInCVS =
`egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0;
##############################################################
#
# Extract some information from the CVS history... use a hash so no duplicate
# stuff is stored. This gets the history from the previous days worth
# of cvs activit and parses it.
# of cvs activity and parses it.
#
##############################################################
@@ -635,11 +612,12 @@ if (!$NOCHECKOUT && !$NOBUILD) {
my $EXTRAFLAGS = "--enable-spec --with-objroot=.";
if ( $VERBOSE ) {
print "CONFIGURE STAGE:\n";
print "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1\n";
print "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) " .
"> $BuildLog 2>&1\n";
}
system "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1";
if ( $VERBOSE )
{
system "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) " .
"> $BuildLog 2>&1";
if ( $VERBOSE ) {
print "BUILD STAGE:\n";
print "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1\n";
}
@@ -647,7 +625,6 @@ if (!$NOCHECKOUT && !$NOBUILD) {
system "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1";
}
##############################################################
#
# Get some statistics about the build...
@@ -660,6 +637,11 @@ if (!$NOCHECKOUT && !$NOBUILD) {
#my $NumObjects = `grep ']\: Compiling ' $BuildLog | wc -l` + 0;
# Get the number of lines of source code. Must be here after the build is done
# because countloc.sh uses the llvm-config script which must be built.
my $LOC = `utils/countloc.sh`;
# 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
@@ -692,28 +674,24 @@ if ($BuildError) { $NODEJAGNU=1; }
my $a_file_sizes="";
my $o_file_sizes="";
if (!$BuildError) {
if ( $VERBOSE ){
print "Organizing size of .o and .a files\n";
}
print "Organizing size of .o and .a files\n"
if ( $VERBOSE );
ChangeDir( "$BuildDir/llvm", "Build Directory" );
$afiles.= `find utils/ -iname '*.a' -ls`;
$afiles.= `find lib/ -iname '*.a' -ls`;
$afiles.= `find tools/ -iname '*.a' -ls`;
if($BUILDTYPE eq "release"){
$afiles.= `find Release/ -iname '*.a' -ls`;
}
else{
} else {
$afiles.= `find Debug/ -iname '*.a' -ls`;
}
$ofiles.= `find utils/ -iname '*.o' -ls`;
$ofiles.= `find lib/ -iname '*.o' -ls`;
$ofiles.= `find tools/ -iname '*.o' -ls`;
if($BUILDTYPE eq "release"){
$ofiles.= `find Release/ -iname '*.o' -ls`;
}
else{
} else {
$ofiles.= `find Debug/ -iname '*.o' -ls`;
}
@@ -729,13 +707,11 @@ if(!$BuildError){
$x =~ m/.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+(.+)\s+.+\s+.+\s+.+\s+(.+)/;
$o_file_sizes.="$1 $2 $BUILDTYPE\n";
}
}
else{
} else {
$a_file_sizes="No data due to a bad build.";
$o_file_sizes="No data due to a bad build.";
}
##############################################################
#
# Running dejagnu tests
@@ -744,8 +720,7 @@ else{
my $DejangnuTestResults; # String containing the results of the dejagnu
my $dejagnu_output = "$DejagnuTestsLog";
if (!$NODEJAGNU) {
if($VERBOSE)
{
if($VERBOSE) {
print "DEJAGNU FEATURE/REGRESSION TEST STAGE:\n";
print "(time -p $MAKECMD $MAKEOPTS check) > $dejagnu_output 2>&1\n";
}
@@ -761,12 +736,14 @@ if(!$NODEJAGNU) {
$DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog);
$unexpfail_tests = $DejagnuTestResults;
}
#Extract time of dejagnu tests
my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output";
my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output";
$DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System
$DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output";
$DejagnuTestResults = "Dejagnu skipped by user choice." unless $DejagnuTestResults;
$DejagnuTestResults =
"Dejagnu skipped by user choice." unless $DejagnuTestResults;
$DejagnuTime = "0.0" unless $DejagnuTime;
$DejagnuWallTime = "0.0" unless $DejagnuWallTime;
@@ -776,7 +753,6 @@ $DejagnuWallTime = "0.0" unless $DejagnuWallTime;
#
##############################################################
if (!$NODEJAGNU) {
if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; }
my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`;
my @Warnings;
@@ -785,9 +761,8 @@ my $CurDir = "";
foreach $Warning (@Warn) {
if ($Warning =~ m/Entering directory \`([^\`]+)\'/) {
$CurDir = $1; # Keep track of directory warning is in...
if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included
$CurDir = $1;
}
# Remove buildir prefix if included
if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { $CurDir = $1; }
} else {
push @Warnings, "$CurDir/$Warning"; # Add directory to warning...
}
@@ -812,13 +787,15 @@ my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt";
#
# If we built the tree successfully, run the nightly programs tests...
#
# A set of tests to run is passed in (i.e. "SingleSource" "MultiSource" "External")
# A set of tests to run is passed in (i.e. "SingleSource" "MultiSource"
# "External")
#
##############################################################
sub TestDirectory {
my $SubDir = shift;
ChangeDir( "$BuildDir/llvm/projects/llvm-test/$SubDir", "Programs Test Subdirectory" ) || return ("", "");
ChangeDir( "$BuildDir/llvm/projects/llvm-test/$SubDir",
"Programs Test Subdirectory" ) || return ("", "");
my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt";
@@ -860,7 +837,8 @@ if (!$BuildError) {
if ( $VERBOSE ) {
print "SingleSource TEST STAGE\n";
}
($SingleSourceProgramsTable, $llcbeta_options) = TestDirectory("SingleSource");
($SingleSourceProgramsTable, $llcbeta_options) =
TestDirectory("SingleSource");
WriteFile "$Prefix-singlesourceprogramstable.txt", $SingleSourceProgramsTable;
if ( $VERBOSE ) {
print "MultiSource TEST STAGE\n";
@@ -873,14 +851,16 @@ if (!$BuildError) {
}
($ExternalProgramsTable, $llcbeta_options) = TestDirectory("External");
WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable;
system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ".
system "cat $Prefix-singlesourceprogramstable.txt " .
"$Prefix-multisourceprogramstable.txt ".
"$Prefix-externalprogramstable.txt | sort > $Prefix-Tests.txt";
} else {
$ExternalProgramsTable = "External TEST STAGE SKIPPED\n";
if ( $VERBOSE ) {
print "External TEST STAGE SKIPPED\n";
}
system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ".
system "cat $Prefix-singlesourceprogramstable.txt " .
"$Prefix-multisourceprogramstable.txt ".
" | sort > $Prefix-Tests.txt";
}
WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable;
@@ -937,10 +917,14 @@ if (!$BuildError) {
# Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and
# GET_STABLE_NUMBERS enabled!
if( $VERBOSE ) { print "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " .
" LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1\n"; }
system "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " .
" LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1";
if( $VERBOSE ) {
print "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out " .
"TEST=nightly LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 " .
"> /dev/null 2>&1\n";
}
system "$MAKECMD -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out " .
"TEST=nightly LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 " .
"> /dev/null 2>&1";
system "cp report.nightly.csv $OldenTestsLog";
}
}
@@ -958,7 +942,6 @@ $endtime = `date "+20%y-%m-%d %H:%M:%S"`;
# Place all the logs neatly into one humungous file
#
##############################################################
if ( $VERBOSE ) { print "PREPARING LOGS TO BE SENT TO SERVER\n"; }
$machine_data = "uname: ".`uname -a`.
@@ -995,8 +978,7 @@ $dejagnulog_full = join("\n", @DEJAGNULOG_FULL);
my $gcc_version_long="";
if ($GCCPATH ne "") {
$gcc_version_long = `$GCCPATH/gcc --version`;
}
else{
} else {
$gcc_version_long = `gcc --version`;
}
@GCC_VERSION = split '\n', $gcc_version_long;
@@ -1012,7 +994,8 @@ my $all_tests = ReadFile "$Prefix-Tests.txt";
if ( $VERBOSE ) { print "SEND THE DATA VIA THE POST REQUEST\n"; }
my %hash_of_data = ('machine_data' => $machine_data,
my %hash_of_data = (
'machine_data' => $machine_data,
'build_data' => $build_data,
'gcc_version' => $gcc_version,
'nickname' => $nickname,
@@ -1051,7 +1034,8 @@ my %hash_of_data = ('machine_data' => $machine_data,
'starttime' => $starttime,
'endtime' => $endtime,
'o_file_sizes' => $o_file_sizes,
'a_file_sizes' => $a_file_sizes);
'a_file_sizes' => $a_file_sizes
);
$TESTING = 0;
@@ -1060,8 +1044,7 @@ if($TESTING){
foreach $x(keys %hash_of_data){
print "$x => $hash_of_data{$x}\n";
}
}
else{
} else {
my $response = SendData $SUBMITSERVER,$SUBMITSCRIPT,\%hash_of_data;
if( $VERBOSE) { print "============================\n$response"; }
}
@@ -1071,7 +1054,7 @@ else{
# Remove the cvs tree...
#
##############################################################
system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE);
system ( "$NICE rm -rf $WebDir") if (!$NOCHECKOUT and !$NOREMOVE and !$NOREMOVERESULTS);
system ( "$NICE rm -rf $BuildDir")
if (!$NOCHECKOUT and !$NOREMOVE);
system ( "$NICE rm -rf $WebDir")
if (!$NOCHECKOUT and !$NOREMOVE and !$NOREMOVERESULTS);