Debian Codegraph @

.ci/monolithic-linux.sh

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 #
11 # This script performs a monolithic build of the monorepo and runs the tests of
12 # most projects on Linux. This should be replaced by per-project scripts that
13 # run only the relevant tests.
14 #
15
16 source .ci/utils.sh
17
18 INSTALL_DIR="${BUILD_DIR}/install"
19
20 mkdir -p artifacts/reproducers
21
22 # Make sure any clang reproducers will end up as artifacts
23 export CLANG_CRASH_DIAGNOSTICS_DIR=`realpath artifacts/reproducers`
24
25 projects="${1}"
26 targets="${2}"
27 runtimes="${3}"
28 runtime_targets="${4}"
29 runtime_targets_needs_reconfig="${5}"
30 enable_cir="${6}"
31
32 lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests --succinct"
33
34 start-group "CMake"
35
36 # Set the system llvm-symbolizer as preferred.
37 export LLVM_SYMBOLIZER_PATH=`which llvm-symbolizer`
38 [[ ! -f "${LLVM_SYMBOLIZER_PATH}" ]] && echo "llvm-symbolizer not found!"
39
40 # Set up all runtimes either way. libcxx is a dependency of LLDB.
41 # It will not be built unless it is used.
42 cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
43 -D LLVM_ENABLE_PROJECTS="${projects}" \
44 -D LLVM_ENABLE_RUNTIMES="${runtimes}" \
45 -G Ninja \
46 -D CMAKE_PREFIX_PATH="${HOME}/.local" \
47 -D CMAKE_BUILD_TYPE=Release \
48 -D CLANG_ENABLE_CIR=${enable_cir} \
49 -D LLVM_ENABLE_ASSERTIONS=ON \
50 -D LLVM_BUILD_EXAMPLES=ON \
51 -D COMPILER_RT_BUILD_LIBFUZZER=OFF \
52 -D LLVM_LIT_ARGS="${lit_args}" \
53 -D LLVM_ENABLE_LLD=ON \
54 -D CMAKE_CXX_FLAGS=-gmlt \
55 -D CMAKE_C_COMPILER_LAUNCHER=sccache \
56 -D CMAKE_CXX_COMPILER_LAUNCHER=sccache \
57 -D LIBCXX_CXX_ABI=libcxxabi \
58 -D MLIR_ENABLE_BINDINGS_PYTHON=ON \
59 -D LLDB_ENABLE_PYTHON=ON \
60 -D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON \
61 -D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
62 -D CMAKE_EXE_LINKER_FLAGS="-no-pie" \
63 -D LLVM_ENABLE_WERROR=ON
64
65 start-group "ninja"
66
67 if [[ -n "${targets}" ]]; then
68 # Targets are not escaped as they are passed as separate arguments.
69 ninja -C "${BUILD_DIR}" -k 0 ${targets} |& tee ninja.log
70 cp ${BUILD_DIR}/.ninja_log ninja.ninja_log
71 fi
72
73 if [[ -n "${runtime_targets}" ]]; then
74 start-group "ninja Runtimes"
75
76 ninja -C "${BUILD_DIR}" ${runtime_targets} |& tee ninja_runtimes.log
77 cp ${BUILD_DIR}/.ninja_log ninja_runtimes.ninja_log
78 fi
79
80 # Compiling runtimes with just-built Clang and running their tests
81 # as an additional testing for Clang.
82 if [[ -n "${runtime_targets_needs_reconfig}" ]]; then
83 start-group "CMake Runtimes C++26"
84
85 cmake \
86 -D LIBCXX_TEST_PARAMS="std=c++26" \
87 -D LIBCXXABI_TEST_PARAMS="std=c++26" \
88 "${BUILD_DIR}"
89
90 start-group "ninja Runtimes C++26"
91
92 ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
93 |& tee ninja_runtimes_needs_reconfig1.log
94 cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconig.ninja_log
95
96 start-group "CMake Runtimes Clang Modules"
97
98 cmake \
99 -D LIBCXX_TEST_PARAMS="enable_modules=clang" \
100 -D LIBCXXABI_TEST_PARAMS="enable_modules=clang" \
101 "${BUILD_DIR}"
102
103 start-group "ninja Runtimes Clang Modules"
104
105 ninja -C "${BUILD_DIR}" ${runtime_targets_needs_reconfig} \
106 |& tee ninja_runtimes_needs_reconfig2.log
107 cp ${BUILD_DIR}/.ninja_log ninja_runtimes_needs_reconfig2.ninja_log
108 fi