Skip to content

Commit 2f8dd26

Browse files
committed
[libc++] Refactor the run-buildbot script to make it more modular, and run the benchmarks
As a fly-by fix, unbreak the benchmarks on Apple platforms. Differential Revision: https://reviews.llvm.org/D90043
1 parent 8c72eea commit 2f8dd26

File tree

5 files changed

+86
-61
lines changed

5 files changed

+86
-61
lines changed

libcxx/src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ if (LIBCXX_ENABLE_SHARED)
222222
"-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/libc++abi.v${LIBCXX_LIBCPPABI_VERSION}.exp"
223223
"-Wl,-force_symbols_not_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/notweak.exp"
224224
"-Wl,-force_symbols_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/weak.exp")
225+
226+
target_link_libraries(cxx_shared PRIVATE cxxabi-reexports)
225227
endif()
226228

227229
# Generate a linker script in place of a libc++.so symlink.

libcxx/test/support/debug_mode_helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <utility>
2929

3030
#include <unistd.h>
31+
#include <errno.h>
3132
#include <sys/wait.h>
3233
#include "test_macros.h"
3334
#include "test_allocator.h"

libcxx/utils/ci/buildkite-pipeline.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ steps:
118118
agents:
119119
queue: "libcxx-macos-builders"
120120

121+
- label: "Benchmarks"
122+
command: "libcxx/utils/ci/run-buildbot.sh benchmarks"
123+
artifact_paths:
124+
- "**/test-results.xml"
125+
agents:
126+
queue: "libcxx-builders"
127+
121128
# Build with the configuration we use to generate libc++.dylib on Apple platforms
122129
- label: "Apple system"
123130
command: "libcxx/utils/ci/run-buildbot.sh x86_64-apple-system"

libcxx/utils/ci/run-buildbot.sh

Lines changed: 73 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -14,144 +14,157 @@ MONOREPO_ROOT="$(git rev-parse --show-toplevel)"
1414
BUILD_DIR="${MONOREPO_ROOT}/build/${BUILDER}"
1515
INSTALL_DIR="${MONOREPO_ROOT}/build/${BUILDER}/install"
1616

17-
args=()
18-
args+=("-DLLVM_ENABLE_PROJECTS=libcxx;libunwind;libcxxabi")
19-
args+=("-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}")
20-
args+=("-DLIBCXX_CXX_ABI=libcxxabi")
17+
function generate-cmake() {
18+
echo "--- Generating CMake"
19+
rm -rf "${BUILD_DIR}"
20+
cmake -S "${MONOREPO_ROOT}/llvm" \
21+
-B "${BUILD_DIR}" \
22+
-GNinja \
23+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
24+
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
25+
-DLLVM_ENABLE_PROJECTS="libcxx;libunwind;libcxxabi" \
26+
-DLLVM_LIT_ARGS="-sv --show-unsupported --xunit-xml-output test-results.xml" \
27+
-DLIBCXX_CXX_ABI=libcxxabi \
28+
${@}
29+
}
30+
31+
function check-cxx-cxxabi() {
32+
echo "+++ Running the libc++ tests"
33+
ninja -C "${BUILD_DIR}" check-cxx
34+
35+
echo "+++ Running the libc++abi tests"
36+
ninja -C "${BUILD_DIR}" check-cxxabi
37+
38+
echo "--- Installing libc++ and libc++abi to a fake location"
39+
ninja -C "${BUILD_DIR}" install-cxx install-cxxabi
40+
}
41+
42+
function check-cxx-benchmarks() {
43+
echo "--- Running the benchmarks"
44+
ninja -C "${BUILD_DIR}" check-cxx-benchmarks
45+
}
2146

2247
case "${BUILDER}" in
2348
generic-cxx03)
2449
export CC=clang
2550
export CXX=clang++
26-
args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --xunit-xml-output test-results.xml")
27-
args+=("-C${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake")
51+
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake"
52+
check-cxx-cxxabi
2853
;;
2954
generic-cxx11)
3055
export CC=clang
3156
export CXX=clang++
32-
args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --xunit-xml-output test-results.xml")
33-
args+=("-C${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake")
57+
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake"
58+
check-cxx-cxxabi
3459
;;
3560
generic-cxx14)
3661
export CC=clang
3762
export CXX=clang++
38-
args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --xunit-xml-output test-results.xml")
39-
args+=("-C${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx14.cmake")
63+
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx14.cmake"
64+
check-cxx-cxxabi
4065
;;
4166
generic-cxx17)
4267
export CC=clang
4368
export CXX=clang++
44-
args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --xunit-xml-output test-results.xml")
45-
args+=("-C${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx17.cmake")
69+
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx17.cmake"
70+
check-cxx-cxxabi
4671
;;
4772
generic-cxx2a)
4873
export CC=clang
4974
export CXX=clang++
50-
args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --xunit-xml-output test-results.xml")
51-
args+=("-C${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx2a.cmake")
75+
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx2a.cmake"
76+
check-cxx-cxxabi
5277
;;
5378
generic-noexceptions)
5479
export CC=clang
5580
export CXX=clang++
56-
args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --xunit-xml-output test-results.xml")
57-
args+=("-C${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-noexceptions.cmake")
81+
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-noexceptions.cmake"
82+
check-cxx-cxxabi
5883
;;
5984
generic-32bit)
6085
export CC=clang
6186
export CXX=clang++
62-
args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --xunit-xml-output test-results.xml")
63-
args+=("-C${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-32bits.cmake")
87+
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-32bits.cmake"
88+
check-cxx-cxxabi
6489
;;
6590
generic-gcc)
6691
export CC=gcc
6792
export CXX=g++
6893
# FIXME: Re-enable experimental testing on GCC. GCC cares about the order
6994
# in which we link -lc++experimental, which causes issues.
70-
args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --param enable_experimental=False --xunit-xml-output test-results.xml")
95+
generate-cmake -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF
96+
check-cxx-cxxabi
7197
;;
7298
generic-asan)
7399
export CC=clang
74100
export CXX=clang++
75-
args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --xunit-xml-output test-results.xml")
76-
args+=("-C${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-asan.cmake")
101+
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-asan.cmake"
102+
check-cxx-cxxabi
77103
;;
78104
generic-msan)
79105
export CC=clang
80106
export CXX=clang++
81-
args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --xunit-xml-output test-results.xml")
82-
args+=("-C${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-msan.cmake")
107+
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-msan.cmake"
108+
check-cxx-cxxabi
83109
;;
84110
generic-tsan)
85111
export CC=clang
86112
export CXX=clang++
87-
args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --xunit-xml-output test-results.xml")
88-
args+=("-C${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-tsan.cmake")
113+
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-tsan.cmake"
114+
check-cxx-cxxabi
89115
;;
90116
generic-ubsan)
91117
export CC=clang
92118
export CXX=clang++
93-
args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --xunit-xml-output test-results.xml")
94-
args+=("-C${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-ubsan.cmake")
119+
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-ubsan.cmake"
120+
check-cxx-cxxabi
95121
;;
96122
generic-with_llvm_unwinder)
97123
export CC=clang
98124
export CXX=clang++
99-
args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --xunit-xml-output test-results.xml")
100-
args+=("-DLIBCXXABI_USE_LLVM_UNWINDER=ON")
125+
generate-cmake -DLIBCXXABI_USE_LLVM_UNWINDER=ON
126+
check-cxx-cxxabi
101127
;;
102128
generic-singlethreaded)
103129
export CC=clang
104130
export CXX=clang++
105-
args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --xunit-xml-output test-results.xml")
106-
args+=("-C${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-singlethreaded.cmake")
131+
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-singlethreaded.cmake"
132+
check-cxx-cxxabi
107133
;;
108134
generic-nodebug)
109135
export CC=clang
110136
export CXX=clang++
111-
args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --xunit-xml-output test-results.xml")
112-
args+=("-C${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-nodebug.cmake")
137+
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-nodebug.cmake"
138+
check-cxx-cxxabi
113139
;;
114140
generic-no-random_device)
115141
export CC=clang
116142
export CXX=clang++
117-
args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --xunit-xml-output test-results.xml")
118-
args+=("-C${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-random_device.cmake")
143+
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-random_device.cmake"
144+
check-cxx-cxxabi
119145
;;
120146
x86_64-apple-system)
121147
export CC=clang
122148
export CXX=clang++
123-
args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --xunit-xml-output test-results.xml")
124-
args+=("-C${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake")
149+
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake"
150+
check-cxx-cxxabi
125151
;;
126152
x86_64-apple-system-noexceptions)
127153
export CC=clang
128154
export CXX=clang++
129-
args+=("-DLLVM_LIT_ARGS=-sv --show-unsupported --xunit-xml-output test-results.xml")
130-
args+=("-C${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake")
131-
args+=("-DLIBCXX_ENABLE_EXCEPTIONS=OFF")
132-
args+=("-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF")
155+
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
156+
-DLIBCXX_ENABLE_EXCEPTIONS=OFF \
157+
-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF
158+
check-cxx-cxxabi
159+
;;
160+
benchmarks)
161+
export CC=clang
162+
export CXX=clang++
163+
generate-cmake
164+
check-cxx-benchmarks
133165
;;
134166
*)
135167
echo "${BUILDER} is not a known configuration"
136168
exit 1
137169
;;
138170
esac
139-
140-
echo "--- Generating CMake"
141-
rm -rf "${BUILD_DIR}"
142-
cmake -S "${MONOREPO_ROOT}/llvm" -B "${BUILD_DIR}" -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo "${args[@]}"
143-
144-
echo "--- Building libc++ and libc++abi"
145-
ninja -C "${BUILD_DIR}" check-cxx-deps cxxabi
146-
147-
echo "+++ Running the libc++ tests"
148-
ninja -C "${BUILD_DIR}" check-cxx
149-
150-
echo "+++ Running the libc++abi tests"
151-
ninja -C "${BUILD_DIR}" check-cxxabi
152-
153-
echo "+++ Installing libc++ and libc++abi to a fake location"
154-
ninja -C "${BUILD_DIR}" install-cxx install-cxxabi
155-
156-
# echo "+++ Running the libc++ benchmarks"
157-
# ninja -C "${BUILD_DIR}" check-cxx-benchmarks

libcxxabi/src/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,16 @@ if (LIBCXXABI_ENABLE_SHARED)
202202
list(APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_shared")
203203
endif()
204204

205+
add_library(cxxabi-reexports INTERFACE)
206+
205207
# -exported_symbols_list is only available on Apple platforms
206208
if (APPLE)
207209
function(export_symbols file)
208210
target_link_libraries(cxxabi_shared PRIVATE "-Wl,-exported_symbols_list,${file}")
209211
endfunction()
210212
function(reexport_symbols file)
211213
export_symbols("${file}")
212-
target_link_libraries(cxxabi_shared INTERFACE "-Wl,-reexported_symbols_list,${file}")
214+
target_link_libraries(cxxabi-reexports INTERFACE "-Wl,-reexported_symbols_list,${file}")
213215
endfunction()
214216

215217
export_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/itanium-base.exp")

0 commit comments

Comments
 (0)