Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / utils / ci / run-buildbot
blobebb255243ba9c155181afbe9a9c3cca0210f9c4a
1 #!/usr/bin/env bash
2 #===----------------------------------------------------------------------===##
4 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 # See https://llvm.org/LICENSE.txt for license information.
6 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 #===----------------------------------------------------------------------===##
10 set -ex
11 set -o pipefail
12 unset LANG
13 unset LC_ALL
14 unset LC_COLLATE
16 PROGNAME="$(basename "${0}")"
18 function usage() {
19 cat <<EOF
20 Usage:
21 ${PROGNAME} [options] <BUILDER>
23 [-h|--help] Display this help and exit.
25 --llvm-root <DIR> Path to the root of the LLVM monorepo. By default, we try
26 to figure it out based on the current working directory.
28 --build-dir <DIR> The directory to use for building the library. By default,
29 this is '<llvm-root>/build/<builder>'.
31 --osx-roots <DIR> Path to pre-downloaded macOS dylibs. By default, we download
32 them from Green Dragon. This is only relevant at all when
33 running back-deployment testing if one wants to override
34 the old dylibs we use to run the tests with different ones.
35 Environment variables
36 CC The C compiler to use, this value is used by CMake. This
37 variable is optional.
39 CXX The C++ compiler to use, this value is used by CMake. This
40 variable is optional.
42 CMAKE The CMake binary to use. This variable is optional.
44 CLANG_FORMAT The clang-format binary to use when generating the format
45 ignore list.
47 ENABLE_CLANG_TIDY Whether to compile and run clang-tidy checks. This variable
48 is optional.
50 ENABLE_STD_MODULES Whether to enable or disable building the C++23 std
51 modules. This variable is optional.
52 TODO MODULES remove when all supported compilers support
53 modules.
55 EOF
58 if [[ $# == 0 ]]; then
59 usage
60 exit 0
63 while [[ $# -gt 0 ]]; do
64 case ${1} in
65 -h|--help)
66 usage
67 exit 0
69 --llvm-root)
70 MONOREPO_ROOT="${2}"
71 shift; shift
73 --build-dir)
74 BUILD_DIR="${2}"
75 shift; shift
77 --osx-roots)
78 OSX_ROOTS="${2}"
79 shift; shift
82 BUILDER="${1}"
83 shift
85 esac
86 done
88 MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
89 BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build/${BUILDER}}"
90 INSTALL_DIR="${BUILD_DIR}/install"
92 # If we can find Ninja/CMake provided by Xcode, use those since we know their
93 # version will generally work with the Clang shipped in Xcode (e.g. if Clang
94 # knows about -std=c++20, the CMake bundled in Xcode will probably know about
95 # that flag too).
96 if xcrun --find ninja &>/dev/null; then
97 NINJA="$(xcrun --find ninja)"
98 elif which ninja &>/dev/null; then
99 # The current implementation of modules needs the absolute path to the ninja
100 # binary.
101 # TODO MODULES Is this still needed when CMake has libc++ module support?
102 NINJA="$(which ninja)"
103 else
104 NINJA="ninja"
107 if [ -z "${CMAKE}" ]; then
108 if xcrun --find cmake &>/dev/null; then
109 CMAKE="$(xcrun --find cmake)"
110 else
111 CMAKE="cmake"
115 function clean() {
116 rm -rf "${BUILD_DIR}"
119 if [ -z "${ENABLE_CLANG_TIDY}" ]; then
120 ENABLE_CLANG_TIDY=Off
123 if [ -n "${ENABLE_STD_MODULES}" ]; then
124 ENABLE_STD_MODULES="-DLIBCXX_ENABLE_STD_MODULES=${ENABLE_STD_MODULES}"
127 function generate-cmake-base() {
128 echo "--- Generating CMake"
129 ${CMAKE} \
130 -S "${MONOREPO_ROOT}/runtimes" \
131 -B "${BUILD_DIR}" \
132 -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
133 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
134 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
135 -DLIBCXX_ENABLE_WERROR=YES \
136 -DLIBCXXABI_ENABLE_WERROR=YES \
137 -DLIBUNWIND_ENABLE_WERROR=YES \
138 -DLIBCXX_ENABLE_CLANG_TIDY=${ENABLE_CLANG_TIDY} \
139 ${ENABLE_STD_MODULES} \
140 -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
141 "${@}"
144 function generate-cmake() {
145 generate-cmake-base \
146 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
147 -DLIBCXX_CXX_ABI=libcxxabi \
148 "${@}"
151 function generate-cmake-libcxx-win() {
152 generate-cmake-base \
153 -DLLVM_ENABLE_RUNTIMES="libcxx" \
154 -DCMAKE_C_COMPILER=clang-cl \
155 -DCMAKE_CXX_COMPILER=clang-cl \
156 "${@}"
159 function generate-cmake-android() {
160 generate-cmake-base \
161 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
162 -DLIBCXX_CXX_ABI=libcxxabi \
163 "${@}"
166 function check-runtimes() {
167 echo "+++ Running the libc++ tests"
168 ${NINJA} -vC "${BUILD_DIR}" check-cxx
170 echo "+++ Running the libc++abi tests"
171 ${NINJA} -vC "${BUILD_DIR}" check-cxxabi
173 echo "+++ Running the libunwind tests"
174 ${NINJA} -vC "${BUILD_DIR}" check-unwind
176 # TODO: On macOS 13.5, the linker seems to have an issue where it will pick up
177 # a library if it exists inside a -L search path, even if we don't link
178 # against that library. This happens with libunwind.dylib if it is built
179 # at the point when we run the libc++ tests, which causes issues cause we
180 # are also linking against the system unwinder.
182 # I believe this is a linker regression and I reported it as rdar://115842730.
183 # It should be possible to move this installation step back to the top once
184 # that issue has been resolved, but in the meantime it doesn't really hurt to
185 # have it here.
186 echo "--- Installing libc++, libc++abi and libunwind to a fake location"
187 ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi install-unwind
190 # TODO: The goal is to test this against all configurations. We should also move
191 # this to the Lit test suite instead of being a separate CMake target.
192 function check-abi-list() {
193 echo "+++ Running the libc++ ABI list test"
194 ${NINJA} -vC "${BUILD_DIR}" check-cxx-abilist || (
195 echo "+++ Generating the libc++ ABI list after failed check"
196 ${NINJA} -vC "${BUILD_DIR}" generate-cxx-abilist
197 false
201 function check-cxx-benchmarks() {
202 echo "--- Running the benchmarks"
203 ${NINJA} -vC "${BUILD_DIR}" check-cxx-benchmarks
206 # Print the version of a few tools to aid diagnostics in some cases
207 ${CMAKE} --version
208 ${NINJA} --version
210 if [ ! -z "${CXX}" ]; then ${CXX} --version; fi
212 case "${BUILDER}" in
213 check-generated-output)
214 # `! foo` doesn't work properly with `set -e`, use `! foo || false` instead.
215 # https://stackoverflow.com/questions/57681955/set-e-does-not-respect-logical-not
216 clean
217 generate-cmake
219 set +x # Printing all the commands below just creates extremely confusing output
221 # Reject patches that forgot to re-run the generator scripts.
222 echo "+++ Making sure the generator scripts were run"
223 ${NINJA} -vC "${BUILD_DIR}" libcxx-generate-files
224 git diff | tee ${BUILD_DIR}/generated_output.patch
225 git ls-files -o --exclude-standard | tee ${BUILD_DIR}/generated_output.status
226 ! grep -q '^--- a' ${BUILD_DIR}/generated_output.patch || false
227 if [ -s ${BUILD_DIR}/generated_output.status ]; then
228 echo "It looks like not all the generator scripts were run,"
229 echo "did you forget to build the libcxx-generate-files target?"
230 echo "Did you add all new files it generated?"
231 false
234 echo "+++ Making sure libcxx/utils/data/ignore_format.txt was updated appropriately"
235 cp ${MONOREPO_ROOT}/libcxx/utils/data/ignore_format.txt ${BUILD_DIR}/before.txt
236 ${MONOREPO_ROOT}/libcxx/utils/generate_ignore_format.sh
237 diff ${BUILD_DIR}/before.txt ${MONOREPO_ROOT}/libcxx/utils/data/ignore_format.txt | tee ${BUILD_DIR}/ignore_format.diff || true
238 if [ -s ${BUILD_DIR}/ignore_format.diff ]; then
239 echo "It looks like the list of not formatted files has changed."
240 echo "If a file is now properly formatted with clang-format, remove the file name from "
241 echo "libcxx/utils/data/ignore_format.txt. Otherwise you have to fix the"
242 echo "formatting of some of the changed files. The diff above represents the "
243 echo "changes that would be needed to ignore_format.txt to keep it representative "
244 echo "of which files are mis-formatted in the project."
245 false
248 # Reject patches that introduce non-ASCII characters or hard tabs.
249 # Depends on LC_COLLATE set at the top of this script.
250 set -x
251 ! grep -rn '[^ -~]' libcxx/include libcxx/src libcxx/test libcxx/benchmarks \
252 --exclude '*.dat' \
253 --exclude '*unicode*.cpp' \
254 --exclude '*print*.sh.cpp' \
255 --exclude 'escaped_output.*.pass.cpp' \
256 --exclude 'format_tests.h' \
257 --exclude 'format.functions.tests.h' \
258 --exclude 'formatter.*.pass.cpp' \
259 --exclude 'grep.pass.cpp' \
260 --exclude 'locale-specific_form.pass.cpp' \
261 --exclude 'ostream.pass.cpp' \
262 --exclude 'transcoding.pass.cpp' \
263 --exclude 'underflow.pass.cpp' \
264 || false
266 # Reject code with trailing whitespace
267 ! grep -rn '[[:blank:]]$' libcxx/include libcxx/src libcxx/test libcxx/benchmarks || false
270 # Various Standard modes
272 generic-cxx03)
273 clean
274 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake"
275 check-runtimes
276 check-abi-list
278 generic-cxx11)
279 clean
280 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake"
281 check-runtimes
282 check-abi-list
284 generic-cxx14)
285 clean
286 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx14.cmake"
287 check-runtimes
288 check-abi-list
290 generic-cxx17)
291 clean
292 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx17.cmake"
293 check-runtimes
294 check-abi-list
296 generic-cxx20)
297 clean
298 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx20.cmake"
299 check-runtimes
300 check-abi-list
302 generic-cxx23)
303 clean
304 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx23.cmake"
305 check-runtimes
306 check-abi-list
308 generic-cxx26)
309 clean
310 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx26.cmake"
311 check-runtimes
312 check-abi-list
315 # Other compiler support
317 generic-gcc)
318 clean
319 generate-cmake -DLIBCXX_ENABLE_WERROR=NO \
320 -DLIBCXXABI_ENABLE_WERROR=NO \
321 -DLIBUNWIND_ENABLE_WERROR=NO
322 check-runtimes
324 generic-gcc-cxx11)
325 clean
326 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake" \
327 -DLIBCXX_ENABLE_WERROR=NO \
328 -DLIBCXXABI_ENABLE_WERROR=NO \
329 -DLIBUNWIND_ENABLE_WERROR=NO
330 check-runtimes
333 # Sanitizers
335 generic-asan)
336 clean
337 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-asan.cmake"
338 check-runtimes
340 generic-msan)
341 clean
342 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-msan.cmake"
343 check-runtimes
345 generic-tsan)
346 clean
347 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-tsan.cmake"
348 check-runtimes
350 generic-ubsan)
351 clean
352 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-ubsan.cmake"
353 check-runtimes
356 # Various build configurations
358 bootstrapping-build)
359 clean
361 echo "--- Generating CMake"
362 ${CMAKE} \
363 -S "${MONOREPO_ROOT}/llvm" \
364 -B "${BUILD_DIR}" \
365 -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
366 -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
367 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
368 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
369 -DLLVM_ENABLE_PROJECTS="clang" \
370 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
371 -DLLVM_RUNTIME_TARGETS="$(${CXX} --print-target-triple)" \
372 -DLLVM_TARGETS_TO_BUILD="host" \
373 -DRUNTIMES_BUILD_ALLOW_DARWIN=ON \
374 -DLLVM_ENABLE_ASSERTIONS=ON \
375 -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests"
377 echo "+++ Running the libc++ and libc++abi tests"
378 ${NINJA} -vC "${BUILD_DIR}" check-runtimes
380 echo "--- Installing libc++ and libc++abi to a fake location"
381 ${NINJA} -vC "${BUILD_DIR}" install-runtimes
383 ccache -s
385 generic-static)
386 clean
387 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-static.cmake"
388 check-runtimes
390 generic-merged)
391 clean
392 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-merged.cmake" \
393 -DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
394 -DLIBCXXABI_TEST_CONFIG="llvm-libc++abi-merged.cfg.in" \
395 -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-merged.cfg.in"
396 check-runtimes
398 generic-hardened-mode)
399 clean
400 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardened-mode.cmake"
401 check-runtimes
402 check-abi-list
404 generic-safe-mode)
405 clean
406 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-safe-mode.cmake"
407 check-runtimes
408 check-abi-list
410 generic-debug-mode)
411 clean
412 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-debug-mode.cmake"
413 check-runtimes
414 check-abi-list
416 generic-with_llvm_unwinder)
417 clean
418 generate-cmake -DLIBCXXABI_USE_LLVM_UNWINDER=ON
419 check-runtimes
422 # Module builds
424 generic-modules)
425 clean
426 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules.cmake"
427 check-runtimes
428 check-abi-list
430 generic-modules-lsv)
431 clean
432 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules-lsv.cmake"
433 check-runtimes
434 check-abi-list
437 # Parts removed
439 generic-no-threads)
440 clean
441 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-threads.cmake"
442 check-runtimes
444 generic-no-filesystem)
445 clean
446 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-filesystem.cmake"
447 check-runtimes
449 generic-no-random_device)
450 clean
451 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-random_device.cmake"
452 check-runtimes
454 generic-no-localization)
455 clean
456 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-localization.cmake"
457 check-runtimes
459 generic-no-unicode)
460 clean
461 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-unicode.cmake"
462 check-runtimes
464 generic-no-wide-characters)
465 clean
466 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-wide-characters.cmake"
467 check-runtimes
469 generic-no-tzdb)
470 clean
471 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-tzdb.cmake"
472 check-runtimes
474 generic-no-experimental)
475 clean
476 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-experimental.cmake"
477 check-runtimes
478 check-abi-list
480 generic-no-exceptions)
481 clean
482 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-exceptions.cmake"
483 check-runtimes
484 check-abi-list
487 # Other miscellaneous jobs
489 generic-abi-unstable)
490 clean
491 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-abi-unstable.cmake"
492 check-runtimes
494 apple-system)
495 clean
497 arch="$(uname -m)"
498 xcrun --sdk macosx \
499 ${MONOREPO_ROOT}/libcxx/utils/ci/apple-install-libcxx.sh \
500 --llvm-root ${MONOREPO_ROOT} \
501 --build-dir ${BUILD_DIR} \
502 --install-dir ${INSTALL_DIR} \
503 --symbols-dir "${BUILD_DIR}/symbols" \
504 --architectures "${arch}" \
505 --version "999.99"
507 # TODO: It would be better to run the tests against the fake-installed version of libc++ instead
508 xcrun --sdk macosx ninja -vC "${BUILD_DIR}/${arch}" check-cxx check-cxxabi check-cxx-abilist
510 apple-system-backdeployment-hardened-*)
511 clean
513 if [[ "${OSX_ROOTS}" == "" ]]; then
514 echo "--- Downloading previous macOS dylibs"
515 PREVIOUS_DYLIBS_URL="https://dl.dropboxusercontent.com/s/gmcfxwgl9f9n6pu/libcxx-roots.tar.gz"
516 OSX_ROOTS="${BUILD_DIR}/macos-roots"
517 mkdir -p "${OSX_ROOTS}"
518 curl "${PREVIOUS_DYLIBS_URL}" | tar -xz --strip-components=1 -C "${OSX_ROOTS}"
521 DEPLOYMENT_TARGET="${BUILDER#apple-system-backdeployment-hardened-}"
523 # TODO: On Apple platforms, we never produce libc++abi.1.dylib or libunwind.1.dylib,
524 # only libc++abi.dylib and libunwind.dylib. Fix that in the build so that the
525 # tests stop searching for @rpath/libc++abi.1.dylib and @rpath/libunwind.1.dylib.
526 cp "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.dylib" \
527 "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.1.dylib"
528 cp "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.dylib" \
529 "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.1.dylib"
531 arch="$(uname -m)"
532 PARAMS="target_triple=${arch}-apple-macosx${DEPLOYMENT_TARGET}"
533 PARAMS+=";cxx_runtime_root=${OSX_ROOTS}/macOS/libc++/${DEPLOYMENT_TARGET}"
534 PARAMS+=";abi_runtime_root=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}"
535 PARAMS+=";unwind_runtime_root=${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}"
536 PARAMS+=";hardening_mode=hardened"
538 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
539 -DLIBCXX_TEST_CONFIG="apple-libc++-backdeployment.cfg.in" \
540 -DLIBCXXABI_TEST_CONFIG="apple-libc++abi-backdeployment.cfg.in" \
541 -DLIBUNWIND_TEST_CONFIG="apple-libunwind-backdeployment.cfg.in" \
542 -DLIBCXX_TEST_PARAMS="${PARAMS}" \
543 -DLIBCXXABI_TEST_PARAMS="${PARAMS}" \
544 -DLIBUNWIND_TEST_PARAMS="${PARAMS}"
546 check-runtimes
548 apple-system-backdeployment-*)
549 clean
551 if [[ "${OSX_ROOTS}" == "" ]]; then
552 echo "--- Downloading previous macOS dylibs"
553 PREVIOUS_DYLIBS_URL="https://dl.dropboxusercontent.com/s/gmcfxwgl9f9n6pu/libcxx-roots.tar.gz"
554 OSX_ROOTS="${BUILD_DIR}/macos-roots"
555 mkdir -p "${OSX_ROOTS}"
556 curl "${PREVIOUS_DYLIBS_URL}" | tar -xz --strip-components=1 -C "${OSX_ROOTS}"
559 DEPLOYMENT_TARGET="${BUILDER#apple-system-backdeployment-}"
561 # TODO: On Apple platforms, we never produce libc++abi.1.dylib or libunwind.1.dylib,
562 # only libc++abi.dylib and libunwind.dylib. Fix that in the build so that the
563 # tests stop searching for @rpath/libc++abi.1.dylib and @rpath/libunwind.1.dylib.
564 cp "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.dylib" \
565 "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.1.dylib"
566 cp "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.dylib" \
567 "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.1.dylib"
569 arch="$(uname -m)"
570 PARAMS="target_triple=${arch}-apple-macosx${DEPLOYMENT_TARGET}"
571 PARAMS+=";cxx_runtime_root=${OSX_ROOTS}/macOS/libc++/${DEPLOYMENT_TARGET}"
572 PARAMS+=";abi_runtime_root=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}"
573 PARAMS+=";unwind_runtime_root=${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}"
575 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
576 -DLIBCXX_TEST_CONFIG="apple-libc++-backdeployment.cfg.in" \
577 -DLIBCXXABI_TEST_CONFIG="apple-libc++abi-backdeployment.cfg.in" \
578 -DLIBUNWIND_TEST_CONFIG="apple-libunwind-backdeployment.cfg.in" \
579 -DLIBCXX_TEST_PARAMS="${PARAMS}" \
580 -DLIBCXXABI_TEST_PARAMS="${PARAMS}" \
581 -DLIBUNWIND_TEST_PARAMS="${PARAMS}"
583 check-runtimes
585 benchmarks)
586 clean
587 generate-cmake
588 check-cxx-benchmarks
590 aarch64)
591 clean
592 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake"
593 check-runtimes
595 aarch64-no-exceptions)
596 clean
597 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake" \
598 -DLIBCXX_ENABLE_EXCEPTIONS=OFF \
599 -DLIBCXXABI_ENABLE_EXCEPTIONS=OFF
600 check-runtimes
602 # Aka Armv8 32 bit
603 armv8)
604 clean
605 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Arm.cmake"
606 check-runtimes
608 armv8-no-exceptions)
609 clean
610 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Thumb-no-exceptions.cmake"
611 check-runtimes
613 # Armv7 32 bit. One building Arm only one Thumb only code.
614 armv7)
615 clean
616 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Arm.cmake"
617 check-runtimes
619 armv7-no-exceptions)
620 clean
621 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Thumb-no-exceptions.cmake"
622 check-runtimes
624 clang-cl-dll)
625 clean
626 # TODO: Currently, building with the experimental library breaks running
627 # tests (the test linking look for the c++experimental library with the
628 # wrong name, and the statically linked c++experimental can't be linked
629 # correctly when libc++ visibility attributes indicate dllimport linkage
630 # anyway), thus just disable the experimental library. Remove this
631 # setting when cmake and the test driver does the right thing automatically.
632 generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS="enable_experimental=False"
633 echo "+++ Running the libc++ tests"
634 ${NINJA} -vC "${BUILD_DIR}" check-cxx
636 clang-cl-static)
637 clean
638 generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF
639 echo "+++ Running the libc++ tests"
640 ${NINJA} -vC "${BUILD_DIR}" check-cxx
642 clang-cl-no-vcruntime)
643 clean
644 # Building libc++ in the same way as in clang-cl-dll above, but running
645 # tests with -D_HAS_EXCEPTIONS=0, which users might set in certain
646 # translation units while using libc++, even if libc++ is built with
647 # exceptions enabled.
648 generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS="enable_experimental=False" \
649 -DLIBCXX_TEST_CONFIG="llvm-libc++-shared-no-vcruntime-clangcl.cfg.in"
650 echo "+++ Running the libc++ tests"
651 ${NINJA} -vC "${BUILD_DIR}" check-cxx
653 clang-cl-debug)
654 clean
655 generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS="enable_experimental=False" \
656 -DCMAKE_BUILD_TYPE=Debug
657 echo "+++ Running the libc++ tests"
658 ${NINJA} -vC "${BUILD_DIR}" check-cxx
660 clang-cl-static-crt)
661 clean
662 # Test linking a static libc++ with the static CRT ("MultiThreaded" denotes
663 # the static CRT, as opposed to "MultiThreadedDLL" which is the default).
664 generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF \
665 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
666 echo "+++ Running the libc++ tests"
667 ${NINJA} -vC "${BUILD_DIR}" check-cxx
669 mingw-dll)
670 clean
671 # Explicitly specify the compiler with a triple prefix. The CI
672 # environment has got two installations of Clang; the default one
673 # defaults to MSVC mode, while there's an installation of llvm-mingw
674 # further back in PATH. By calling the compiler with an explicit
675 # triple prefix, we use the one that is bundled with a mingw sysroot.
676 generate-cmake \
677 -DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \
678 -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++ \
679 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
680 check-runtimes
682 mingw-static)
683 clean
684 generate-cmake \
685 -DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \
686 -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++ \
687 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake" \
688 -DLIBCXX_ENABLE_SHARED=OFF \
689 -DLIBUNWIND_ENABLE_SHARED=OFF
690 check-runtimes
692 mingw-dll-i686)
693 clean
694 generate-cmake \
695 -DCMAKE_C_COMPILER=i686-w64-mingw32-clang \
696 -DCMAKE_CXX_COMPILER=i686-w64-mingw32-clang++ \
697 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
698 check-runtimes
700 aix)
701 clean
702 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AIX.cmake" \
703 -DLIBCXX_TEST_CONFIG="ibm-libc++-shared.cfg.in" \
704 -DLIBCXXABI_TEST_CONFIG="ibm-libc++abi-shared.cfg.in" \
705 -DLIBUNWIND_TEST_CONFIG="ibm-libunwind-shared.cfg.in"
706 check-abi-list
707 check-runtimes
709 android-ndk-*)
710 clean
712 ANDROID_EMU_IMG="${BUILDER#android-ndk-}"
713 . "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/emulator-functions.sh"
714 if ! validate_emu_img "${ANDROID_EMU_IMG}"; then
715 echo "error: android-ndk suffix must be a valid emulator image (${ANDROID_EMU_IMG})" >&2
716 exit 1
718 ARCH=$(arch_of_emu_img ${ANDROID_EMU_IMG})
720 # Use the Android compiler by default.
721 export CC=${CC:-/opt/android/clang/clang-current/bin/clang}
722 export CXX=${CXX:-/opt/android/clang/clang-current/bin/clang++}
724 # The NDK libc++_shared.so is always built against the oldest supported API
725 # level. When tests are run against a device with a newer API level, test
726 # programs can be built for any supported API level, but building for the
727 # newest API (i.e. the system image's API) is probably the most interesting.
728 PARAMS="target_triple=$(triple_of_arch ${ARCH})$(api_of_emu_img ${ANDROID_EMU_IMG})"
729 generate-cmake-android -C "${MONOREPO_ROOT}/runtimes/cmake/android/Arch-${ARCH}.cmake" \
730 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AndroidNDK.cmake" \
731 -DCMAKE_SYSROOT=/opt/android/ndk/sysroot \
732 -DLIBCXX_TEST_PARAMS="${PARAMS}" \
733 -DLIBCXXABI_TEST_PARAMS="${PARAMS}"
734 ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi
736 # Start the emulator and make sure we can connect to the adb server running
737 # inside of it.
738 "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/start-emulator.sh" ${ANDROID_EMU_IMG}
739 trap "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/stop-emulator.sh" EXIT
740 . "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/setup-env-for-emulator.sh"
742 # Create adb_run early to avoid concurrent `mkdir -p` of common parent
743 # directories.
744 adb shell mkdir -p /data/local/tmp/adb_run
745 adb push "${BUILD_DIR}/lib/libc++_shared.so" /data/local/tmp/libc++/libc++_shared.so
746 echo "+++ Running the libc++ tests"
747 ${NINJA} -vC "${BUILD_DIR}" check-cxx
748 echo "+++ Running the libc++abi tests"
749 ${NINJA} -vC "${BUILD_DIR}" check-cxxabi
751 #################################################################
752 # Insert vendor-specific internal configurations below.
754 # This allows vendors to extend this file with their own internal
755 # configurations without running into merge conflicts with upstream.
756 #################################################################
758 #################################################################
760 echo "${BUILDER} is not a known configuration"
761 exit 1
763 esac