• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
10set -ex
11set -o pipefail
12unset LANG
13unset LC_ALL
14unset LC_COLLATE
15
16PROGNAME="$(basename "${0}")"
17
18function usage() {
19cat <<EOF
20Usage:
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--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.
35Environment variables
36CC                  The C compiler to use, this value is used by CMake. This
37                    variable is optional.
38CXX                 The C++ compiler to use, this value is used by CMake. This
39                    variable is optional.
40
41CLANG_FORMAT        The clang-format binary to use when generating the format
42                    ignore list.
43
44GIT_CLANG_FORMAT    The git-clang-format binary to use in the 'format' builder.
45                    When the value is omitted, it defaults to
46                    'git-clang-format'. This variable or its fallback must work
47                    when running the 'format' builder.
48
49ENABLE_CLANG_TIDY   Whether to compile and run clang-tidy checks. This variable
50                    is optional.
51EOF
52}
53
54if [[ $# == 0 ]]; then
55   usage
56   exit 0
57fi
58
59while [[ $# -gt 0 ]]; do
60    case ${1} in
61        -h|--help)
62            usage
63            exit 0
64            ;;
65        --llvm-root)
66            MONOREPO_ROOT="${2}"
67            shift; shift
68            ;;
69        --build-dir)
70            BUILD_DIR="${2}"
71            shift; shift
72            ;;
73        --osx-roots)
74            OSX_ROOTS="${2}"
75            shift; shift
76            ;;
77        *)
78            BUILDER="${1}"
79            shift
80            ;;
81    esac
82done
83
84MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
85BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build/${BUILDER}}"
86INSTALL_DIR="${BUILD_DIR}/install"
87
88# If we can find Ninja/CMake provided by Xcode, use those since we know their
89# version will generally work with the Clang shipped in Xcode (e.g. if Clang
90# knows about -std=c++20, the CMake bundled in Xcode will probably know about
91# that flag too).
92if xcrun --find ninja &>/dev/null; then NINJA="$(xcrun --find ninja)"; else NINJA="ninja"; fi
93if xcrun --find cmake &>/dev/null; then CMAKE="$(xcrun --find cmake)"; else CMAKE="cmake"; fi
94
95function clean() {
96    rm -rf "${BUILD_DIR}"
97}
98
99if [ -z "${ENABLE_CLANG_TIDY}" ]; then
100    ENABLE_CLANG_TIDY=Off
101fi
102
103function generate-cmake-base() {
104    echo "--- Generating CMake"
105    ${CMAKE} \
106          -S "${MONOREPO_ROOT}/runtimes" \
107          -B "${BUILD_DIR}" \
108          -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
109          -DCMAKE_BUILD_TYPE=RelWithDebInfo \
110          -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
111          -DLIBCXX_ENABLE_WERROR=YES \
112          -DLIBCXXABI_ENABLE_WERROR=YES \
113          -DLIBUNWIND_ENABLE_WERROR=YES \
114          -DLIBCXX_ENABLE_CLANG_TIDY=${ENABLE_CLANG_TIDY} \
115          -DLLVM_LIT_ARGS="-sv --show-unsupported --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
116          "${@}"
117}
118
119function generate-cmake() {
120    generate-cmake-base \
121          -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
122          -DLIBCXX_CXX_ABI=libcxxabi \
123          "${@}"
124}
125
126function generate-cmake-libcxx-win() {
127    # TODO: Clang-cl in MSVC configurations don't have access to compiler_rt
128    # builtins helpers for int128 division. See
129    # https://reviews.llvm.org/D91139#2429595 for a comment about longterm
130    # intent for handling the issue. In the meantime, define
131    # -D_LIBCPP_HAS_NO_INT128 (both when building the library itself and
132    # when building tests) to allow enabling filesystem for running tests,
133    # even if it uses a non-permanent ABI.
134    generate-cmake-base \
135          -DLLVM_ENABLE_RUNTIMES="libcxx" \
136          -DCMAKE_C_COMPILER=clang-cl \
137          -DCMAKE_CXX_COMPILER=clang-cl \
138          -DLIBCXX_ENABLE_FILESYSTEM=YES \
139          -DLIBCXX_EXTRA_SITE_DEFINES="_LIBCPP_HAS_NO_INT128" \
140          "${@}"
141}
142
143function check-runtimes() {
144    echo "--- Installing libc++, libc++abi and libunwind to a fake location"
145    ${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi install-unwind
146
147    echo "+++ Running the libc++ tests"
148    ${NINJA} -vC "${BUILD_DIR}" check-cxx
149
150    echo "+++ Running the libc++abi tests"
151    ${NINJA} -vC "${BUILD_DIR}" check-cxxabi
152
153    echo "+++ Running the libunwind tests"
154    ${NINJA} -vC "${BUILD_DIR}" check-unwind
155}
156
157# TODO: The goal is to test this against all configurations. We should also move
158#       this to the Lit test suite instead of being a separate CMake target.
159function check-abi-list() {
160    echo "+++ Running the libc++ ABI list test"
161    ${NINJA} -vC "${BUILD_DIR}" check-cxx-abilist || (
162        echo "+++ Generating the libc++ ABI list after failed check"
163        ${NINJA} -vC "${BUILD_DIR}" generate-cxx-abilist
164        false
165    )
166}
167
168function check-cxx-benchmarks() {
169    echo "--- Running the benchmarks"
170    ${NINJA} -vC "${BUILD_DIR}" check-cxx-benchmarks
171}
172
173# Print the version of a few tools to aid diagnostics in some cases
174${CMAKE} --version
175${NINJA} --version
176
177if [ ! -z "${CXX}" ]; then ${CXX} --version; fi
178
179case "${BUILDER}" in
180check-format)
181    clean
182    echo "+++ Checking formatting"
183    # We need to set --extensions so that clang-format checks extensionless files.
184    mkdir -p ${BUILD_DIR}
185    if [ -z "${GIT_CLANG_FORMAT}" ]; then
186       GIT_CLANG_FORMAT=git-clang-format
187    fi
188    ${GIT_CLANG_FORMAT} \
189        --diff \
190        --extensions ',h,hpp,c,cpp,inc,ipp' HEAD~1 \
191        -- $(find libcxx/{benchmarks,include,src}/ -type f | grep -vf libcxx/utils/data/ignore_format.txt) \
192        | tee ${BUILD_DIR}/clang-format.patch
193    # Check if the diff is empty, fail otherwise.
194    ! grep -q '^--- a' ${BUILD_DIR}/clang-format.patch
195;;
196check-generated-output)
197    # `! foo` doesn't work properly with `set -e`, use `! foo || false` instead.
198    # https://stackoverflow.com/questions/57681955/set-e-does-not-respect-logical-not
199    clean
200    generate-cmake
201
202    # Reject patches that forgot to re-run the generator scripts.
203    echo "+++ Making sure the generator scripts were run"
204    ${NINJA} -vC "${BUILD_DIR}" libcxx-generate-files
205    git diff | tee ${BUILD_DIR}/generated_output.patch
206    git ls-files -o --exclude-standard | tee ${BUILD_DIR}/generated_output.status
207    ! grep -q '^--- a' ${BUILD_DIR}/generated_output.patch || false
208    if [ -s ${BUILD_DIR}/generated_output.status ]; then
209        echo "It looks like not all the generator scripts were run,"
210        echo "did you forget to build the libcxx-generate-files target?"
211        echo "Did you add all new files it generated?"
212        false
213    fi
214
215    ${MONOREPO_ROOT}/libcxx/utils/generate_ignore_format.sh
216    git diff | tee ${BUILD_DIR}/generated_output.patch
217    git ls-files -o --exclude-standard | tee ${BUILD_DIR}/generated_output.status
218    ! grep -q '^--- a' ${BUILD_DIR}/generated_output.patch || false
219    if [ -s ${BUILD_DIR}/generated_output.status ]; then
220        echo "It looks like the list of not formatted files has changed."
221        echo "If a file is now properly formatted with clang-format, remove the file name from "
222        echo "libcxx/utils/data/ignore_format.txt. Otherwise you have to fix the"
223        echo "formatting of some of the changed files."
224        false
225    fi
226
227    # Reject patches that introduce non-ASCII characters or hard tabs.
228    # Depends on LC_COLLATE set at the top of this script.
229    ! grep -rn '[^ -~]' libcxx/include libcxx/src libcxx/test libcxx/benchmarks \
230           --exclude '*.dat' \
231           --exclude 'escaped_output.*.pass.cpp' \
232           --exclude 'format_tests.h' \
233           --exclude 'format.functions.tests.h' \
234           --exclude 'formatter.*.pass.cpp' \
235           --exclude 'grep.pass.cpp' \
236           --exclude 'locale-specific_form.pass.cpp' \
237           --exclude 'ostream.pass.cpp' \
238           --exclude 'std_format_spec_string_unicode.bench.cpp' \
239           --exclude 'underflow.pass.cpp' \
240           || false
241
242    # Reject code with trailing whitespace
243    ! grep -rn '[[:blank:]]$' libcxx/include libcxx/src libcxx/test libcxx/benchmarks || false
244;;
245#
246# Various Standard modes
247#
248generic-cxx03)
249    clean
250    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake"
251    check-runtimes
252    check-abi-list
253;;
254generic-cxx11)
255    clean
256    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake"
257    check-runtimes
258    check-abi-list
259;;
260generic-cxx14)
261    clean
262    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx14.cmake"
263    check-runtimes
264    check-abi-list
265;;
266generic-cxx17)
267    clean
268    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx17.cmake"
269    check-runtimes
270    check-abi-list
271;;
272generic-cxx20)
273    clean
274    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx20.cmake"
275    check-runtimes
276    check-abi-list
277;;
278generic-cxx2b)
279    clean
280    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx2b.cmake"
281    check-runtimes
282    check-abi-list
283;;
284#
285# Other compiler support
286#
287generic-gcc)
288    clean
289    generate-cmake -DLIBCXX_ENABLE_WERROR=NO \
290                   -DLIBCXXABI_ENABLE_WERROR=NO \
291                   -DLIBUNWIND_ENABLE_WERROR=NO
292    check-runtimes
293;;
294generic-gcc-cxx11)
295    clean
296    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake" \
297                   -DLIBCXX_ENABLE_WERROR=NO \
298                   -DLIBCXXABI_ENABLE_WERROR=NO \
299                   -DLIBUNWIND_ENABLE_WERROR=NO
300    check-runtimes
301;;
302#
303# Sanitizers
304#
305generic-asan)
306    clean
307    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-asan.cmake"
308    check-runtimes
309;;
310generic-msan)
311    clean
312    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-msan.cmake"
313    check-runtimes
314;;
315generic-tsan)
316    clean
317    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-tsan.cmake"
318    check-runtimes
319;;
320generic-ubsan)
321    clean
322    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-ubsan.cmake"
323    check-runtimes
324;;
325#
326# Various build configurations
327#
328bootstrapping-build)
329    clean
330
331    echo "--- Generating CMake"
332    ${CMAKE} \
333          -S "${MONOREPO_ROOT}/llvm" \
334          -B "${BUILD_DIR}" \
335          -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
336          -DCMAKE_BUILD_TYPE=RelWithDebInfo \
337          -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
338          -DLLVM_ENABLE_PROJECTS="clang" \
339          -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
340          -DLLVM_RUNTIME_TARGETS="$(c++ --print-target-triple)" \
341          -DLLVM_TARGETS_TO_BUILD="host" \
342          -DRUNTIMES_BUILD_ALLOW_DARWIN=ON \
343          -DLLVM_ENABLE_ASSERTIONS=ON
344
345    echo "+++ Running the libc++ and libc++abi tests"
346    ${NINJA} -C "${BUILD_DIR}" check-runtimes
347
348    echo "--- Installing libc++ and libc++abi to a fake location"
349    ${NINJA} -C "${BUILD_DIR}" install-runtimes
350;;
351generic-static)
352    clean
353    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-static.cmake"
354    check-runtimes
355;;
356generic-merged)
357    clean
358    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-merged.cmake" \
359                   -DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
360                   -DLIBCXXABI_TEST_CONFIG="llvm-libc++abi-merged.cfg.in" \
361                   -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-merged.cfg.in"
362    check-runtimes
363;;
364generic-assertions)
365    clean
366    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-assertions.cmake"
367    check-runtimes
368    check-abi-list
369;;
370generic-debug-mode)
371    clean
372    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-debug-mode.cmake"
373    check-runtimes
374    # We don't check the ABI lists because the debug mode ABI is not stable
375;;
376generic-with_llvm_unwinder)
377    clean
378    generate-cmake -DLIBCXXABI_USE_LLVM_UNWINDER=ON
379    check-runtimes
380;;
381generic-modules)
382    clean
383    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules.cmake"
384    check-runtimes
385    check-abi-list
386;;
387generic-modules-lsv)
388    clean
389    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules-lsv.cmake"
390    check-runtimes
391    check-abi-list
392;;
393#
394# Parts removed
395#
396generic-no-threads)
397    clean
398    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-threads.cmake"
399    check-runtimes
400;;
401generic-no-filesystem)
402    clean
403    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-filesystem.cmake"
404    check-runtimes
405;;
406generic-no-random_device)
407    clean
408    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-random_device.cmake"
409    check-runtimes
410;;
411generic-no-fstream)
412    clean
413    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-fstream.cmake"
414    check-runtimes
415;;
416generic-no-localization)
417    clean
418    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-localization.cmake"
419    check-runtimes
420;;
421generic-no-unicode)
422    clean
423    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-unicode.cmake"
424    check-runtimes
425;;
426generic-no-wide-characters)
427    clean
428    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-wide-characters.cmake"
429    check-runtimes
430;;
431generic-no-experimental)
432    clean
433    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-experimental.cmake"
434    check-runtimes
435    check-abi-list
436;;
437generic-noexceptions)
438    clean
439    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-noexceptions.cmake"
440    check-runtimes
441    check-abi-list
442;;
443#
444# Other miscellaneous jobs
445#
446generic-abi-unstable)
447    clean
448    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-abi-unstable.cmake"
449    check-runtimes
450;;
451apple-system)
452    clean
453
454    arch="$(uname -m)"
455    xcrun --sdk macosx                                              \
456        ${MONOREPO_ROOT}/libcxx/utils/ci/apple-install-libcxx.sh    \
457            --llvm-root ${MONOREPO_ROOT}                            \
458            --build-dir ${BUILD_DIR}                                \
459            --install-dir ${INSTALL_DIR}                            \
460            --symbols-dir "${BUILD_DIR}/symbols"                    \
461            --architectures "${arch}"                               \
462            --version "999.99"
463
464    # TODO: It would be better to run the tests against the fake-installed version of libc++ instead
465    xcrun --sdk macosx ninja -vC "${BUILD_DIR}/${arch}" check-cxx check-cxxabi check-cxx-abilist
466;;
467apple-system-backdeployment-assertions-*)
468    clean
469
470    if [[ "${OSX_ROOTS}" == "" ]]; then
471        echo "--- Downloading previous macOS dylibs"
472        PREVIOUS_DYLIBS_URL="https://dl.dropboxusercontent.com/s/gmcfxwgl9f9n6pu/libcxx-roots.tar.gz"
473        OSX_ROOTS="${BUILD_DIR}/macos-roots"
474        mkdir -p "${OSX_ROOTS}"
475        curl "${PREVIOUS_DYLIBS_URL}" | tar -xz --strip-components=1 -C "${OSX_ROOTS}"
476    fi
477
478    DEPLOYMENT_TARGET="${BUILDER#apple-system-backdeployment-assertions-}"
479
480    # TODO: On Apple platforms, we never produce libc++abi.1.dylib or libunwind.1.dylib,
481    #       only libc++abi.dylib and libunwind.dylib. Fix that in the build so that the
482    #       tests stop searching for @rpath/libc++abi.1.dylib and @rpath/libunwind.1.dylib.
483    cp "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.dylib" \
484       "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.1.dylib"
485    cp "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.dylib" \
486       "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.1.dylib"
487
488    arch="$(uname -m)"
489    PARAMS="target_triple=${arch}-apple-macosx${DEPLOYMENT_TARGET}"
490    PARAMS+=";cxx_runtime_root=${OSX_ROOTS}/macOS/libc++/${DEPLOYMENT_TARGET}"
491    PARAMS+=";abi_runtime_root=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}"
492    PARAMS+=";unwind_runtime_root=${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}"
493    PARAMS+=";enable_assertions=True"
494
495    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
496                   -DLIBCXX_TEST_CONFIG="apple-libc++-backdeployment.cfg.in" \
497                   -DLIBCXXABI_TEST_CONFIG="apple-libc++abi-backdeployment.cfg.in" \
498                   -DLIBUNWIND_TEST_CONFIG="apple-libunwind-backdeployment.cfg.in" \
499                   -DLIBCXX_TEST_PARAMS="${PARAMS}" \
500                   -DLIBCXXABI_TEST_PARAMS="${PARAMS}" \
501                   -DLIBUNWIND_TEST_PARAMS="${PARAMS}"
502
503    check-runtimes
504;;
505apple-system-backdeployment-*)
506    clean
507
508    if [[ "${OSX_ROOTS}" == "" ]]; then
509        echo "--- Downloading previous macOS dylibs"
510        PREVIOUS_DYLIBS_URL="https://dl.dropboxusercontent.com/s/gmcfxwgl9f9n6pu/libcxx-roots.tar.gz"
511        OSX_ROOTS="${BUILD_DIR}/macos-roots"
512        mkdir -p "${OSX_ROOTS}"
513        curl "${PREVIOUS_DYLIBS_URL}" | tar -xz --strip-components=1 -C "${OSX_ROOTS}"
514    fi
515
516    DEPLOYMENT_TARGET="${BUILDER#apple-system-backdeployment-}"
517
518    # TODO: On Apple platforms, we never produce libc++abi.1.dylib or libunwind.1.dylib,
519    #       only libc++abi.dylib and libunwind.dylib. Fix that in the build so that the
520    #       tests stop searching for @rpath/libc++abi.1.dylib and @rpath/libunwind.1.dylib.
521    cp "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.dylib" \
522       "${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}/libc++abi.1.dylib"
523    cp "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.dylib" \
524       "${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}/libunwind.1.dylib"
525
526    arch="$(uname -m)"
527    PARAMS="target_triple=${arch}-apple-macosx${DEPLOYMENT_TARGET}"
528    PARAMS+=";cxx_runtime_root=${OSX_ROOTS}/macOS/libc++/${DEPLOYMENT_TARGET}"
529    PARAMS+=";abi_runtime_root=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}"
530    PARAMS+=";unwind_runtime_root=${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}"
531
532    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
533                   -DLIBCXX_TEST_CONFIG="apple-libc++-backdeployment.cfg.in" \
534                   -DLIBCXXABI_TEST_CONFIG="apple-libc++abi-backdeployment.cfg.in" \
535                   -DLIBUNWIND_TEST_CONFIG="apple-libunwind-backdeployment.cfg.in" \
536                   -DLIBCXX_TEST_PARAMS="${PARAMS}" \
537                   -DLIBCXXABI_TEST_PARAMS="${PARAMS}" \
538                   -DLIBUNWIND_TEST_PARAMS="${PARAMS}"
539
540    check-runtimes
541;;
542benchmarks)
543    clean
544    generate-cmake
545    check-cxx-benchmarks
546;;
547documentation)
548    clean
549    generate-cmake -DLLVM_ENABLE_SPHINX=ON
550
551    echo "+++ Generating documentation"
552    ${NINJA} -vC "${BUILD_DIR}" docs-libcxx-html
553;;
554aarch64)
555    clean
556    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake"
557    check-runtimes
558;;
559aarch64-noexceptions)
560    clean
561    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake" \
562                   -DLIBCXX_ENABLE_EXCEPTIONS=OFF \
563                   -DLIBCXXABI_ENABLE_EXCEPTIONS=OFF
564    check-runtimes
565;;
566# Aka Armv8 32 bit
567armv8)
568    clean
569    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Arm.cmake"
570    check-runtimes
571;;
572armv8-noexceptions)
573    clean
574    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Thumb-noexceptions.cmake"
575    check-runtimes
576;;
577# Armv7 32 bit. One building Arm only one Thumb only code.
578armv7)
579    clean
580    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Arm.cmake"
581    check-runtimes
582;;
583armv7-noexceptions)
584    clean
585    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Thumb-noexceptions.cmake"
586    check-runtimes
587;;
588clang-cl-dll)
589    clean
590    # TODO: Currently, building with the experimental library breaks running
591    # tests (the test linking look for the c++experimental library with the
592    # wrong name, and the statically linked c++experimental can't be linked
593    # correctly when libc++ visibility attributes indicate dllimport linkage
594    # anyway), thus just disable the experimental library. Remove this
595    # setting when cmake and the test driver does the right thing automatically.
596    generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS="enable_experimental=False"
597    echo "+++ Running the libc++ tests"
598    ${NINJA} -vC "${BUILD_DIR}" check-cxx
599;;
600clang-cl-static)
601    clean
602    generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF
603    echo "+++ Running the libc++ tests"
604    ${NINJA} -vC "${BUILD_DIR}" check-cxx
605;;
606clang-cl-no-vcruntime)
607    clean
608    # Building libc++ in the same way as in clang-cl-dll above, but running
609    # tests with -D_HAS_EXCEPTIONS=0, which users might set in certain
610    # translation units while using libc++, even if libc++ is built with
611    # exceptions enabled.
612    generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS="enable_experimental=False" \
613                              -DLIBCXX_TEST_CONFIG="llvm-libc++-shared-no-vcruntime-clangcl.cfg.in"
614    echo "+++ Running the libc++ tests"
615    ${NINJA} -vC "${BUILD_DIR}" check-cxx
616;;
617mingw-dll)
618    clean
619    # Explicitly specify the compiler with a triple prefix. The CI
620    # environment has got two installations of Clang; the default one
621    # defaults to MSVC mode, while there's an installation of llvm-mingw
622    # further back in PATH. By calling the compiler with an explicit
623    # triple prefix, we use the one that is bundled with a mingw sysroot.
624    generate-cmake \
625          -DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \
626          -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++ \
627          -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
628    echo "+++ Running the libc++ tests"
629    ${NINJA} -vC "${BUILD_DIR}" check-cxx
630;;
631mingw-static)
632    clean
633    generate-cmake \
634          -DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \
635          -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++ \
636          -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake" \
637          -DLIBCXX_ENABLE_SHARED=OFF \
638          -DLIBUNWIND_ENABLE_SHARED=OFF
639    echo "+++ Running the libc++ tests"
640    ${NINJA} -vC "${BUILD_DIR}" check-cxx
641;;
642mingw-dll-i686)
643    clean
644    generate-cmake \
645          -DCMAKE_C_COMPILER=i686-w64-mingw32-clang \
646          -DCMAKE_CXX_COMPILER=i686-w64-mingw32-clang++ \
647          -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
648    echo "+++ Running the libc++ tests"
649    ${NINJA} -vC "${BUILD_DIR}" check-cxx
650;;
651aix)
652    clean
653    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AIX.cmake" \
654                   -DLIBCXX_TEST_CONFIG="ibm-libc++-shared.cfg.in" \
655                   -DLIBCXXABI_TEST_CONFIG="ibm-libc++abi-shared.cfg.in" \
656                   -DLIBUNWIND_TEST_CONFIG="ibm-libunwind-shared.cfg.in"
657    check-abi-list
658    check-runtimes
659;;
660#################################################################
661# Insert vendor-specific internal configurations below.
662#
663# This allows vendors to extend this file with their own internal
664# configurations without running into merge conflicts with upstream.
665#################################################################
666
667#################################################################
668*)
669    echo "${BUILDER} is not a known configuration"
670    exit 1
671;;
672esac
673