From: Bill Wendling Date: Sun, 16 Oct 2011 22:44:08 +0000 (+0000) Subject: Overhaul the 'test-release' script. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1416dc29d8573e58c8b2d7fe0715f3e289d03ab8;p=oota-llvm.git Overhaul the 'test-release' script. This removes support for building llvm-gcc. It will eventually add support for building other projects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142165 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/release/test-release.sh b/utils/release/test-release.sh index 21d7fee4221..f13f144793c 100755 --- a/utils/release/test-release.sh +++ b/utils/release/test-release.sh @@ -14,14 +14,20 @@ set -e # Exit if any command fails +projects="llvm cfe dragonegg test-suite compiler-rt libcxx libcxxabi" + +# Base SVN URL for the sources. +Base_url="http://llvm.org/svn/llvm-project" + Release="" Release_no_dot="" RC="" do_checkout="yes" do_ada="no" do_objc="yes" -do_fortran="yes" +do_fortran="no" do_64bit="yes" +do_debug="no" BuildDir="`pwd`" function usage() { @@ -34,8 +40,9 @@ function usage() { echo " -no-checkout Don't checkout the sources from SVN." echo " -no-64bit Don't test the 64-bit version. [default: yes]" echo " -enable-ada Build Ada. [default: disable]" + echo " -enable-fortran Enable Fortran build. [default: disable]" echo " -disable-objc Disable ObjC build. [default: enable]" - echo " -disable-fortran Disable Fortran build. [default: enable]" + echo " -test-debug Test the debug build. [default: no]" } while [ $# -gt 0 ]; do @@ -69,13 +76,14 @@ while [ $# -gt 0 ]; do -enable-ada | --enable-ada ) do_ada="yes" ;; + -enable-fortran | --enable-fortran ) + do_fortran="yes" + ;; -disable-objc | --disable-objc ) do_objc="no" ;; - -disable-fortran | --disable-fortran ) - echo "WARNING: Do you *really* need to disable Fortran?" - sleep 5 - do_fortran="no" + -test-debug | --test-debug ) + do_debug="yes" ;; -help | --help | -h | --h | -\? ) usage @@ -92,11 +100,11 @@ done # Check required arguments. if [ -z "$Release" ]; then - echo "No release number specified!" + echo "error: no release number specified" exit 1 fi if [ -z "$RC" ]; then - echo "No release candidate number specified!" + echo "error: no release candidate number specified" exit 1 fi @@ -114,55 +122,71 @@ if [ -z "$NumJobs" ]; then NumJobs=3 fi -# Location of sources. -llvmCore_srcdir=$BuildDir/llvmCore-$Release-rc$RC.src -llvmgcc42_srcdir=$BuildDir/llvmgcc42-$Release-rc$RC.src +# Go to the build directory (may be different from CWD) +BuildDir=$BuildDir/rc$RC +mkdir -p $BuildDir +cd $BuildDir # Location of log files. -LogDirName="$Release-rc$RC.logs" -LogDir=$BuildDir/$LogDirName +LogDir=$BuildDir/logs mkdir -p $LogDir -# SVN URLs for the sources. -Base_url="http://llvm.org/svn/llvm-project" -llvmCore_RC_url="$Base_url/llvm/tags/RELEASE_$Release_no_dot/rc$RC" -llvmgcc42_RC_url="$Base_url/llvm-gcc-4.2/tags/RELEASE_$Release_no_dot/rc$RC" -clang_RC_url="$Base_url/cfe/tags/RELEASE_$Release_no_dot/rc$RC" -test_suite_RC_url="$Base_url/test-suite/tags/RELEASE_$Release_no_dot/rc$RC" +# Find a compilers. +c_compiler="`which clang`" +if [ -z "$c_compiler" ]; then + c_compiler="`which gcc`" + if [ -z "$c_compiler" ]; then + c_compiler="`which cc`" + if [ -z "$c_compiler" ]; then + echo "error: cannot find a working C compiler" + fi + fi +fi +cxx_compiler="`which clang++`" +if [ -z "$cxx_compiler" ]; then + cxx_compiler="`which g++`" + if [ -z "$cxx_compiler" ]; then + cxx_compiler="`which c++`" + if [ -z "$cxx_compiler" ]; then + echo "error: cannot find a working C++ compiler" + fi + fi +fi # Make sure that the URLs are valid. function check_valid_urls() { - echo "# Validating SVN URLs" - if ! svn ls $llvmCore_RC_url > /dev/null 2>&1 ; then - echo "llvm $Release release candidate $RC doesn't exist!" - exit 1 - fi - if ! svn ls $llvmgcc42_RC_url > /dev/null 2>&1 ; then - echo "llvm-gcc-4.2 $Release release candidate $RC doesn't exist!" - exit 1 - fi - if ! svn ls $clang_RC_url > /dev/null 2>&1 ; then - echo "clang $Release release candidate $RC doesn't exist!" - exit 1 - fi - if ! svn ls $test_suite_RC_url > /dev/null 2>&1 ; then - echo "test-suite $Release release candidate $RC doesn't exist!" - exit 1 - fi + for proj in $projects ; do + echo "# Validating $proj SVN URL" + + if ! svn ls $Base_url/tags/RELEASE_$Release_no_dot/rc$RC > /dev/null 2>&1 ; then + echo "llvm $Release release candidate $RC doesn't exist!" + exit 1 + fi + done } # Export sources to the the build directory. function export_sources() { check_valid_urls - echo "# Exporting llvm $Release-RC$RC sources" - svn export -q $llvmCore_RC_url $llvmCore_srcdir - echo "# Exporting llvm-gcc-4.2 $Release-rc$RC sources" - svn export -q $llvmgcc42_RC_url $llvmgcc42_srcdir - echo "# Exporting clang $Release-rc$RC sources" - svn export -q $clang_RC_url $llvmCore_srcdir/tools/clang - echo "# Exporting llvm test suite $Release-rc$RC sources" - svn export -q $test_suite_RC_url $llvmCore_srcdir/projects/llvm-test + for proj in $projects ; do + echo "# Exporting $proj $Release-RC$RC sources" + if ! svn export -q $Base_url/$proj/tags/RELEASE_$Release_no_dot/rc$RC $proj.src ; then + echo "error: failed to export $proj project" + exit 1 + fi + done + + echo "# Creating symlinks" + cd $BuildDir/llvm.src/tools + if [ ! -h clang ]; then + ln -s $BuildDir/cfe.src clang + fi + cd $BuildDir/llvm.src/projects + if [ ! -h llvm-test ]; then + ln -s $BuildDir/test-suite.src llvm-test + fi + cd $BuildDir } function configure_llvmCore() { @@ -170,7 +194,6 @@ function configure_llvmCore() { Flavor="$2" ObjDir="$3" InstallDir="$4" - llvmgccDir="$5" case $Flavor in Release | Release-64 ) @@ -186,24 +209,26 @@ function configure_llvmCore() { Assertions="yes" ;; * ) - echo "# Invalid flavor $Flavor!" + echo "# Invalid flavor '$Flavor'" echo "" return ;; esac + echo "# Using C compiler: $c_compiler" + echo "# Using C++ compiler: $cxx_compiler" + cd $ObjDir echo "# Configuring llvm $Release-rc$RC $Flavor" - echo "# $llvmCore_srcdir/configure --prefix=$InstallDir \ + echo "# $BuildDir/llvm.src/configure --prefix=$InstallDir \ --enable-optimized=$Optimized \ - --enable-assertions=$Assertions \ - --with-llvmgccdir=$llvmgccDir" - $llvmCore_srcdir/configure --prefix=$InstallDir \ + --enable-assertions=$Assertions" + env CC=$c_compiler CXX=$cxx_compiler \ + $BuildDir/llvm.src/configure --prefix=$InstallDir \ --enable-optimized=$Optimized \ --enable-assertions=$Assertions \ - --with-llvmgccdir=$llvmgccDir \ - > $LogDir/llvm.configure.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1 - cd - + 2>&1 | tee $LogDir/llvm.configure-Phase$Phase-$Flavor.log + cd $BuildDir } function build_llvmCore() { @@ -212,10 +237,6 @@ function build_llvmCore() { ObjDir="$3" ExtraOpts="" - CompilerFlags="" - if [ "$Phase" = "2" ]; then - CompilerFlags="CC=$llvmgccDir/bin/llvm-gcc CXX=$llvmgccDir/bin/llvm-g++" - fi if [ "$Flavor" = "Release-64" ]; then ExtraOpts="EXTRA_OPTIONS=-m64" fi @@ -223,14 +244,14 @@ function build_llvmCore() { cd $ObjDir echo "# Compiling llvm $Release-rc$RC $Flavor" echo "# make -j $NumJobs VERBOSE=1 $ExtraOpts" - make -j $NumJobs VERBOSE=1 $ExtraOpts $CompilerFlags \ - > $LogDir/llvm.make.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1 + make -j $NumJobs VERBOSE=1 $ExtraOpts \ + 2>&1 | tee $LogDir/llvm.make-Phase$Phase-$Flavor.log echo "# Installing llvm $Release-rc$RC $Flavor" echo "# make install" make install \ - > $LogDir/llvm.install.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1 - cd - + 2>&1 | tee $LogDir/llvm.install-Phase$Phase-$Flavor.log + cd $BuildDir } function test_llvmCore() { @@ -239,67 +260,11 @@ function test_llvmCore() { ObjDir="$3" cd $ObjDir - make check \ - > $LogDir/llvm.check.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1 - make -C tools/clang test \ - > $LogDir/clang.check.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1 + make check-all \ + 2>&1 | tee $LogDir/llvm.check-Phase$Phase-$Flavor.log make unittests \ - > $LogDir/llvm.unittests.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1 - cd - -} - -function configure_llvm_gcc() { - Phase="$1" - Flavor="$2" - ObjDir="$3" - InstallDir="$4" - llvmObjDir="$5" - - languages="c,c++" - if [ "$do_objc" = "yes" ]; then - languages="$languages,objc,obj-c++" - fi - if [ "$do_fortran" = "yes" ]; then - languages="$languages,fortran" - fi - if [ "$do_ada" = "yes" ]; then - languages="$languages,ada" - fi - - cd $ObjDir - echo "# Configuring llvm-gcc $Release-rc$RC $Flavor" - echo "# $llvmgcc42_srcdir/configure --prefix=$InstallDir \ - --program-prefix=llvm- --enable-llvm=$llvmObjDir \ - --enable-languages=$languages" - $llvmgcc42_srcdir/configure --prefix=$InstallDir \ - --program-prefix=llvm- --enable-llvm=$llvmObjDir \ - --enable-languages=$languages \ - > $LogDir/llvm-gcc.configure.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1 - cd - -} - -function build_llvm_gcc() { - Phase="$1" - Flavor="$2" - ObjDir="$3" - llvmgccDir="$4" - - CompilerFlags="" - if [ "$Phase" = "2" ]; then - CompilerFlags="CC=$llvmgccDir/bin/llvm-gcc CXX=$llvmgccDir/bin/llvm-g++" - fi - - cd $ObjDir - echo "# Compiling llvm-gcc $Release-rc$RC $Flavor" - echo "# make -j $NumJobs bootstrap LLVM_VERSION_INFO=$Release" - make -j $NumJobs bootstrap LLVM_VERSION_INFO=$Release $CompilerFlags \ - > $LogDir/llvm-gcc.make.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1 - - echo "# Installing llvm-gcc $Release-rc$RC $Flavor" - echo "# make install" - make install \ - > $LogDir/llvm-gcc.install.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1 - cd - + 2>&1 | tee $LogDir/llvm.unittests--Phase$Phase-$Flavor.log + cd $BuildDir } if [ "$do_checkout" = "yes" ]; then @@ -307,7 +272,10 @@ if [ "$do_checkout" = "yes" ]; then fi ( -Flavors="Debug Release Release+Asserts" +Flavors="Release Release+Asserts" +if [ "$do_debug" = "yes" ]; then + Flavors="Debug $Flavors" +fi if [ "$do_64bit" = "yes" ]; then Flavors="$Flavors Release-64" fi @@ -339,55 +307,25 @@ for Flavor in $Flavors ; do mkdir -p $llvmCore_phase2_objdir mkdir -p $llvmCore_phase2_installdir - llvmgcc42_phase1_objdir=$BuildDir/Phase1/$Flavor/llvmgcc42-$Release-rc$RC.obj - llvmgcc42_phase1_installdir=$BuildDir/Phase1/$Flavor/llvmgcc42-$Release-rc$RC.install - - llvmgcc42_phase2_objdir=$BuildDir/Phase2/$Flavor/llvmgcc42-$Release-rc$RC.obj - llvmgcc42_phase2_installdir=$BuildDir/Phase2/$Flavor/llvmgcc42-$Release-rc$RC.install - - rm -rf $llvmgcc42_phase1_objdir - rm -rf $llvmgcc42_phase1_installdir - rm -rf $llvmgcc42_phase2_objdir - rm -rf $llvmgcc42_phase2_installdir - - mkdir -p $llvmgcc42_phase1_objdir - mkdir -p $llvmgcc42_phase1_installdir - mkdir -p $llvmgcc42_phase2_objdir - mkdir -p $llvmgcc42_phase2_installdir - ############################################################################ # Phase 1: Build llvmCore and llvmgcc42 echo "# Phase 1: Building llvmCore" configure_llvmCore 1 $Flavor \ - $llvmCore_phase1_objdir $llvmCore_phase1_installdir \ - $llvmgcc42_phase1_installdir + $llvmCore_phase1_objdir $llvmCore_phase1_installdir build_llvmCore 1 $Flavor \ $llvmCore_phase1_objdir - echo "# Phase 1: Building llvmgcc42" - configure_llvm_gcc 1 $Flavor \ - $llvmgcc42_phase1_objdir $llvmgcc42_phase1_installdir \ - $llvmCore_phase1_objdir - build_llvm_gcc 1 $Flavor \ - $llvmgcc42_phase1_objdir $llvmgcc42_phase1_installdir - ############################################################################ - # Phase 2: Build llvmCore with newly built llvmgcc42 from phase 1. + # Phase 2: Build llvmCore with newly built clang from phase 1. + c_compiler=$llvmCore_phase1_installdir/bin/clang + cxx_compiler=$llvmCore_phase1_installdir/bin/clang++ echo "# Phase 2: Building llvmCore" configure_llvmCore 2 $Flavor \ - $llvmCore_phase2_objdir $llvmCore_phase2_installdir \ - $llvmgcc42_phase1_installdir + $llvmCore_phase2_objdir $llvmCore_phase2_installdir build_llvmCore 2 $Flavor \ $llvmCore_phase2_objdir - echo "# Phase 2: Building llvmgcc42" - configure_llvm_gcc 2 $Flavor \ - $llvmgcc42_phase2_objdir $llvmgcc42_phase2_installdir \ - $llvmCore_phase2_objdir - build_llvm_gcc 2 $Flavor \ - $llvmgcc42_phase2_objdir $llvmgcc42_phase1_installdir - - echo "# Testing - built with llvmgcc42" + echo "# Testing - built with clang" test_llvmCore 2 $Flavor $llvmCore_phase2_objdir done ) 2>&1 | tee $LogDir/testing.$Release-rc$RC.log