blob: 4dd1d485d4c57670bba762ed70e1084059fa4751 [file] [log] [blame]
Louis Dionne9f21d342020-09-23 09:20:03 -04001#!/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
11
12BUILDER="${1}"
13
14args=()
15args+=("-DLLVM_ENABLE_PROJECTS=libcxx;libunwind;libcxxabi")
16args+=("-DLIBCXX_CXX_ABI=libcxxabi")
17
18case "${BUILDER}" in
19x86_64-ubuntu-cxx03)
20 export CC=clang
21 export CXX=clang++
22 args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --param=std=c++03")
23;;
24x86_64-ubuntu-cxx11)
25 export CC=clang
26 export CXX=clang++
27 args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --param=std=c++11")
28;;
29x86_64-ubuntu-cxx14)
30 export CC=clang
31 export CXX=clang++
32 args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --param=std=c++14")
33;;
34x86_64-ubuntu-cxx17)
35 export CC=clang
36 export CXX=clang++
37 args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --param=std=c++17")
38;;
39x86_64-ubuntu-cxx2a)
40 export CC=clang
41 export CXX=clang++
42 args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --param=std=c++2a")
43;;
44x86_64-ubuntu-noexceptions)
45 export CC=clang
46 export CXX=clang++
47 args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported")
48 args+=("-DLIBCXX_ENABLE_EXCEPTIONS=OFF")
49 args+=("-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF")
50;;
51x86_64-ubuntu-32bit)
52 export CC=clang
53 export CXX=clang++
54 args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported")
55 args+=("-DLLVM_BUILD_32_BITS=ON")
56;;
57x86_64-ubuntu-gcc)
58 export CC=gcc
59 export CXX=g++
60 args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported")
61;;
62x86_64-ubuntu-asan)
63 export CC=clang
64 export CXX=clang++
65 args+=("-DLLVM_USE_SANITIZER=Address")
66 args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported")
67;;
68x86_64-ubuntu-msan)
69 export CC=clang
70 export CXX=clang++
71 args+=("-DLLVM_USE_SANITIZER=MemoryWithOrigins")
72 args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported")
73;;
74x86_64-ubuntu-tsan)
75 export CC=clang
76 export CXX=clang++
77 args+=("-DLLVM_USE_SANITIZER=Thread")
78 args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported")
79;;
80x86_64-ubuntu-ubsan)
81 export CC=clang
82 export CXX=clang++
83 args+=("-DLLVM_USE_SANITIZER=Undefined")
84 args+=("-DLIBCXX_ABI_UNSTABLE=ON")
85 args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported")
86;;
87x86_64-ubuntu-with_llvm_unwinder)
88 export CC=clang
89 export CXX=clang++
90 args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported")
91 args+=("-DLIBCXXABI_USE_LLVM_UNWINDER=ON")
92;;
93x86_64-ubuntu-singlethreaded)
94 export CC=clang
95 export CXX=clang++
96 args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported")
97 args+=("-DLIBCXX_ENABLE_THREADS=OFF")
98 args+=("-DLIBCXXABI_ENABLE_THREADS=OFF")
99 args+=("-DLIBCXX_ENABLE_MONOTONIC_CLOCK=OFF")
100;;
101*)
102 echo "${BUILDER} is not a known configuration"
103 exit 1
104;;
105esac
106
107UMBRELLA_ROOT="$(git rev-parse --show-toplevel)"
108LLVM_ROOT="${UMBRELLA_ROOT}/llvm"
109BUILD_DIR="${UMBRELLA_ROOT}/build/${BUILDER}"
110
111echo "--- Generating CMake"
112rm -rf "${BUILD_DIR}"
113cmake -S "${LLVM_ROOT}" -B "${BUILD_DIR}" -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo "${args[@]}"
114
115echo "--- Building libc++ and libc++abi"
116ninja -C "${BUILD_DIR}" check-cxx-deps cxxabi
117
118echo "+++ Running the libc++ tests"
119ninja -C "${BUILD_DIR}" check-cxx
120
121echo "+++ Running the libc++abi tests"
122ninja -C "${BUILD_DIR}" check-cxxabi
123
124echo "+++ Running the libc++ benchmarks"
125ninja -C "${BUILD_DIR}" check-cxx-benchmarks