1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

test-release.sh: Add option to use ninja

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.

llvm-svn: 353685
This commit is contained in:
Diana Picus 2019-02-11 10:30:22 +00:00
parent 69a4eb7877
commit d56b474c16

View File

@ -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