]> granicus.if.org Git - llvm/commitdiff
test-release.sh: Add option to use ninja
authorDiana Picus <diana.picus@linaro.org>
Mon, 11 Feb 2019 10:30:22 +0000 (10:30 +0000)
committerDiana Picus <diana.picus@linaro.org>
Mon, 11 Feb 2019 10:30:22 +0000 (10:30 +0000)
Allow the use of ninja instead of make. This is useful on some
platforms where we'd like to be able to limit the number of link jobs
without slowing down the other steps of the release.

This patch adds a -use-ninja command line option, which sets the
generator to Ninja both for LLVM and the test-suite. It also deals with
some differences between make and ninja:
* DESTDIR handling - ninja doesn't like this to be listed after the
  target, but both make and ninja can handle it before the command
* Verbose mode - ninja uses -v, make uses VERBOSE=1
* Keep going mode - make has a -k mode, which builds as much as possible
  even when failures are encountered; for ninja we need to set a hard
  limit (we use 100 since most people won't look at 100 failures anyway)

I haven't tested with gmake.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353685 91177308-0d34-0410-b5e6-96231b3b80d8

utils/release/test-release.sh

index 7457f60c9a9b3798a06f317be9c4633b9a79cb1b..558e01d2eabc84ae2394efffa43d0e96968352b4 100755 (executable)
@@ -17,6 +17,7 @@ if [ "$System" = "FreeBSD" ]; then
 else
     MAKE=make
 fi
+generator="Unix Makefiles"
 
 # Base SVN URL for the sources.
 Base_url="http://llvm.org/svn/llvm-project"
@@ -57,6 +58,7 @@ function usage() {
     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."
+    echo " -use-ninja           Use ninja instead of make/gmake."
     echo " -configure-flags FLAGS  Extra flags to pass to the configure step."
     echo " -svn-path DIR        Use the specified DIR instead of a release."
     echo "                      For example -svn-path trunk or -svn-path branches/release_37"
@@ -111,6 +113,10 @@ while [ $# -gt 0 ]; do
                 NumJobs="$1"
             fi
             ;;
+        -use-ninja )
+            MAKE=ninja
+            generator=Ninja
+            ;;
         -build-dir | --build-dir | -builddir | --builddir )
             shift
             BuildDir="$1"
@@ -277,6 +283,8 @@ if [ "$System" != "Darwin" ]; then
   check_program_exists 'objdump'
 fi
 
+check_program_exists ${MAKE}
+
 # Make sure that the URLs are valid.
 function check_valid_urls() {
     for proj in $projects ; do
@@ -365,12 +373,12 @@ function configure_llvmCore() {
     echo "# Configuring llvm $Release-$RC $Flavor"
 
     echo "#" env CC="$c_compiler" CXX="$cxx_compiler" \
-        cmake -G "Unix Makefiles" \
+        cmake -G "$generator" \
         -DCMAKE_BUILD_TYPE=$BuildType -DLLVM_ENABLE_ASSERTIONS=$Assertions \
         $ExtraConfigureFlags $BuildDir/llvm.src \
         2>&1 | tee $LogDir/llvm.configure-Phase$Phase-$Flavor.log
     env CC="$c_compiler" CXX="$cxx_compiler" \
-        cmake -G "Unix Makefiles" \
+        cmake -G "$generator" \
         -DCMAKE_BUILD_TYPE=$BuildType -DLLVM_ENABLE_ASSERTIONS=$Assertions \
         $ExtraConfigureFlags $BuildDir/llvm.src \
         2>&1 | tee $LogDir/llvm.configure-Phase$Phase-$Flavor.log
@@ -384,16 +392,20 @@ function build_llvmCore() {
     ObjDir="$3"
     DestDir="$4"
 
+    Verbose="VERBOSE=1"
+    if [ ${MAKE} = 'ninja' ]; then
+      Verbose="-v"
+    fi
+
     cd $ObjDir
     echo "# Compiling llvm $Release-$RC $Flavor"
-    echo "# ${MAKE} -j $NumJobs VERBOSE=1"
-    ${MAKE} -j $NumJobs VERBOSE=1 \
+    echo "# ${MAKE} -j $NumJobs $Verbose"
+    ${MAKE} -j $NumJobs $Verbose \
         2>&1 | tee $LogDir/llvm.make-Phase$Phase-$Flavor.log
 
     echo "# Installing llvm $Release-$RC $Flavor"
     echo "# ${MAKE} install"
-    ${MAKE} install \
-        DESTDIR="${DestDir}" \
+    DESTDIR="${DestDir}" ${MAKE} install \
         2>&1 | tee $LogDir/llvm.install-Phase$Phase-$Flavor.log
     cd $BuildDir
 }
@@ -403,8 +415,15 @@ function test_llvmCore() {
     Flavor="$2"
     ObjDir="$3"
 
+    KeepGoing="-k"
+    if [ ${MAKE} = 'ninja' ]; then
+      # Ninja doesn't have a documented "keep-going-forever" mode, we need to
+      # set a limit on how many jobs can fail before we give up.
+      KeepGoing="-k 100"
+    fi
+
     cd $ObjDir
-    if ! ( ${MAKE} -j $NumJobs -k check-all \
+    if ! ( ${MAKE} -j $NumJobs $KeepGoing check-all \
         2>&1 | tee $LogDir/llvm.check-Phase$Phase-$Flavor.log ) ; then
       deferred_error $Phase $Flavor "check-all failed"
     fi
@@ -412,8 +431,9 @@ function test_llvmCore() {
     if [ $do_test_suite = 'yes' ]; then
       cd $TestSuiteBuildDir
       env CC="$c_compiler" CXX="$cxx_compiler" \
-          cmake $TestSuiteSrcDir -DTEST_SUITE_LIT=$Lit
-      if ! ( ${MAKE} -j $NumJobs -k check \
+          cmake $TestSuiteSrcDir -G "$generator" -DTEST_SUITE_LIT=$Lit
+
+      if ! ( ${MAKE} -j $NumJobs $KeepGoing check \
           2>&1 | tee $LogDir/llvm.check-Phase$Phase-$Flavor.log ) ; then
         deferred_error $Phase $Flavor "test suite failed"
       fi