Debian Codegraph @

libcxx/utils/ci/run-buildbot

raw symbols SCIP
1 #!/usr/bin/env bash
2 # ===----------------------------------------------------------------------===##
3 #
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
7 #
8 # ===----------------------------------------------------------------------===##
9
10 set -e
11 set -o pipefail
12 unset LANG
13 unset LC_ALL
14 unset LC_COLLATE
15
16 PROGNAME="$(basename "${0}")"
17
18 function usage() {
19 cat <<EOF
20 Usage:
21 ${PROGNAME} [options] <BUILDER>
22
23 [-h|--help] Display this help and exit.
24
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.
27
28 --build-dir <DIR> The directory to use for building the library. By default,
29 this is '<llvm-root>/build/<builder>'.
30
31 Environment variables
32 CC The C compiler to use, this value is used by CMake. This
33 variable is mandatory.
34
35 CXX The C++ compiler to use, this value is used by CMake. This
36 variable is mandatory.
37
38 CCACHE The ccache binary to use. This variable is optional and is only
39 used by the bootstrapping build.
40 EOF
41 }
42
43 function step() {
44 endstep
45 set +x
46 if [[ ! -z ${GITHUB_ACTIONS+x} ]]; then
47 echo "::group::$1"
48 export IN_GROUP=1
49 else
50 echo "--- $1"
51 fi
52 set -x
53 }
54
55 function endstep() {
56 set +x
57 if [[ ! -z ${GITHUB_ACTIONS+x} ]] && [[ ! -z ${IN_GROUP+x} ]]; then
58 echo "::endgroup::"
59 unset IN_GROUP
60 fi
61 set -x
62 }
63
64 function error() {
65 echo "::error::$1"
66 }
67
68 if [[ $# == 0 ]]; then
69 usage
70 exit 0
71 fi
72
73 while [[ $# -gt 0 ]]; do
74 case ${1} in
75 -h|--help)
76 usage
77 exit 0
78 ;;
79 --llvm-root)
80 MONOREPO_ROOT="${2}"
81 shift; shift
82 ;;
83 --build-dir)
84 BUILD_DIR="${2}"
85 shift; shift
86 ;;
87 *)
88 BUILDER="${1}"
89 shift
90 ;;
91 esac
92 done
93
94 MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
95 BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build/${BUILDER}}"
96 INSTALL_DIR="${BUILD_DIR}/install"
97
98 if [ -z ${CC+x} ]; then
99 error "Environment variable CC must be defined"
100 exit 1
101 fi
102
103 if [ -z ${CXX+x} ]; then
104 error "Environment variable CXX must be defined"
105 exit 1
106 fi
107
108 # Print the version of a few tools to aid diagnostics in some cases
109 step "Diagnose tools in use"
110 cmake --version
111 ninja --version
112 ${CC} --version
113 ${CXX} --version
114
115 function clean() {
116 rm -rf "${BUILD_DIR}"
117 }
118
119 function generate-cmake-base() {
120 step "Generating CMake"
121
122 # We can remove -DCMAKE_INSTALL_MESSAGE=NEVER once https://gitlab.kitware.com/cmake/cmake/-/issues/26085 is fixed.
123 cmake \
124 -S "${MONOREPO_ROOT}/runtimes" \
125 -B "${BUILD_DIR}" \
126 -GNinja \
127 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
128 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
129 -DLIBCXX_ENABLE_WERROR=YES \
130 -DLIBCXXABI_ENABLE_WERROR=YES \
131 -DLIBUNWIND_ENABLE_WERROR=YES \
132 -DCMAKE_INSTALL_MESSAGE=NEVER \
133 -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
134 "${@}"
135 }
136
137 function generate-cmake() {
138 generate-cmake-base \
139 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
140 -DLIBCXX_CXX_ABI=libcxxabi \
141 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
142 "${@}"
143 }
144
145 function generate-cmake-libcxx-win() {
146 generate-cmake-base -DLLVM_ENABLE_RUNTIMES="libcxx" "${@}"
147 }
148
149 function generate-cmake-android() {
150 generate-cmake-base \
151 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
152 -DLIBCXX_CXX_ABI=libcxxabi \
153 "${@}"
154 }
155
156 function check-runtimes() {
157 step "Building libc++ test dependencies"
158 ninja -vC "${BUILD_DIR}" cxx-test-depends
159
160 step "Running the libc++ tests"
161 ninja -vC "${BUILD_DIR}" check-cxx
162
163 step "Running the libc++abi tests"
164 ninja -vC "${BUILD_DIR}" check-cxxabi
165
166 step "Running the libunwind tests"
167 ninja -vC "${BUILD_DIR}" check-unwind
168 }
169
170 # TODO: The goal is to test this against all configurations. We should also move
171 # this to the Lit test suite instead of being a separate CMake target.
172 function check-abi-list() {
173 step "Running the libc++ ABI list test"
174 ninja -vC "${BUILD_DIR}" check-cxx-abilist || (
175 error "Generating the libc++ ABI list after failed check"
176 ninja -vC "${BUILD_DIR}" generate-cxx-abilist
177 false
178 )
179 }
180
181 function test-armv7m-picolibc() {
182 clean
183
184 # To make it easier to get this builder up and running, build picolibc
185 # from scratch. Anecdotally, the build-picolibc script takes about 16 seconds.
186 # This could be optimised by building picolibc into the Docker container.
187 step "Building picolibc from source"
188 ${MONOREPO_ROOT}/libcxx/utils/ci/build-picolibc.sh \
189 --build-dir "${BUILD_DIR}" \
190 --install-dir "${INSTALL_DIR}" \
191 --target armv7m-none-eabi
192
193 step "Generating CMake for compiler-rt"
194 flags="--sysroot=${INSTALL_DIR}"
195 # LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON means that we produce a file
196 # libclang_rt.builtins.a that will be installed to
197 # ${INSTALL_DIR}/lib/armv7m-unknown-none-eabi/.
198 # With LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF, the filename includes the
199 # architecture name, which is not what Clang's driver expects to find.
200 # The install location will however be wrong with
201 # LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON, so we correct that below.
202 cmake \
203 -S "${MONOREPO_ROOT}/compiler-rt" \
204 -B "${BUILD_DIR}/compiler-rt" \
205 -GNinja \
206 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
207 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
208 -DCMAKE_C_FLAGS="${flags}" \
209 -DCMAKE_CXX_FLAGS="${flags}" \
210 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \
211 "${@}"
212
213 step "Generating CMake for libc++"
214 generate-cmake \
215 -DLIBCXX_TEST_CONFIG="armv7m-picolibc-libc++.cfg.in" \
216 -DLIBCXXABI_TEST_CONFIG="armv7m-picolibc-libc++abi.cfg.in" \
217 -DLIBUNWIND_TEST_CONFIG="armv7m-picolibc-libunwind.cfg.in" \
218 -DCMAKE_C_FLAGS="${flags}" \
219 -DCMAKE_CXX_FLAGS="${flags}" \
220 -DRUNTIMES_USE_LIBC=picolibc \
221 "${@}"
222
223 step "Installing compiler-rt"
224 ninja -vC "${BUILD_DIR}/compiler-rt" install
225 # Move compiler-rt libs into the same directory as all the picolib objects.
226 mv "${INSTALL_DIR}/lib/armv7m-unknown-none-eabi"/* "${INSTALL_DIR}/lib"
227
228 check-runtimes
229 }
230
231 case "${BUILDER}" in
232 check-generated-output)
233 # `! foo` doesn't work properly with `set -e`, use `! foo || false` instead.
234 # https://stackoverflow.com/questions/57681955/set-e-does-not-respect-logical-not
235 clean
236 generate-cmake
237
238 # Reject patches that forgot to re-run the generator scripts.
239 step "Making sure the generator scripts were run"
240 set +x # Printing all the commands below just creates extremely confusing output
241 ninja -vC "${BUILD_DIR}" libcxx-generate-files
242 git diff | tee ${BUILD_DIR}/generated_output.patch
243 git ls-files -o --exclude-standard | tee ${BUILD_DIR}/generated_output.status
244 ! grep -q '^--- a' ${BUILD_DIR}/generated_output.patch || false
245 if [ -s ${BUILD_DIR}/generated_output.status ]; then
246 echo "It looks like not all the generator scripts were run,"
247 echo "did you forget to build the libcxx-generate-files target?"
248 echo "Did you add all new files it generated?"
249 false
250 fi
251
252 # This depends on LC_COLLATE set at the top of this script.
253 step "Reject patches that introduce non-ASCII characters or hard tabs."
254 ! grep -rn '[^ -~]' libcxx/include libcxx/src libcxx/test \
255 --exclude '*.dat' \
256 --exclude '*unicode*.cpp' \
257 --exclude '*print*.sh.cpp' \
258 --exclude 'escaped_output.*.pass.cpp' \
259 --exclude 'format_tests.h' \
260 --exclude 'format.functions.tests.h' \
261 --exclude 'formatter.*.pass.cpp' \
262 --exclude 'grep.pass.cpp' \
263 --exclude 'locale-specific_form.pass.cpp' \
264 --exclude 'ostream.pass.cpp' \
265 --exclude 'transcoding.pass.cpp' \
266 --exclude 'underflow.pass.cpp' \
267 || false
268 ;;
269 #
270 # Various Standard modes
271 #
272 frozen-cxx03-headers)
273 clean
274 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03-frozen.cmake"
275 check-runtimes
276 check-abi-list
277 ;;
278 generic-cxx03)
279 clean
280 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake"
281 check-runtimes
282 check-abi-list
283 ;;
284 generic-cxx11)
285 clean
286 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake"
287 check-runtimes
288 check-abi-list
289 ;;
290 generic-cxx14)
291 clean
292 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx14.cmake"
293 check-runtimes
294 check-abi-list
295 ;;
296 generic-cxx17)
297 clean
298 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx17.cmake"
299 check-runtimes
300 check-abi-list
301 ;;
302 generic-cxx20)
303 clean
304 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx20.cmake"
305 check-runtimes
306 check-abi-list
307 ;;
308 generic-cxx23)
309 clean
310 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx23.cmake"
311 check-runtimes
312 check-abi-list
313 ;;
314 generic-cxx26)
315 clean
316 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx26.cmake"
317 check-runtimes
318 check-abi-list
319 ;;
320 #
321 # Other compiler support
322 #
323 generic-gcc)
324 clean
325 generate-cmake -DLIBCXX_ENABLE_WERROR=NO \
326 -DLIBCXXABI_ENABLE_WERROR=NO \
327 -DLIBUNWIND_ENABLE_WERROR=NO
328 check-runtimes
329 ;;
330 generic-gcc-cxx11)
331 clean
332 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake" \
333 -DLIBCXX_ENABLE_WERROR=NO \
334 -DLIBCXXABI_ENABLE_WERROR=NO \
335 -DLIBUNWIND_ENABLE_WERROR=NO
336 check-runtimes
337 ;;
338 #
339 # Sanitizers
340 #
341 generic-asan)
342 clean
343 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-asan.cmake"
344 check-runtimes
345 ;;
346 generic-msan)
347 clean
348 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-msan.cmake"
349 check-runtimes
350 ;;
351 generic-tsan)
352 clean
353 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-tsan.cmake"
354 check-runtimes
355 ;;
356 generic-ubsan)
357 clean
358 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-ubsan.cmake"
359 check-runtimes
360 ;;
361 #
362 # Various build configurations
363 #
364 bootstrapping-build)
365 clean
366
367 if [ ! -z ${CCACHE+x} ]; then
368 COMPILER_LAUNCHER="-DCMAKE_CXX_COMPILER_LAUNCHER=${CCACHE}"
369 fi
370
371 step "Generating CMake"
372 cmake \
373 -S "${MONOREPO_ROOT}/llvm" \
374 -B "${BUILD_DIR}" \
375 -GNinja \
376 ${COMPILER_LAUNCHER} \
377 -DCMAKE_BUILD_TYPE=Release \
378 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
379 -DLLVM_ENABLE_PROJECTS="clang;lldb" \
380 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind;compiler-rt" \
381 -DLLVM_RUNTIME_TARGETS="$(${CXX} --print-target-triple)" \
382 -DLLVM_HOST_TRIPLE="$(${CXX} --print-target-triple)" \
383 -DLLVM_TARGETS_TO_BUILD="host" \
384 -DRUNTIMES_BUILD_ALLOW_DARWIN=ON \
385 -DCOMPILER_RT_INCLUDE_TESTS=OFF \
386 -DLLVM_ENABLE_ASSERTIONS=ON \
387 -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests"
388
389 step "Running the libc++ and libc++abi tests"
390 ninja -vC "${BUILD_DIR}" check-runtimes
391
392 step "Installing libc++ and libc++abi to a fake location"
393 ninja -vC "${BUILD_DIR}" install-runtimes
394
395 step "Running the LLDB libc++ data formatter tests"
396 ninja -vC "${BUILD_DIR}" lldb-api-test-deps
397 ${BUILD_DIR}/bin/llvm-lit -sv --param dotest-args='--category libc++' "${MONOREPO_ROOT}/lldb/test/API"
398
399 ccache -s
400 ;;
401 generic-static)
402 clean
403 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-static.cmake"
404 check-runtimes
405 ;;
406 generic-merged)
407 clean
408 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-merged.cmake" \
409 -DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
410 -DLIBCXXABI_TEST_CONFIG="llvm-libc++abi-merged.cfg.in" \
411 -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-merged.cfg.in"
412 check-runtimes
413 ;;
414 generic-hardening-mode-fast)
415 clean
416 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-fast.cmake"
417 check-runtimes
418 check-abi-list
419 ;;
420 generic-hardening-mode-fast-with-abi-breaks)
421 clean
422 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-fast-with-abi-breaks.cmake"
423 check-runtimes
424 # Not checking ABI list since we purposefully enable ABI breaking changes
425 ;;
426 generic-hardening-mode-extensive)
427 clean
428 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake"
429 check-runtimes
430 check-abi-list
431 ;;
432 generic-hardening-mode-extensive-observe-semantic)
433 clean
434 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-extensive-observe-semantic.cmake"
435 check-runtimes
436 check-abi-list
437 ;;
438 generic-hardening-mode-debug)
439 clean
440 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-debug.cmake"
441 check-runtimes
442 check-abi-list
443 ;;
444 #
445 # Module builds
446 #
447 generic-modules)
448 clean
449 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules.cmake"
450 check-runtimes
451 check-abi-list
452 ;;
453 generic-modules-cxx17-lsv)
454 clean
455 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules-cxx17-lsv.cmake"
456 check-runtimes
457 check-abi-list
458 ;;
459 #
460 # Parts removed
461 #
462 generic-no-threads)
463 clean
464 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-threads.cmake"
465 check-runtimes
466 ;;
467 generic-no-filesystem)
468 clean
469 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-filesystem.cmake"
470 check-runtimes
471 ;;
472 generic-no-random_device)
473 clean
474 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-random_device.cmake"
475 check-runtimes
476 ;;
477 generic-no-localization)
478 clean
479 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-localization.cmake"
480 check-runtimes
481 ;;
482 generic-no-terminal)
483 clean
484 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-terminal.cmake"
485 check-runtimes
486 ;;
487 generic-no-unicode)
488 clean
489 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-unicode.cmake"
490 check-runtimes
491 ;;
492 generic-no-wide-characters)
493 clean
494 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-wide-characters.cmake"
495 check-runtimes
496 ;;
497 generic-no-tzdb)
498 clean
499 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-tzdb.cmake"
500 check-runtimes
501 ;;
502 generic-no-experimental)
503 clean
504 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-experimental.cmake"
505 check-runtimes
506 check-abi-list
507 ;;
508 generic-no-exceptions)
509 clean
510 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-exceptions.cmake"
511 check-runtimes
512 check-abi-list
513 ;;
514 generic-no-rtti)
515 clean
516 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-rtti.cmake"
517 check-runtimes
518 ;;
519 #
520 # Other miscellaneous jobs
521 #
522 generic-abi-unstable)
523 clean
524 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-abi-unstable.cmake"
525 check-runtimes
526 ;;
527 generic-optimized-speed)
528 clean
529 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-optimized-speed.cmake"
530 check-runtimes
531 ;;
532 apple-configuration)
533 clean
534
535 step "Installing libc++ with the Apple system configuration"
536 arch="$(uname -m)"
537 xcrun --sdk macosx \
538 ${MONOREPO_ROOT}/libcxx/utils/ci/apple-install-libcxx.sh \
539 --llvm-root ${MONOREPO_ROOT} \
540 --build-dir ${BUILD_DIR} \
541 --install-dir ${INSTALL_DIR} \
542 --symbols-dir "${BUILD_DIR}/symbols" \
543 --architectures "${arch}" \
544 --version "999.99"
545
546 step "Running tests against Apple-configured libc++"
547 # TODO: It would be better to run the tests against the fake-installed version of libc++ instead
548 xcrun --sdk macosx ninja -vC "${BUILD_DIR}/${arch}" check-cxx check-cxxabi check-cxx-abilist
549 ;;
550 apple-system|apple-system-hardened)
551 clean
552
553 arch="$(uname -m)"
554 version="$(sw_vers --productVersion)"
555 params="target_triple=${arch}-apple-macosx${version}"
556 if [[ "${BUILDER}" == *-hardened ]]; then
557 params+=";hardening_mode=fast"
558 fi
559
560 # In the Apple system configuration, we build libc++ and libunwind separately.
561 step "Installing libc++ and libc++abi in Apple-system configuration"
562 cmake \
563 -S "${MONOREPO_ROOT}/runtimes" \
564 -B "${BUILD_DIR}/cxx" \
565 -GNinja \
566 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
567 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}/cxx" \
568 -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
569 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
570 -DLIBCXX_CXX_ABI=libcxxabi \
571 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
572 -DLIBCXX_TEST_CONFIG="apple-libc++-system.cfg.in" \
573 -DLIBCXXABI_TEST_CONFIG="apple-libc++abi-system.cfg.in" \
574 -DLIBCXX_TEST_PARAMS="${params}" \
575 -DLIBCXXABI_TEST_PARAMS="${params}"
576
577 step "Installing libunwind in Apple-system configuration"
578 cmake \
579 -S "${MONOREPO_ROOT}/runtimes" \
580 -B "${BUILD_DIR}/unwind" \
581 -GNinja \
582 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
583 -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}/unwind" \
584 -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
585 -DLLVM_ENABLE_RUNTIMES="libunwind" \
586 -DLIBUNWIND_TEST_CONFIG="apple-libunwind-system.cfg.in" \
587 -DLIBUNWIND_TEST_PARAMS="${params}" \
588 -DCMAKE_INSTALL_NAME_DIR="/usr/lib/system"
589
590 step "Running the libc++ tests"
591 ninja -vC "${BUILD_DIR}/cxx" check-cxx
592
593 step "Running the libc++abi tests"
594 ninja -vC "${BUILD_DIR}/cxx" check-cxxabi
595
596 step "Running the libunwind tests"
597 ninja -vC "${BUILD_DIR}/unwind" check-unwind
598 ;;
599 aarch64)
600 clean
601 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake"
602 check-runtimes
603 ;;
604 aarch64-no-exceptions)
605 clean
606 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake" \
607 -DLIBCXX_ENABLE_EXCEPTIONS=OFF \
608 -DLIBCXXABI_ENABLE_EXCEPTIONS=OFF
609 check-runtimes
610 ;;
611 # Aka Armv8 32 bit
612 armv8)
613 clean
614 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Arm.cmake"
615 check-runtimes
616 ;;
617 armv8-no-exceptions)
618 clean
619 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Thumb-no-exceptions.cmake"
620 check-runtimes
621 ;;
622 # Armv7 32 bit. One building Arm only one Thumb only code.
623 armv7)
624 clean
625 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Arm.cmake"
626 check-runtimes
627 ;;
628 armv7-no-exceptions)
629 clean
630 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Thumb-no-exceptions.cmake"
631 check-runtimes
632 ;;
633 armv7m-picolibc)
634 test-armv7m-picolibc \
635 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7M-picolibc.cmake"
636 ;;
637 armv7m-picolibc-no-exceptions)
638 test-armv7m-picolibc \
639 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7M-picolibc.cmake" \
640 -DLIBCXXABI_ENABLE_EXCEPTIONS=OFF \
641 -DLIBCXXABI_ENABLE_STATIC_UNWINDER=OFF \
642 -DLIBCXX_ENABLE_EXCEPTIONS=OFF \
643 -DLIBCXX_ENABLE_RTTI=OFF
644 ;;
645 clang-cl-dll)
646 clean
647 # TODO: Currently, building with the experimental library breaks running
648 # tests (the test linking look for the c++experimental library with the
649 # wrong name, and the statically linked c++experimental can't be linked
650 # correctly when libc++ visibility attributes indicate dllimport linkage
651 # anyway), thus just disable the experimental library. Remove this
652 # setting when cmake and the test driver does the right thing automatically.
653 generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS="enable_experimental=False"
654 step "Running the libc++ tests"
655 ninja -vC "${BUILD_DIR}" check-cxx
656 ;;
657 clang-cl-static)
658 clean
659 generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF
660 step "Running the libc++ tests"
661 ninja -vC "${BUILD_DIR}" check-cxx
662 ;;
663 clang-cl-no-vcruntime)
664 clean
665 # Building libc++ in the same way as in clang-cl-dll above, but running
666 # tests with -D_HAS_EXCEPTIONS=0, which users might set in certain
667 # translation units while using libc++, even if libc++ is built with
668 # exceptions enabled.
669 generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS="enable_experimental=False" \
670 -DLIBCXX_TEST_CONFIG="llvm-libc++-shared-no-vcruntime-clangcl.cfg.in"
671 step "Running the libc++ tests"
672 ninja -vC "${BUILD_DIR}" check-cxx
673 ;;
674 clang-cl-debug)
675 clean
676 generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS="enable_experimental=False" \
677 -DCMAKE_BUILD_TYPE=Debug
678 step "Running the libc++ tests"
679 ninja -vC "${BUILD_DIR}" check-cxx
680 ;;
681 clang-cl-static-crt)
682 clean
683 # Test linking a static libc++ with the static CRT ("MultiThreaded" denotes
684 # the static CRT, as opposed to "MultiThreadedDLL" which is the default).
685 generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF \
686 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
687 step "Running the libc++ tests"
688 ninja -vC "${BUILD_DIR}" check-cxx
689 ;;
690 mingw-dll)
691 clean
692 generate-cmake \
693 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
694 check-runtimes
695 ;;
696 mingw-static)
697 clean
698 generate-cmake \
699 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake" \
700 -DLIBCXX_ENABLE_SHARED=OFF \
701 -DLIBUNWIND_ENABLE_SHARED=OFF
702 check-runtimes
703 ;;
704 mingw-incomplete-sysroot)
705 # When bringing up a new cross compiler from scratch, we build
706 # libunwind/libcxx in a setup where the toolchain is incomplete and
707 # unable to perform the normal linker checks; this requires a few
708 # special cases in the CMake files.
709 #
710 # Building in an incomplete setup requires setting CMAKE_*_COMPILER_WORKS,
711 # as CMake fails to probe the compiler. This case also requires
712 # setting CMAKE_CXX_COMPILER_TARGET, as LLVM's heuristics for setting
713 # the triple fails when CMake hasn't been able to probe the environment.
714 # (This is what one has to do when building the initial libunwind/libcxx
715 # for a new toolchain.)
716 clean
717 generate-cmake \
718 -DCMAKE_C_COMPILER_WORKS=TRUE \
719 -DCMAKE_CXX_COMPILER_WORKS=TRUE \
720 -DCMAKE_C_COMPILER_TARGET=x86_64-w64-windows-gnu \
721 -DCMAKE_CXX_COMPILER_TARGET=x86_64-w64-windows-gnu \
722 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
723 # Only test that building succeeds; there's not much extra value in running
724 # the tests here, as it would be equivalent to the mingw-dll config above.
725 step "Building the runtimes"
726 ninja -vC "${BUILD_DIR}"
727 ;;
728 aix)
729 clean
730 generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AIX.cmake" \
731 -DLIBCXX_TEST_CONFIG="ibm-libc++-shared.cfg.in" \
732 -DLIBCXXABI_TEST_CONFIG="ibm-libc++abi-shared.cfg.in" \
733 -DLIBUNWIND_TEST_CONFIG="ibm-libunwind-shared.cfg.in"
734 check-abi-list
735 check-runtimes
736 ;;
737 android-ndk-*)
738 clean
739
740 ANDROID_EMU_IMG="${BUILDER#android-ndk-}"
741 . "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/emulator-functions.sh"
742 if ! validate_emu_img "${ANDROID_EMU_IMG}"; then
743 error "android-ndk suffix must be a valid emulator image (${ANDROID_EMU_IMG})" >&2
744 exit 1
745 fi
746 ARCH=$(arch_of_emu_img ${ANDROID_EMU_IMG})
747
748 # The NDK libc++_shared.so is always built against the oldest supported API
749 # level. When tests are run against a device with a newer API level, test
750 # programs can be built for any supported API level, but building for the
751 # newest API (i.e. the system image's API) is probably the most interesting.
752 PARAMS="executor=${MONOREPO_ROOT}/libcxx/utils/adb_run.py;target_triple=$(triple_of_arch ${ARCH})$(api_of_emu_img ${ANDROID_EMU_IMG})"
753 generate-cmake-android -C "${MONOREPO_ROOT}/runtimes/cmake/android/Arch-${ARCH}.cmake" \
754 -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AndroidNDK.cmake" \
755 -DCMAKE_SYSROOT=/opt/android/ndk/sysroot \
756 -DLIBCXX_TEST_PARAMS="${PARAMS}" \
757 -DLIBCXXABI_TEST_PARAMS="${PARAMS}"
758 check-abi-list
759 ninja -vC "${BUILD_DIR}" install-cxx install-cxxabi
760
761 # Start the emulator and make sure we can connect to the adb server running
762 # inside of it.
763 "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/start-emulator.sh" ${ANDROID_EMU_IMG}
764 trap "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/stop-emulator.sh" EXIT
765 . "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/setup-env-for-emulator.sh"
766
767 # Create adb_run early to avoid concurrent `mkdir -p` of common parent
768 # directories.
769 adb shell mkdir -p /data/local/tmp/adb_run
770 adb push "${BUILD_DIR}/lib/libc++_shared.so" /data/local/tmp/libc++/libc++_shared.so
771 step "Running the libc++ tests"
772 ninja -vC "${BUILD_DIR}" check-cxx
773 step "Running the libc++abi tests"
774 ninja -vC "${BUILD_DIR}" check-cxxabi
775 ;;
776 #################################################################
777 # Insert vendor-specific internal configurations below.
778 #
779 # This allows vendors to extend this file with their own internal
780 # configurations without running into merge conflicts with upstream.
781 #################################################################
782
783 #################################################################
784 *)
785 echo "${BUILDER} is not a known configuration"
786 exit 1
787 ;;
788 esac
789
790 endstep # Make sure we close any still-open output group