3030
3131function at-exit {
3232 python3 " ${MONOREPO_ROOT} " /.ci/generate_test_report.py " :linux: Linux x64 Test Results" \
33- " linux-x64-test-results" " ${BUILD_DIR} " /test-results* .xml
33+ " linux-x64-test-results" " ${BUILD_DIR} " /* - test-results.xml
3434
3535 mkdir -p artifacts
3636 ccache --print-stats > artifacts/ccache_stats.txt
3737}
3838trap at-exit EXIT
3939
40+ # TODO: separate file for import into Windows script?
41+ function ninja-targets {
42+ # $1 is the ninja arguments to use
43+ # $2 is is an optional postfix to add to the target name when renaming result files.
44+ # $3 is the list of targets
45+ set +e
46+ err_code=0
47+ for target in $3 ; do
48+ ninja $1 ${target}
49+ new_err_code=$?
50+ if [[ $new_err_code -ne 0 ]]; then
51+ err_code=${new_err_code}
52+ fi
53+ mv " ${BUILD_DIR} /test-results.xml" " ${BUILD_DIR} /${target}${2} -test-results.xml"
54+ done
55+
56+ if [[ $err_code -ne 0 ]]; then
57+ exit $err_code
58+ fi
59+
60+ set -e
61+ }
62+
4063projects=" ${1} "
4164targets=" ${2} "
4265
66+ lit_args=" -v --xunit-xml-output ${BUILD_DIR} /test-results.xml --timeout=1200 --time-tests"
67+
4368echo " --- cmake"
4469pip install -q -r " ${MONOREPO_ROOT} " /mlir/python/requirements.txt
4570pip install -q -r " ${MONOREPO_ROOT} " /lldb/test/requirements.txt
@@ -51,16 +76,16 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
5176 -D LLVM_ENABLE_ASSERTIONS=ON \
5277 -D LLVM_BUILD_EXAMPLES=ON \
5378 -D COMPILER_RT_BUILD_LIBFUZZER=OFF \
54- -D LLVM_LIT_ARGS=" -v --xunit-xml-output ${BUILD_DIR} /test-results.xml --timeout=1200 --time-tests " \
79+ -D LLVM_LIT_ARGS=" ${lit_args} " \
5580 -D LLVM_ENABLE_LLD=ON \
5681 -D CMAKE_CXX_FLAGS=-gmlt \
5782 -D LLVM_CCACHE_BUILD=ON \
5883 -D MLIR_ENABLE_BINDINGS_PYTHON=ON \
5984 -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} "
6085
6186echo " --- ninja"
62- # Targets are not escaped as they are passed as separate arguments.
63- ninja -C " ${BUILD_DIR} " -k 0 ${ targets}
87+
88+ ninja-targets " -C " ${BUILD_DIR} " -k 0" " " " $ targets"
6489
6590runtimes=" ${3} "
6691runtime_targets=" ${4} "
@@ -91,11 +116,14 @@ if [[ "${runtimes}" != "" ]]; then
91116 -D CMAKE_BUILD_TYPE=RelWithDebInfo \
92117 -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} " \
93118 -D LIBCXX_TEST_PARAMS=" std=c++03" \
94- -D LIBCXXABI_TEST_PARAMS=" std=c++03"
119+ -D LIBCXXABI_TEST_PARAMS=" std=c++03" \
120+ -D LLVM_LIT_ARGS=" ${lit_args} "
95121
96122 echo " --- ninja runtimes C++03"
97123
98- ninja -vC " ${RUNTIMES_BUILD_DIR} " ${runtime_targets}
124+ # TODO: there's no way to tell a failure here apart from a failure of the same
125+ # test in the other build mode.
126+ ninja-targets " -vC " ${RUNTIMES_BUILD_DIR} " " " -cxx03" " ${runtime_targets} "
99127
100128 echo " --- cmake runtimes C++26"
101129
@@ -108,11 +136,12 @@ if [[ "${runtimes}" != "" ]]; then
108136 -D CMAKE_BUILD_TYPE=RelWithDebInfo \
109137 -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} " \
110138 -D LIBCXX_TEST_PARAMS=" std=c++26" \
111- -D LIBCXXABI_TEST_PARAMS=" std=c++26"
139+ -D LIBCXXABI_TEST_PARAMS=" std=c++26" \
140+ -D LLVM_LIT_ARGS=" ${lit_args} "
112141
113142 echo " --- ninja runtimes C++26"
114143
115- ninja -vC " ${RUNTIMES_BUILD_DIR} " ${runtime_targets}
144+ ninja-targets " -vC " ${RUNTIMES_BUILD_DIR} " " " -cxx26 " " ${runtime_targets} "
116145
117146 echo " --- cmake runtimes clang modules"
118147
@@ -125,9 +154,10 @@ if [[ "${runtimes}" != "" ]]; then
125154 -D CMAKE_BUILD_TYPE=RelWithDebInfo \
126155 -D CMAKE_INSTALL_PREFIX=" ${INSTALL_DIR} " \
127156 -D LIBCXX_TEST_PARAMS=" enable_modules=clang" \
128- -D LIBCXXABI_TEST_PARAMS=" enable_modules=clang"
157+ -D LIBCXXABI_TEST_PARAMS=" enable_modules=clang" \
158+ -D LLVM_LIT_ARGS=" ${lit_args} "
129159
130160 echo " --- ninja runtimes clang modules"
131-
132- ninja -vC " ${RUNTIMES_BUILD_DIR} " ${runtime_targets}
161+
162+ ninja-targets " -vC " ${RUNTIMES_BUILD_DIR} " " " -modules " " ${runtime_targets} "
133163fi
0 commit comments