Bump version to 19.1.0 (final)
[llvm-project.git] / libcxx / utils / ci / run-buildbot
blobf1c20b9d721904b511c7ed0cd560a824bd620118
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 EOF
50 if [[ $# == 0 ]]; then
51 usage
52 exit 0
55 while [[ $# -gt 0 ]]; do
56 case ${1} in
57 -h|--help)
58 usage
59 exit 0
61 --llvm-root)
62 MONOREPO_ROOT="${2}"
63 shift; shift
65 --build-dir)
66 BUILD_DIR="${2}"
67 shift; shift
69 --osx-roots)
70 OSX_ROOTS="${2}"
71 shift; shift
74 BUILDER="${1}"
75 shift
77 esac
78 done
80 MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
81 BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build/${BUILDER}}"
82 INSTALL_DIR="${BUILD_DIR}/install"
84 # If we can find Ninja/CMake provided by Xcode, use those since we know their
85 # version will generally work with the Clang shipped in Xcode (e.g. if Clang
86 # knows about -std=c++20, the CMake bundled in Xcode will probably know about
87 # that flag too).
88 if xcrun --find ninja &>/dev/null; then
89 NINJA="$(xcrun --find ninja)"
90 elif which ninja &>/dev/null; then
91 # The current implementation of modules needs the absolute path to the ninja
92 # binary.
93 # TODO MODULES Is this still needed when CMake has libc++ module support?
94 NINJA="$(which ninja)"
95 else
96 NINJA="ninja"
99 if [ -z "${CMAKE}" ]; then
100 if xcrun --find cmake &>/dev/null; then
101 CMAKE="$(xcrun --find cmake)"
102 else
103 CMAKE="cmake"
107 function clean() {
108 rm -rf "${BUILD_DIR}"
111 function generate-cmake-base() {
112 echo "--- Generating CMake"
113 ${CMAKE} \
114 -S "${MONOREPO_ROOT}/runtimes" \
115 -B "${BUILD_DIR}" \
116 -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
117 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
118 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
119 -DLIBCXX_ENABLE_WERROR=YES \
120 -DLIBCXXABI_ENABLE_WERROR=YES \
121 -DLIBUNWIND_ENABLE_WERROR=YES \
122 -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
123 "${@}"
126 function generate-cmake() {
127 generate-cmake-base \
128 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
129 -DLIBCXX_CXX_ABI=libcxxabi \
130 "${@}"
133 function generate-cmake-libcxx-win() {
134 generate-cmake-base \
135 -DLLVM_ENABLE_RUNTIMES="libcxx" \
136 -DCMAKE_C_COMPILER=clang-cl \
137 -DCMAKE_CXX_COMPILER=clang-cl \
138 "${@}"
141 function generate-cmake-android() {
142 generate-cmake-base \
143 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
144 -DLIBCXX_CXX_ABI=libcxxabi \
145 "${@}"
148 function check-runtimes() {
149 echo "+++ Running the libc++ tests"
150 ${NINJA} -vC "${BUILD_DIR}" check-cxx
152 echo "+++ Running the libc++abi tests"
153 ${NINJA} -vC "${BUILD_DIR}" check-cxxabi
155 echo "+++ Running the libunwind tests"
156 ${NINJA} -vC "${BUILD_DIR}" check-unwind
158 # TODO: On macOS 13.5, the linker seems to have an issue where it will pick up
159 # a library if it exists inside a -L search path, even if we don't link
160 # against that library. This happens with libunwind.dylib if it is built
161 # at the point when we run the libc++ tests, which causes issues cause we
162 # are also linking against the system unwinder.
164 # I believe this is a linker regression and I reported it as rdar://115842730.
165 # It should be possible to move this installation step back to the top once
166 # that issue has been resolved, but in the meantime it doesn't really hurt to
167 # have it here.
168 echo "--- Installing libc++, libc++abi and libunwind to a fake location"
169 ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi install-unwind
172 # TODO: The goal is to test this against all configurations. We should also move
173 # this to the Lit test suite instead of being a separate CMake target.
174 function check-abi-list() {
175 echo "+++ Running the libc++ ABI list test"
176 ${NINJA} -vC "${BUILD_DIR}" check-cxx-abilist || (
177 echo "+++ Generating the libc++ ABI list after failed check"
178 ${NINJA} -vC "${BUILD_DIR}" generate-cxx-abilist
179 false
183 function check-cxx-benchmarks() {
184 echo "--- Running the benchmarks"
185 ${NINJA} -vC "${BUILD_DIR}" check-cxx-benchmarks
188 function test-armv7m-picolibc() {
189 clean
191 # To make it easier to get this builder up and running, build picolibc
192 # from scratch. Anecdotally, the build-picolibc script takes about 16 seconds.
193 # This could be optimised by building picolibc into the Docker container.
194 ${MONOREPO_ROOT}/libcxx/utils/ci/build-picolibc.sh \
195 --build-dir "${BUILD_DIR}" \
196 --install-dir "${INSTALL_DIR}" \
197 --target armv7m-none-eabi
199 echo "--- Generating CMake"
200 flags="--sysroot=${INSTALL_DIR}"
201 ${CMAKE} \
202 -S "${MONOREPO_ROOT}/compiler-rt" \
203 -B "${BUILD_DIR}/compiler-rt" \
204 -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
205 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
206 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
207 -DCMAKE_C_FLAGS="${flags}" \
208 -DCMAKE_CXX_FLAGS="${flags}" \
209 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \
210 "${@}"
211 generate-cmake \
212 -DLIBCXX_TEST_CONFIG="armv7m-picolibc-libc++.cfg.in" \
213 -DLIBCXXABI_TEST_CONFIG="armv7m-picolibc-libc++abi.cfg.in" \
214 -DLIBUNWIND_TEST_CONFIG="armv7m-picolibc-libunwind.cfg.in" \
215 -DCMAKE_C_FLAGS="${flags}" \
216 -DCMAKE_CXX_FLAGS="${flags}" \
217 "${@}"
219 ${NINJA} -vC "${BUILD_DIR}/compiler-rt" install
221 # Prior to clang 19, armv7m-none-eabi normalised to armv7m-none-unknown-eabi.
222 # clang 19 changed this to armv7m-unknown-none-eabi. So for as long as 18.x
223 # is supported, we have to ask clang what the triple will be.
224 NORMALISED_TARGET_TRIPLE=$(${CC-cc} --target=armv7m-none-eabi -print-target-triple)
225 # Without this step linking fails later in the build.
226 mv "${BUILD_DIR}/install/lib/${NORMALISED_TARGET_TRIPLE}"/* "${BUILD_DIR}/install/lib"
228 check-runtimes
231 # Print the version of a few tools to aid diagnostics in some cases
232 ${CMAKE} --version
233 ${NINJA} --version
235 if [ ! -z "${CXX}" ]; then ${CXX} --version; fi
237 case "${BUILDER}" in
238 check-generated-output)
239 # `! foo` doesn't work properly with `set -e`, use `! foo || false` instead.
240 # https://stackoverflow.com/questions/57681955/set-e-does-not-respect-logical-not
241 clean
242 generate-cmake
244 set +x # Printing all the commands below just creates extremely confusing output
246 # Reject patches that forgot to re-run the generator scripts.
247 echo "+++ Making sure the generator scripts were run"
248 ${NINJA} -vC "${BUILD_DIR}" libcxx-generate-files
249 git diff | tee ${BUILD_DIR}/generated_output.patch
250 git ls-files -o --exclude-standard | tee ${BUILD_DIR}/generated_output.status
251 ! grep -q '^--- a' ${BUILD_DIR}/generated_output.patch || false
252 if [ -s ${BUILD_DIR}/generated_output.status ]; then
253 echo "It looks like not all the generator scripts were run,"
254 echo "did you forget to build the libcxx-generate-files target?"
255 echo "Did you add all new files it generated?"
256 false
259 # Reject patches that introduce non-ASCII characters or hard tabs.
260 # Depends on LC_COLLATE set at the top of this script.
261 set -x
262 ! grep -rn '[^ -~]' libcxx/include libcxx/src libcxx/test libcxx/benchmarks \
263 --exclude '*.dat' \
264 --exclude '*unicode*.cpp' \
265 --exclude '*print*.sh.cpp' \
266 --exclude 'escaped_output.*.pass.cpp' \
267 --exclude 'format_tests.h' \
268 --exclude 'format.functions.tests.h' \
269 --exclude 'formatter.*.pass.cpp' \
270 --exclude 'grep.pass.cpp' \
271 --exclude 'locale-specific_form.pass.cpp' \
272 --exclude 'ostream.pass.cpp' \
273 --exclude 'transcoding.pass.cpp' \
274 --exclude 'underflow.pass.cpp' \
275 || false
278 # Various Standard modes
280 generic-cxx03)
281 clean
282 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake"
283 check-runtimes
284 check-abi-list
286 generic-cxx11)
287 clean
288 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake"
289 check-runtimes
290 check-abi-list
292 generic-cxx14)
293 clean
294 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx14.cmake"
295 check-runtimes
296 check-abi-list
298 generic-cxx17)
299 clean
300 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx17.cmake"
301 check-runtimes
302 check-abi-list
304 generic-cxx20)
305 clean
306 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx20.cmake"
307 check-runtimes
308 check-abi-list
310 generic-cxx23)
311 clean
312 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx23.cmake"
313 check-runtimes
314 check-abi-list
316 generic-cxx26)
317 clean
318 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx26.cmake"
319 check-runtimes
320 check-abi-list
323 # Other compiler support
325 generic-gcc)
326 clean
327 generate-cmake -DLIBCXX_ENABLE_WERROR=NO \
328 -DLIBCXXABI_ENABLE_WERROR=NO \
329 -DLIBUNWIND_ENABLE_WERROR=NO
330 check-runtimes
332 generic-gcc-cxx11)
333 clean
334 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake" \
335 -DLIBCXX_ENABLE_WERROR=NO \
336 -DLIBCXXABI_ENABLE_WERROR=NO \
337 -DLIBUNWIND_ENABLE_WERROR=NO
338 check-runtimes
341 # Sanitizers
343 generic-asan)
344 clean
345 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-asan.cmake"
346 check-runtimes
348 generic-msan)
349 clean
350 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-msan.cmake"
351 check-runtimes
353 generic-tsan)
354 clean
355 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-tsan.cmake"
356 check-runtimes
358 generic-ubsan)
359 clean
360 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-ubsan.cmake"
361 check-runtimes
364 # Various build configurations
366 bootstrapping-build)
367 clean
369 echo "--- Generating CMake"
370 ${CMAKE} \
371 -S "${MONOREPO_ROOT}/llvm" \
372 -B "${BUILD_DIR}" \
373 -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
374 -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
375 -DCMAKE_BUILD_TYPE=Release \
376 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
377 -DLLVM_ENABLE_PROJECTS="clang;lldb" \
378 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
379 -DLLVM_RUNTIME_TARGETS="$(${CXX} --print-target-triple)" \
380 -DLLVM_HOST_TRIPLE="$(${CXX} --print-target-triple)" \
381 -DLLVM_TARGETS_TO_BUILD="host" \
382 -DRUNTIMES_BUILD_ALLOW_DARWIN=ON \
383 -DLLVM_ENABLE_ASSERTIONS=ON \
384 -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests"
386 echo "+++ Running the LLDB libc++ data formatter tests"
387 ${NINJA} -vC "${BUILD_DIR}" check-lldb-api-functionalities-data-formatter-data-formatter-stl-libcxx
389 echo "--- Running the libc++ and libc++abi tests"
390 ${NINJA} -vC "${BUILD_DIR}" check-runtimes
392 echo "+++ Installing libc++ and libc++abi to a fake location"
393 ${NINJA} -vC "${BUILD_DIR}" install-runtimes
395 ccache -s
397 generic-static)
398 clean
399 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-static.cmake"
400 check-runtimes
402 generic-merged)
403 clean
404 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-merged.cmake" \
405 -DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
406 -DLIBCXXABI_TEST_CONFIG="llvm-libc++abi-merged.cfg.in" \
407 -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-merged.cfg.in"
408 check-runtimes
410 generic-hardening-mode-fast)
411 clean
412 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-fast.cmake"
413 check-runtimes
414 check-abi-list
416 generic-hardening-mode-fast-with-abi-breaks)
417 clean
418 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-fast-with-abi-breaks.cmake"
419 check-runtimes
420 check-abi-list
422 generic-hardening-mode-extensive)
423 clean
424 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake"
425 check-runtimes
426 check-abi-list
428 generic-hardening-mode-debug)
429 clean
430 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-debug.cmake"
431 check-runtimes
432 check-abi-list
435 # Module builds
437 generic-modules)
438 clean
439 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules.cmake"
440 check-runtimes
441 check-abi-list
443 generic-modules-lsv)
444 clean
445 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules-lsv.cmake"
446 check-runtimes
447 check-abi-list
450 # Parts removed
452 generic-no-threads)
453 clean
454 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-threads.cmake"
455 check-runtimes
457 generic-no-filesystem)
458 clean
459 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-filesystem.cmake"
460 check-runtimes
462 generic-no-random_device)
463 clean
464 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-random_device.cmake"
465 check-runtimes
467 generic-no-localization)
468 clean
469 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-localization.cmake"
470 check-runtimes
472 generic-no-unicode)
473 clean
474 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-unicode.cmake"
475 check-runtimes
477 generic-no-wide-characters)
478 clean
479 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-wide-characters.cmake"
480 check-runtimes
482 generic-no-tzdb)
483 clean
484 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-tzdb.cmake"
485 check-runtimes
487 generic-no-experimental)
488 clean
489 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-experimental.cmake"
490 check-runtimes
491 check-abi-list
493 generic-no-exceptions)
494 clean
495 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-exceptions.cmake"
496 check-runtimes
497 check-abi-list
499 generic-no-rtti)
500 clean
501 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-rtti.cmake"
502 check-runtimes
505 # Other miscellaneous jobs
507 generic-abi-unstable)
508 clean
509 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-abi-unstable.cmake"
510 check-runtimes
512 generic-optimized-speed)
513 clean
514 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-optimized-speed.cmake"
515 check-runtimes
517 apple-configuration)
518 clean
520 arch="$(uname -m)"
521 xcrun --sdk macosx \
522 ${MONOREPO_ROOT}/libcxx/utils/ci/apple-install-libcxx.sh \
523 --llvm-root ${MONOREPO_ROOT} \
524 --build-dir ${BUILD_DIR} \
525 --install-dir ${INSTALL_DIR} \
526 --symbols-dir "${BUILD_DIR}/symbols" \
527 --architectures "${arch}" \
528 --version "999.99"
530 # TODO: It would be better to run the tests against the fake-installed version of libc++ instead
531 xcrun --sdk macosx ninja -vC "${BUILD_DIR}/${arch}" check-cxx check-cxxabi check-cxx-abilist
533 apple-system-backdeployment-hardened-*)
534 clean
536 if [[ "${OSX_ROOTS}" == "" ]]; then
537 echo "--- Downloading previous macOS dylibs"
538 PREVIOUS_DYLIBS_URL="https://dl.dropboxusercontent.com/s/gmcfxwgl9f9n6pu/libcxx-roots.tar.gz"
539 OSX_ROOTS="${BUILD_DIR}/macos-roots"
540 mkdir -p "${OSX_ROOTS}"
541 curl "${PREVIOUS_DYLIBS_URL}" | tar -xz --strip-components=1 -C "${OSX_ROOTS}"
544 DEPLOYMENT_TARGET="${BUILDER#apple-system-backdeployment-hardened-}"
546 # TODO: On Apple platforms, we never produce libc++abi.1.dylib or libunwind.1.dylib,
547 # only libc++abi.dylib and libunwind.dylib. Fix that in the build so that the
548 # tests stop searching for @rpath/libc++abi.1.dylib and @rpath/libunwind.1.dylib.
549 cp "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.dylib" \
550 "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.1.dylib"
551 cp "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.dylib" \
552 "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.1.dylib"
554 arch="$(uname -m)"
555 PARAMS="target_triple=${arch}-apple-macosx${DEPLOYMENT_TARGET}"
556 PARAMS+=";cxx_runtime_root=${OSX_ROOTS}/macOS/libc++/${DEPLOYMENT_TARGET}"
557 PARAMS+=";abi_runtime_root=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}"
558 PARAMS+=";unwind_runtime_root=${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}"
559 PARAMS+=";hardening_mode=fast"
561 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
562 -DLIBCXX_TEST_CONFIG="apple-libc++-backdeployment.cfg.in" \
563 -DLIBCXXABI_TEST_CONFIG="apple-libc++abi-backdeployment.cfg.in" \
564 -DLIBUNWIND_TEST_CONFIG="apple-libunwind-backdeployment.cfg.in" \
565 -DLIBCXX_TEST_PARAMS="${PARAMS}" \
566 -DLIBCXXABI_TEST_PARAMS="${PARAMS}" \
567 -DLIBUNWIND_TEST_PARAMS="${PARAMS}"
569 check-runtimes
571 apple-system-backdeployment-*)
572 clean
574 if [[ "${OSX_ROOTS}" == "" ]]; then
575 echo "--- Downloading previous macOS dylibs"
576 PREVIOUS_DYLIBS_URL="https://dl.dropboxusercontent.com/s/gmcfxwgl9f9n6pu/libcxx-roots.tar.gz"
577 OSX_ROOTS="${BUILD_DIR}/macos-roots"
578 mkdir -p "${OSX_ROOTS}"
579 curl "${PREVIOUS_DYLIBS_URL}" | tar -xz --strip-components=1 -C "${OSX_ROOTS}"
582 DEPLOYMENT_TARGET="${BUILDER#apple-system-backdeployment-}"
584 # TODO: On Apple platforms, we never produce libc++abi.1.dylib or libunwind.1.dylib,
585 # only libc++abi.dylib and libunwind.dylib. Fix that in the build so that the
586 # tests stop searching for @rpath/libc++abi.1.dylib and @rpath/libunwind.1.dylib.
587 cp "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.dylib" \
588 "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.1.dylib"
589 cp "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.dylib" \
590 "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.1.dylib"
592 arch="$(uname -m)"
593 PARAMS="target_triple=${arch}-apple-macosx${DEPLOYMENT_TARGET}"
594 PARAMS+=";cxx_runtime_root=${OSX_ROOTS}/macOS/libc++/${DEPLOYMENT_TARGET}"
595 PARAMS+=";abi_runtime_root=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}"
596 PARAMS+=";unwind_runtime_root=${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}"
598 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
599 -DLIBCXX_TEST_CONFIG="apple-libc++-backdeployment.cfg.in" \
600 -DLIBCXXABI_TEST_CONFIG="apple-libc++abi-backdeployment.cfg.in" \
601 -DLIBUNWIND_TEST_CONFIG="apple-libunwind-backdeployment.cfg.in" \
602 -DLIBCXX_TEST_PARAMS="${PARAMS}" \
603 -DLIBCXXABI_TEST_PARAMS="${PARAMS}" \
604 -DLIBUNWIND_TEST_PARAMS="${PARAMS}"
606 check-runtimes
608 benchmarks)
609 clean
610 generate-cmake
611 check-cxx-benchmarks
613 aarch64)
614 clean
615 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake"
616 check-runtimes
618 aarch64-no-exceptions)
619 clean
620 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake" \
621 -DLIBCXX_ENABLE_EXCEPTIONS=OFF \
622 -DLIBCXXABI_ENABLE_EXCEPTIONS=OFF
623 check-runtimes
625 # Aka Armv8 32 bit
626 armv8)
627 clean
628 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Arm.cmake"
629 check-runtimes
631 armv8-no-exceptions)
632 clean
633 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Thumb-no-exceptions.cmake"
634 check-runtimes
636 # Armv7 32 bit. One building Arm only one Thumb only code.
637 armv7)
638 clean
639 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Arm.cmake"
640 check-runtimes
642 armv7-no-exceptions)
643 clean
644 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Thumb-no-exceptions.cmake"
645 check-runtimes
647 armv7m-picolibc)
648 test-armv7m-picolibc \
649 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7M-picolibc.cmake"
651 armv7m-picolibc-no-exceptions)
652 test-armv7m-picolibc \
653 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7M-picolibc.cmake" \
654 -DLIBCXXABI_ENABLE_EXCEPTIONS=OFF \
655 -DLIBCXXABI_ENABLE_STATIC_UNWINDER=OFF \
656 -DLIBCXX_ENABLE_EXCEPTIONS=OFF \
657 -DLIBCXX_ENABLE_RTTI=OFF
659 clang-cl-dll)
660 clean
661 # TODO: Currently, building with the experimental library breaks running
662 # tests (the test linking look for the c++experimental library with the
663 # wrong name, and the statically linked c++experimental can't be linked
664 # correctly when libc++ visibility attributes indicate dllimport linkage
665 # anyway), thus just disable the experimental library. Remove this
666 # setting when cmake and the test driver does the right thing automatically.
667 generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS="enable_experimental=False"
668 echo "+++ Running the libc++ tests"
669 ${NINJA} -vC "${BUILD_DIR}" check-cxx
671 clang-cl-static)
672 clean
673 generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF
674 echo "+++ Running the libc++ tests"
675 ${NINJA} -vC "${BUILD_DIR}" check-cxx
677 clang-cl-no-vcruntime)
678 clean
679 # Building libc++ in the same way as in clang-cl-dll above, but running
680 # tests with -D_HAS_EXCEPTIONS=0, which users might set in certain
681 # translation units while using libc++, even if libc++ is built with
682 # exceptions enabled.
683 generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS="enable_experimental=False" \
684 -DLIBCXX_TEST_CONFIG="llvm-libc++-shared-no-vcruntime-clangcl.cfg.in"
685 echo "+++ Running the libc++ tests"
686 ${NINJA} -vC "${BUILD_DIR}" check-cxx
688 clang-cl-debug)
689 clean
690 generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS="enable_experimental=False" \
691 -DCMAKE_BUILD_TYPE=Debug
692 echo "+++ Running the libc++ tests"
693 ${NINJA} -vC "${BUILD_DIR}" check-cxx
695 clang-cl-static-crt)
696 clean
697 # Test linking a static libc++ with the static CRT ("MultiThreaded" denotes
698 # the static CRT, as opposed to "MultiThreadedDLL" which is the default).
699 generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF \
700 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
701 echo "+++ Running the libc++ tests"
702 ${NINJA} -vC "${BUILD_DIR}" check-cxx
704 mingw-dll)
705 clean
706 generate-cmake \
707 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
708 check-runtimes
710 mingw-static)
711 clean
712 generate-cmake \
713 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake" \
714 -DLIBCXX_ENABLE_SHARED=OFF \
715 -DLIBUNWIND_ENABLE_SHARED=OFF
716 check-runtimes
718 mingw-dll-i686)
719 clean
720 generate-cmake \
721 -DCMAKE_C_COMPILER=i686-w64-mingw32-clang \
722 -DCMAKE_CXX_COMPILER=i686-w64-mingw32-clang++ \
723 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
724 check-runtimes
726 aix)
727 clean
728 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AIX.cmake" \
729 -DLIBCXX_TEST_CONFIG="ibm-libc++-shared.cfg.in" \
730 -DLIBCXXABI_TEST_CONFIG="ibm-libc++abi-shared.cfg.in" \
731 -DLIBUNWIND_TEST_CONFIG="ibm-libunwind-shared.cfg.in"
732 check-abi-list
733 check-runtimes
735 android-ndk-*)
736 clean
738 ANDROID_EMU_IMG="${BUILDER#android-ndk-}"
739 . "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/emulator-functions.sh"
740 if ! validate_emu_img "${ANDROID_EMU_IMG}"; then
741 echo "error: android-ndk suffix must be a valid emulator image (${ANDROID_EMU_IMG})" >&2
742 exit 1
744 ARCH=$(arch_of_emu_img ${ANDROID_EMU_IMG})
746 # Use the Android compiler by default.
747 export CC=${CC:-/opt/android/clang/clang-current/bin/clang}
748 export CXX=${CXX:-/opt/android/clang/clang-current/bin/clang++}
750 # The NDK libc++_shared.so is always built against the oldest supported API
751 # level. When tests are run against a device with a newer API level, test
752 # programs can be built for any supported API level, but building for the
753 # newest API (i.e. the system image's API) is probably the most interesting.
754 PARAMS="executor=${MONOREPO_ROOT}/libcxx/utils/adb_run.py;target_triple=$(triple_of_arch ${ARCH})$(api_of_emu_img ${ANDROID_EMU_IMG})"
755 generate-cmake-android -C "${MONOREPO_ROOT}/runtimes/cmake/android/Arch-${ARCH}.cmake" \
756 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AndroidNDK.cmake" \
757 -DCMAKE_SYSROOT=/opt/android/ndk/sysroot \
758 -DLIBCXX_TEST_PARAMS="${PARAMS}" \
759 -DLIBCXXABI_TEST_PARAMS="${PARAMS}"
760 check-abi-list
761 ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi
763 # Start the emulator and make sure we can connect to the adb server running
764 # inside of it.
765 "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/start-emulator.sh" ${ANDROID_EMU_IMG}
766 trap "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/stop-emulator.sh" EXIT
767 . "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/setup-env-for-emulator.sh"
769 # Create adb_run early to avoid concurrent `mkdir -p` of common parent
770 # directories.
771 adb shell mkdir -p /data/local/tmp/adb_run
772 adb push "${BUILD_DIR}/lib/libc++_shared.so" /data/local/tmp/libc++/libc++_shared.so
773 echo "+++ Running the libc++ tests"
774 ${NINJA} -vC "${BUILD_DIR}" check-cxx
775 echo "+++ Running the libc++abi tests"
776 ${NINJA} -vC "${BUILD_DIR}" check-cxxabi
778 #################################################################
779 # Insert vendor-specific internal configurations below.
781 # This allows vendors to extend this file with their own internal
782 # configurations without running into merge conflicts with upstream.
783 #################################################################
785 #################################################################
787 echo "${BUILDER} is not a known configuration"
788 exit 1
790 esac