test-release.sh: Correct the logged configure command to match the one actually issued.
[oota-llvm.git] / utils / release / test-release.sh
index c4cf521b92f5e1e24ecfafa5605e233fd63743ea..a4fa76ed452087e16adc9027c6d49a181ac125e6 100755 (executable)
@@ -18,7 +18,7 @@ else
     MAKE=make
 fi
 
-projects="llvm cfe dragonegg compiler-rt libcxx test-suite clang-tools-extra"
+projects="llvm cfe dragonegg compiler-rt libcxx libcxxabi test-suite clang-tools-extra"
 
 # Base SVN URL for the sources.
 Base_url="http://llvm.org/svn/llvm-project"
@@ -26,6 +26,8 @@ Base_url="http://llvm.org/svn/llvm-project"
 Release=""
 Release_no_dot=""
 RC=""
+Triple=""
+use_gzip="no"
 do_checkout="yes"
 do_ada="no"
 do_clang="yes"
@@ -44,6 +46,7 @@ function usage() {
     echo " -release X.Y      The release number to test."
     echo " -rc NUM           The pre-release candidate number."
     echo " -final            The final release candidate."
+    echo " -triple TRIPLE    The target triple for this machine."
     echo " -j NUM            Number of compile jobs to run. [default: 3]"
     echo " -build-dir DIR    Directory to perform testing in. [default: pwd]"
     echo " -no-checkout      Don't checkout the sources from SVN."
@@ -56,6 +59,7 @@ function usage() {
     echo " -test-debug       Test the debug build. [default: no]"
     echo " -test-asserts     Test with asserts on. [default: no]"
     echo " -no-compare-files Don't test that phase 2 and 3 files are identical."
+    echo " -use-gzip         Use gzip instead of xz."
 }
 
 while [ $# -gt 0 ]; do
@@ -63,7 +67,7 @@ while [ $# -gt 0 ]; do
         -release | --release )
             shift
             Release="$1"
-            Release_no_dot="`echo $1 | sed -e 's,\.,,'`"
+            Release_no_dot="`echo $1 | sed -e 's,\.,,g'`"
             ;;
         -rc | --rc | -RC | --RC )
             shift
@@ -72,6 +76,10 @@ while [ $# -gt 0 ]; do
         -final | --final )
             RC=final
             ;;
+        -triple | --triple )
+            shift
+            Triple="$1"
+            ;;
         -j* )
             NumJobs="`echo $1 | sed -e 's,-j\([0-9]*\),\1,g'`"
             if [ -z "$NumJobs" ]; then
@@ -113,6 +121,9 @@ while [ $# -gt 0 ]; do
         -no-compare-files | --no-compare-files )
             do_compare="no"
             ;;
+        -use-gzip | --use-gzip )
+            use_gzip="yes"
+            ;;
         -help | --help | -h | --h | -\? )
             usage
             exit 0
@@ -135,6 +146,10 @@ if [ -z "$RC" ]; then
     echo "error: no release candidate number specified"
     exit 1
 fi
+if [ -z "$Triple" ]; then
+    echo "error: no target triple specified"
+    exit 1
+fi
 
 # Figure out how many make processes to run.
 if [ -z "$NumJobs" ]; then
@@ -159,6 +174,13 @@ cd $BuildDir
 LogDir=$BuildDir/logs
 mkdir -p $LogDir
 
+# Final package name.
+Package=clang+llvm-$Release
+if [ $RC != "final" ]; then
+  Package=$Package-$RC
+fi
+Package=$Package-$Triple
+
 # Find compilers.
 if [ "$do_dragonegg" = "yes" ]; then
     gcc_compiler="$GCC"
@@ -189,9 +211,11 @@ function check_program_exists() {
   fi
 }
 
-check_program_exists 'chrpath'
-check_program_exists 'file'
-check_program_exists 'objdump'
+if [ `uname -s` != "Darwin" ]; then
+  check_program_exists 'chrpath'
+  check_program_exists 'file'
+  check_program_exists 'objdump'
+fi
 
 # Make sure that the URLs are valid.
 function check_valid_urls() {
@@ -199,7 +223,7 @@ function check_valid_urls() {
         echo "# Validating $proj SVN URL"
 
         if ! svn ls $Base_url/$proj/tags/RELEASE_$Release_no_dot/$RC > /dev/null 2>&1 ; then
-            echo "llvm $Release release candidate $RC doesn't exist!"
+            echo "$proj $Release release candidate $RC doesn't exist!"
             exit 1
         fi
     done
@@ -210,7 +234,7 @@ function export_sources() {
     check_valid_urls
 
     for proj in $projects ; do
-        echo "# Exporting $proj $Release-RC$RC sources"
+        echo "# Exporting $proj $Release-$RC sources"
         if ! svn export -q $Base_url/$proj/tags/RELEASE_$Release_no_dot/$RC $proj.src ; then
             echo "error: failed to export $proj project"
             exit 1
@@ -236,6 +260,9 @@ function export_sources() {
     if [ ! -h libcxx ]; then
         ln -s ../../libcxx.src libcxx
     fi
+    if [ ! -h libcxxabi ]; then
+        ln -s ../../libcxxabi.src libcxxabi
+    fi
     cd $BuildDir
 }
 
@@ -272,7 +299,8 @@ function configure_llvmCore() {
     echo "# Configuring llvm $Release-$RC $Flavor"
     echo "# $BuildDir/llvm.src/configure --prefix=$InstallDir \
         --enable-optimized=$Optimized \
-        --enable-assertions=$Assertions"
+        --enable-assertions=$Assertions \
+        --disable-timestamps"
     env CC="$c_compiler" CXX="$cxx_compiler" \
     $BuildDir/llvm.src/configure --prefix=$InstallDir \
         --enable-optimized=$Optimized \
@@ -343,6 +371,9 @@ function test_llvmCore() {
 # Clean RPATH. Libtool adds the build directory to the search path, which is
 # not necessary --- and even harmful --- for the binary packages we release.
 function clean_RPATH() {
+  if [ `uname -s` = "Darwin" ]; then
+    return
+  fi
   local InstallPath="$1"
   for Candidate in `find $InstallPath/{bin,lib} -type f`; do
     if file $Candidate | grep ELF | egrep 'executable|shared object' > /dev/null 2>&1 ; then
@@ -355,6 +386,20 @@ function clean_RPATH() {
   done
 }
 
+# Create a package of the release binaries.
+function package_release() {
+    cwd=`pwd`
+    cd $BuildDir/Phase3/Release
+    mv llvmCore-$Release-$RC.install $Package
+    if [ "$use_gzip" = "yes" ]; then
+      tar cfz $BuildDir/$Package.tar.gz $Package
+    else
+      tar cfJ $BuildDir/$Package.tar.xz $Package
+    fi
+    mv $Package llvmCore-$Release-$RC.install
+    cd $cwd
+}
+
 set -e                          # Exit if any command fails
 
 if [ "$do_checkout" = "yes" ]; then
@@ -550,9 +595,16 @@ for Flavor in $Flavors ; do
 done
 ) 2>&1 | tee $LogDir/testing.$Release-$RC.log
 
+package_release
+
 set +e
 
 # Woo hoo!
 echo "### Testing Finished ###"
+if [ "$use_gzip" = "yes" ]; then
+  echo "### Package: $Package.tar.gz"
+else
+  echo "### Package: $Package.tar.xz"
+fi
 echo "### Logs: $LogDir"
 exit 0