Skip to content

Commit 851bfc0

Browse files
committed
[libc++abi] Use from-scratch testing configs for libc++abi by default
Like we have been doing for libc++ for a while now, start using from-scratch testing configurations for libc++abi. As a fly-by fix, remove the LIBCXXABI_NO_TIMER macro, which was defined but never used. Differential Revision: https://reviews.llvm.org/D125242
1 parent f366acd commit 851bfc0

21 files changed

+223
-29
lines changed

libcxxabi/CMakeLists.txt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,24 @@ endif()
143143
option(LIBCXXABI_HERMETIC_STATIC_LIBRARY
144144
"Do not export any symbols from the static library." ${LIBCXXABI_HERMETIC_STATIC_LIBRARY_DEFAULT})
145145

146-
set(LIBCXXABI_TEST_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/test/lit.site.cfg.in" CACHE STRING
146+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
147+
set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-shared-gcc.cfg.in")
148+
elseif(MINGW)
149+
set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-mingw.cfg.in")
150+
elseif(WIN32) # clang-cl
151+
if (LIBCXXABI_ENABLE_SHARED)
152+
set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-shared-clangcl.cfg.in")
153+
else()
154+
set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-static-clangcl.cfg.in")
155+
endif()
156+
else()
157+
if (LIBCXXABI_ENABLE_SHARED)
158+
set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-shared.cfg.in")
159+
else()
160+
set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-static.cfg.in")
161+
endif()
162+
endif()
163+
set(LIBCXXABI_TEST_CONFIG "${LIBCXXABI_DEFAULT_TEST_CONFIG}" CACHE STRING
147164
"The path to the Lit testing configuration to use when running the tests.
148165
If a relative path is provided, it is assumed to be relative to '<monorepo>/libcxxabi/test/configs'.")
149166
if (NOT IS_ABSOLUTE "${LIBCXXABI_TEST_CONFIG}")

libcxxabi/test/configs/apple-libc++abi-backdeployment.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ config.substitutions.append(('%{flags}',
4545
'-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else ''
4646
))
4747
config.substitutions.append(('%{compile_flags}',
48-
'-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} -DLIBCXXABI_NO_TIMER -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' +
48+
'-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' +
4949
'-I %{libcxx}/test/support -I %{libcxx}/src'
5050
))
5151
config.substitutions.append(('%{link_flags}',

libcxxabi/test/configs/apple-libc++abi-shared.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ config.substitutions.append(('%{flags}',
66
'-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else ''
77
))
88
config.substitutions.append(('%{compile_flags}',
9-
'-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} -DLIBCXXABI_NO_TIMER -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' +
9+
'-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' +
1010
'-I %{libcxx}/test/support -I %{libcxx}/src'
1111
))
1212
config.substitutions.append(('%{link_flags}',

libcxxabi/test/configs/cmake-bridge.cfg.in

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ config.substitutions.append(('%{cxx}', '@CMAKE_CXX_COMPILER@'))
3030
config.substitutions.append(('%{libcxx}', '@LIBCXXABI_LIBCXX_PATH@'))
3131
config.substitutions.append(('%{include}', '@LIBCXXABI_SOURCE_DIR@/include'))
3232
config.substitutions.append(('%{cxx-include}', '@LIBCXXABI_HEADER_DIR@/include/c++/v1'))
33-
config.substitutions.append(('%{cxx-target-include}', '@LIBCXXABI_HEADER_DIR@/%{triple}/include/c++/v1'))
33+
config.substitutions.append(('%{cxx-target-include}', '@LIBCXXABI_HEADER_DIR@/include/%{triple}/c++/v1'))
3434
config.substitutions.append(('%{lib}', '@LIBCXXABI_LIBRARY_DIR@'))
3535
config.substitutions.append(('%{executor}', '@LIBCXXABI_EXECUTOR@'))
36+
37+
if @LIBCXXABI_USE_LLVM_UNWINDER@:
38+
config.substitutions.append(('%{maybe-include-libunwind}', '-I "@LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL@"'))
39+
else:
40+
config.substitutions.append(('%{maybe-include-libunwind}', ''))

libcxxabi/test/configs/ibm-libc++abi-shared.cfg.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
44

55
config.substitutions.append(('%{flags}',''))
66
config.substitutions.append(('%{compile_flags}',
7-
'-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} ' +
8-
'-D__LIBC_NO_CPP_MATH_OVERLOADS__ -DLIBCXXABI_NO_TIMER ' +
7+
'-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} ' +
8+
'-D__LIBC_NO_CPP_MATH_OVERLOADS__ ' +
99
'-D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' +
1010
'-I %{libcxx}/test/support -I %{libcxx}/src'
1111
))

libcxxabi/test/configs/llvm-libc++abi-merged.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ config.substitutions.append(('%{flags}',
66
'-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else ''
77
))
88
config.substitutions.append(('%{compile_flags}',
9-
'-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} -DLIBCXXABI_NO_TIMER -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' +
9+
'-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' +
1010
'-I %{libcxx}/test/support -I %{libcxx}/src'
1111
))
1212
config.substitutions.append(('%{link_flags}',
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This testing configuration handles running the test suite against LLVM's libc++abi
2+
# using either a DLL or a static library, with MinGW/Clang on Windows.
3+
4+
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
5+
6+
config.substitutions.append(('%{flags}', ''))
7+
config.substitutions.append(('%{compile_flags}',
8+
'-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -I %{libcxx}/test/support -I %{libcxx}/src -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS'
9+
))
10+
config.substitutions.append(('%{link_flags}',
11+
'-nostdlib++ -L %{lib} -lc++ -lc++abi'
12+
))
13+
config.substitutions.append(('%{exec}',
14+
'%{executor} --execdir %T --env PATH=%{lib} -- '
15+
))
16+
17+
import os, site
18+
site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils'))
19+
import libcxx.test.params, libcxx.test.newconfig
20+
libcxx.test.newconfig.configure(
21+
libcxx.test.params.DEFAULT_PARAMETERS,
22+
libcxx.test.features.DEFAULT_FEATURES,
23+
config,
24+
lit_config
25+
)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This testing configuration handles running the test suite against LLVM's libc++abi
2+
# using a DLL, with Clang-cl on Windows.
3+
4+
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
5+
6+
config.substitutions.append(('%{flags}', '--driver-mode=g++'))
7+
config.substitutions.append(('%{compile_flags}',
8+
'-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -I %{libcxx}/test/support -I %{libcxx}/src -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX'
9+
))
10+
config.substitutions.append(('%{link_flags}',
11+
'-nostdlib -L %{lib} -lc++ -lc++abi -lmsvcrt -lmsvcprt -loldnames'
12+
))
13+
config.substitutions.append(('%{exec}',
14+
'%{executor} --execdir %T --env PATH=%{lib} -- '
15+
))
16+
17+
import os, site
18+
site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils'))
19+
import libcxx.test.params, libcxx.test.newconfig
20+
libcxx.test.newconfig.configure(
21+
libcxx.test.params.DEFAULT_PARAMETERS,
22+
libcxx.test.features.DEFAULT_FEATURES,
23+
config,
24+
lit_config
25+
)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# This testing configuration handles running the test suite against LLVM's libc++abi
2+
# using a shared library, with GCC. This is done differently from Clang because
3+
# GCC does not support the -nostdlib++ command-line flag.
4+
5+
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
6+
7+
config.substitutions.append(('%{flags}', ''))
8+
config.substitutions.append(('%{compile_flags}',
9+
'-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -I %{libcxx}/test/support -I %{libcxx}/src -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS'
10+
))
11+
config.substitutions.append(('%{link_flags}',
12+
'-L %{lib} -Wl,-rpath,%{lib} -nodefaultlibs -lc++ -lc++abi -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc -latomic'
13+
))
14+
config.substitutions.append(('%{exec}',
15+
'%{executor} --execdir %T -- '
16+
))
17+
18+
import os, site
19+
site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils'))
20+
import libcxx.test.params, libcxx.test.newconfig
21+
libcxx.test.newconfig.configure(
22+
libcxx.test.params.DEFAULT_PARAMETERS,
23+
libcxx.test.features.DEFAULT_FEATURES,
24+
config,
25+
lit_config
26+
)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This testing configuration handles running the test suite against LLVM's libc++abi
2+
# using a shared library.
3+
4+
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
5+
6+
config.substitutions.append(('%{flags}',
7+
'-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else ''
8+
))
9+
config.substitutions.append(('%{compile_flags}',
10+
'-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -I %{libcxx}/test/support -I %{libcxx}/src -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS'
11+
))
12+
config.substitutions.append(('%{link_flags}',
13+
'-nostdlib++ -L %{lib} -Wl,-rpath,%{lib} -lc++ -lc++abi -pthread'
14+
))
15+
config.substitutions.append(('%{exec}',
16+
'%{executor} --execdir %T -- '
17+
))
18+
19+
import os, site
20+
site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils'))
21+
import libcxx.test.params, libcxx.test.newconfig
22+
libcxx.test.newconfig.configure(
23+
libcxx.test.params.DEFAULT_PARAMETERS,
24+
libcxx.test.features.DEFAULT_FEATURES,
25+
config,
26+
lit_config
27+
)

0 commit comments

Comments
 (0)