[PATCH] D38572: [cfi] Test on all available targets.
Evgenii Stepanov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 4 17:37:07 PDT 2017
eugenis created this revision.
Herald added a subscriber: mgorny.
Run CFI tests on all targets current toolchain can target.
On multiarch Linux, this will run all CFI tests with -m32 and -m64.
https://reviews.llvm.org/D38572
Files:
compiler-rt/test/cfi/CMakeLists.txt
compiler-rt/test/cfi/lit.cfg
compiler-rt/test/cfi/lit.site.cfg.in
Index: compiler-rt/test/cfi/lit.site.cfg.in
===================================================================
--- compiler-rt/test/cfi/lit.site.cfg.in
+++ compiler-rt/test/cfi/lit.site.cfg.in
@@ -2,6 +2,8 @@
config.name_suffix = "@CFI_TEST_CONFIG_SUFFIX@"
config.cfi_lit_test_mode = "@CFI_LIT_TEST_MODE@"
+config.target_arch = "@CFI_TEST_TARGET_ARCH@"
+config.target_cflags = "@CFI_TEST_TARGET_CFLAGS@"
config.use_lld = @CFI_TEST_USE_LLD@
config.use_thinlto = @CFI_TEST_USE_THINLTO@
Index: compiler-rt/test/cfi/lit.cfg
===================================================================
--- compiler-rt/test/cfi/lit.cfg
+++ compiler-rt/test/cfi/lit.cfg
@@ -5,12 +5,13 @@
config.suffixes = ['.c', '.cpp', '.test']
config.test_source_root = os.path.dirname(__file__)
-clangxx = ' '.join([config.clang] + config.cxx_mode_flags)
+clang = ' '.join([config.clang, config.target_cflags])
+clangxx = ' '.join([config.clang, config.target_cflags] + config.cxx_mode_flags)
-config.substitutions.append((r"%clang ", ' '.join([config.clang]) + ' '))
+config.substitutions.append((r"%clang ", clang + ' '))
config.substitutions.append((r"%clangxx ", clangxx + ' '))
if config.lto_supported:
- clang_cfi = ' '.join(config.lto_launch + [config.clang] + config.lto_flags + ['-fsanitize=cfi '])
+ clang_cfi = ' '.join(config.lto_launch + [clang] + config.lto_flags + ['-fsanitize=cfi '])
if config.cfi_lit_test_mode == "Devirt":
config.available_features.add('devirt')
Index: compiler-rt/test/cfi/CMakeLists.txt
===================================================================
--- compiler-rt/test/cfi/CMakeLists.txt
+++ compiler-rt/test/cfi/CMakeLists.txt
@@ -8,6 +8,7 @@
if (${thinlto})
set(suffix ${suffix}-thinlto)
endif()
+ set(suffix ${suffix}-${CFI_TEST_TARGET_ARCH})
set(CFI_TEST_USE_LLD ${lld})
set(CFI_TEST_USE_THINLTO ${thinlto})
@@ -29,22 +30,29 @@
list(APPEND CFI_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Devirt${suffix})
endmacro()
-if (APPLE)
- # FIXME: enable ThinLTO tests after fixing http://llvm.org/pr32741
- add_cfi_test_suites(False False)
-elseif(WIN32)
- add_cfi_test_suites(True False)
- add_cfi_test_suites(True True)
-else()
- if (CFI_SUPPORTED_ARCH)
+set(CFI_TEST_ARCH ${CFI_SUPPORTED_ARCH})
+if(APPLE)
+ darwin_filter_host_archs(CFI_SUPPORTED_ARCH CFI_TEST_ARCH)
+endif()
+
+foreach(arch ${CFI_TEST_ARCH})
+ set(CFI_TEST_TARGET_ARCH ${arch})
+ get_test_cc_for_arch(${arch} CFI_TEST_TARGET_CC CFI_TEST_TARGET_CFLAGS)
+ if (APPLE)
+ # FIXME: enable ThinLTO tests after fixing http://llvm.org/pr32741
+ add_cfi_test_suites(False False)
+ elseif(WIN32)
+ add_cfi_test_suites(True False)
+ add_cfi_test_suites(True True)
+ else()
add_cfi_test_suites(False False)
add_cfi_test_suites(False True)
if (COMPILER_RT_HAS_LLD)
add_cfi_test_suites(True False)
add_cfi_test_suites(True True)
endif()
endif()
-endif()
+endforeach()
set(CFI_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
list(APPEND CFI_TEST_DEPS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38572.117769.patch
Type: text/x-patch
Size: 3029 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171005/c039afe4/attachment.bin>
More information about the llvm-commits
mailing list