Skip to content

Commit 6fd55bb

Browse files
committed
[libunwind] Add a from-scratch config for running libunwind tests
Running tests for libunwind is a lot simpler than running tests for libc++, so a simple Lit config file is sufficient. The benefit is that we disentangle the libunwind test configuration from the libc++ and libc++abi test configuration. The setup was too complicated, which led to some bugs (notably we were running against the system libunwind on Apple platforms). Differential Revision: https://reviews.llvm.org/D111664
1 parent cf68e1b commit 6fd55bb

12 files changed

+212
-62
lines changed

libcxx/utils/ci/run-buildbot

Lines changed: 72 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -199,182 +199,210 @@ check-generated-output)
199199
generic-cxx03)
200200
clean
201201
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake" \
202-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
202+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
203+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
203204
check-runtimes
204205
check-abi-list
205206
;;
206207
generic-cxx11)
207208
clean
208209
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake" \
209-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
210+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
211+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
210212
check-runtimes
211213
check-abi-list
212214
;;
213215
generic-cxx14)
214216
clean
215217
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx14.cmake" \
216-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
218+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
219+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
217220
check-runtimes
218221
check-abi-list
219222
;;
220223
generic-cxx17)
221224
clean
222225
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx17.cmake" \
223-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
226+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
227+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
224228
check-runtimes
225229
check-abi-list
226230
;;
227231
generic-cxx20)
228232
clean
229233
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx20.cmake" \
230-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
234+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
235+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
231236
check-runtimes
232237
check-abi-list
233238
;;
234239
generic-cxx2b)
235240
clean
236241
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx2b.cmake" \
237-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
242+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
243+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
238244
check-runtimes
239245
check-abi-list
240246
;;
241247
generic-assertions)
242248
clean
243249
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-assertions.cmake" \
244-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
250+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
251+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
245252
check-runtimes
246253
check-abi-list
247254
;;
248255
generic-debug-iterators)
249256
clean
250257
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-debug-iterators.cmake" \
251-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
258+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
259+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
252260
check-runtimes
253261
check-abi-list
254262
;;
255263
generic-noexceptions)
256264
clean
257265
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-noexceptions.cmake" \
258-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
266+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
267+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
259268
check-runtimes
260269
;;
261270
generic-modules)
262271
clean
263272
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules.cmake" \
264-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
273+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
274+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
265275
check-runtimes
266276
;;
267277
generic-static)
268278
clean
269279
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-static.cmake" \
270-
-DLIBCXX_TEST_CONFIG="llvm-libc++-static.cfg.in"
280+
-DLIBCXX_TEST_CONFIG="llvm-libc++-static.cfg.in" \
281+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-static.cfg.in"
271282
check-runtimes
272283
;;
273284
generic-32bit)
274285
clean
275286
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-32bits.cmake" \
276-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
287+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
288+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
277289
check-runtimes
278290
;;
279291
generic-clang-11)
280292
export CC=clang-11
281293
export CXX=clang++-11
282294
clean
283-
generate-cmake -DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
295+
generate-cmake -DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
296+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
284297
check-runtimes
285298
;;
286299
generic-clang-12)
287300
export CC=clang-12
288301
export CXX=clang++-12
289302
clean
290-
generate-cmake -DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
303+
generate-cmake -DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
304+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
291305
check-runtimes
292306
;;
293307
generic-gcc)
294308
export CC=gcc-11
295309
export CXX=g++-11
296310
clean
297-
generate-cmake -DLIBCXX_TEST_CONFIG="llvm-libc++-shared-gcc.cfg.in"
311+
generate-cmake -DLIBCXX_TEST_CONFIG="llvm-libc++-shared-gcc.cfg.in" \
312+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
298313
check-runtimes
299314
;;
300315
generic-gcc-cxx11)
301316
export CC=gcc-11
302317
export CXX=g++-11
303318
clean
304319
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake" \
305-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared-gcc.cfg.in"
320+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared-gcc.cfg.in" \
321+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
306322
check-runtimes
307323
;;
308324
generic-asan)
309325
clean
310326
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-asan.cmake" \
311-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
327+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
328+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
312329
check-runtimes
313330
;;
314331
generic-msan)
315332
clean
316333
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-msan.cmake" \
317-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
334+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
335+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
318336
check-runtimes
319337
;;
320338
generic-tsan)
321339
clean
322340
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-tsan.cmake" \
323-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
341+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
342+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
324343
check-runtimes
325344
;;
326345
generic-ubsan)
327346
clean
328347
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-ubsan.cmake" \
329-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
348+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
349+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
330350
check-runtimes
331351
;;
332352
generic-with_llvm_unwinder)
333353
clean
334354
generate-cmake -DLIBCXXABI_USE_LLVM_UNWINDER=ON \
335-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
355+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
356+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
336357
check-runtimes
337358
;;
338359
generic-singlethreaded)
339360
clean
340361
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-singlethreaded.cmake" \
341-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
362+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
363+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
342364
check-runtimes
343365
;;
344366
generic-no-debug)
345367
clean
346368
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-debug.cmake" \
347-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
369+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
370+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
348371
check-runtimes
349372
;;
350373
generic-no-filesystem)
351374
clean
352375
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-filesystem.cmake" \
353-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
376+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
377+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
354378
check-runtimes
355379
;;
356380
generic-no-random_device)
357381
clean
358382
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-random_device.cmake" \
359-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
383+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
384+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
360385
check-runtimes
361386
;;
362387
generic-no-localization)
363388
clean
364389
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-localization.cmake" \
365-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
390+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
391+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
366392
check-runtimes
367393
;;
368394
generic-no-unicode)
369395
clean
370396
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-unicode.cmake" \
371-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
397+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
398+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
372399
check-runtimes
373400
;;
374401
generic-no-wide-characters)
375402
clean
376403
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-wide-characters.cmake" \
377-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
404+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
405+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
378406
check-runtimes
379407
;;
380408
apple-system)
@@ -427,7 +455,8 @@ apple-system-backdeployment-*)
427455
;;
428456
benchmarks)
429457
clean
430-
generate-cmake -DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
458+
generate-cmake -DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
459+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
431460
check-cxx-benchmarks
432461
;;
433462
documentation)
@@ -456,7 +485,8 @@ runtimes-build)
456485
-DLLVM_RUNTIME_TARGETS="x86_64-unknown-linux-gnu" \
457486
-DLLVM_ENABLE_ASSERTIONS=ON \
458487
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules.cmake" \
459-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
488+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
489+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
460490

461491
echo "+++ Running the libc++ and libc++abi tests"
462492
${NINJA} -C "${BUILD_DIR}" check-runtimes
@@ -528,41 +558,47 @@ legacy-standalone)
528558
aarch64)
529559
clean
530560
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake" \
531-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
561+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
562+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
532563
check-runtimes
533564
;;
534565
aarch64-noexceptions)
535566
clean
536567
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake" \
537568
-DLIBCXX_ENABLE_EXCEPTIONS=OFF \
538569
-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF \
539-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
570+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
571+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
540572
check-runtimes
541573
;;
542574
# Aka Armv8 32 bit
543575
armv8)
544576
clean
545577
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Arm.cmake" \
546-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
578+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
579+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
547580
check-runtimes
548581
;;
549582
armv8-noexceptions)
550583
clean
551584
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Thumb-noexceptions.cmake" \
552-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
585+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
586+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
553587
check-runtimes
554588
;;
555589
# Armv7 32 bit. One building Arm only one Thumb only code.
556590
armv7)
557591
clean
558592
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Arm.cmake" \
559-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
593+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
594+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
560595
check-runtimes
561596
;;
562597
armv7-noexceptions)
563598
clean
564599
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Thumb-noexceptions.cmake" \
565-
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in"
600+
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
601+
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in"
566602
check-runtimes
567603
;;
568604
windows-dll)

libcxx/utils/libcxx/test/dsl.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,20 @@ def compilerMacros(config, flags=''):
194194
195195
If the optional `flags` argument (a string) is provided, these flags will
196196
be added to the compiler invocation when generating the macros.
197+
198+
If we fail to extract the compiler macros because of a compiler error, None
199+
is returned instead.
197200
"""
198201
with _makeConfigTest(config) as test:
199202
with open(test.getSourcePath(), 'w') as sourceFile:
200203
# Make sure files like <__config> are included, since they can define
201204
# additional macros.
202-
sourceFile.write("#include <cstddef>")
205+
sourceFile.write("#include <stddef.h>")
203206
unparsedOutput, err, exitCode, timeoutInfo = _executeScriptInternal(test, [
204207
"%{{cxx}} %s -dM -E %{{flags}} %{{compile_flags}} {}".format(flags)
205208
])
209+
if exitCode != 0:
210+
return None
206211
parsedMacros = dict()
207212
defines = (l.strip() for l in unparsedOutput.split('\n') if l.startswith('#define '))
208213
for line in defines:

libunwind/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ set(LIBUNWIND_TEST_COMPILER_FLAGS "" CACHE STRING
8989
"Additional compiler flags for test programs.")
9090
set(LIBUNWIND_TEST_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/test/lit.site.cfg.in" CACHE STRING
9191
"The path to the Lit testing configuration to use when running the tests.
92-
If a relative path is provided, it is assumed to be relative to '<monorepo>/libcxx/test/configs'.")
92+
If a relative path is provided, it is assumed to be relative to '<monorepo>/libunwind/test/configs'.")
9393
if (NOT IS_ABSOLUTE "${LIBUNWIND_TEST_CONFIG}")
94-
set(LIBUNWIND_TEST_CONFIG "${LIBUNWIND_LIBCXX_PATH}/test/configs/${LIBUNWIND_TEST_CONFIG}")
94+
set(LIBUNWIND_TEST_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/test/configs/${LIBUNWIND_TEST_CONFIG}")
9595
endif()
9696
set(LIBUNWIND_TEST_PARAMS "" CACHE STRING
9797
"A list of parameters to run the Lit test suite with.")

0 commit comments

Comments
 (0)