Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / asan / Unit / lit.site.cfg.py.in
blob638e1dedfc1d2ff65ddcf423ed921e4aa9498c28
1 @LIT_SITE_CFG_IN_HEADER@
3 import os
4 import platform
5 import re
6 import shlex
8 # Load common config for all compiler-rt unit tests.
9 lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/unittests/lit.common.unit.configured")
11 def push_ld_library_path(config, new_path):
12 new_ld_library_path = os.path.pathsep.join(
13 (new_path, config.environment.get('LD_LIBRARY_PATH', '')))
14 config.environment['LD_LIBRARY_PATH'] = new_ld_library_path
16 if platform.system() == 'FreeBSD':
17 new_ld_32_library_path = os.path.pathsep.join(
18 (new_path, config.environment.get('LD_32_LIBRARY_PATH', '')))
19 config.environment['LD_32_LIBRARY_PATH'] = new_ld_32_library_path
21 if platform.system() == 'SunOS':
22 new_ld_library_path_32 = os.path.pathsep.join(
23 (new_path, config.environment.get('LD_LIBRARY_PATH_32', '')))
24 config.environment['LD_LIBRARY_PATH_32'] = new_ld_library_path_32
26 new_ld_library_path_64 = os.path.pathsep.join(
27 (new_path, config.environment.get('LD_LIBRARY_PATH_64', '')))
28 config.environment['LD_LIBRARY_PATH_64'] = new_ld_library_path_64
30 # Setup config name.
31 config.name = 'AddressSanitizer-Unit'
33 # Load target architecture information. Note config.target_triple can be
34 # incorrect since it is populated with the default target. This unit test suite
35 # may run for multiple targets. The dynamic suite needs the correct target for
36 # library path selection.
37 config.target_arch = "@arch@"
39 # Setup test source and exec root. For unit tests, we define
40 # it as build directory with ASan unit tests.
41 # FIXME: De-hardcode this path.
42 if @ASAN_TEST_DYNAMIC@:
43 test_dir = "@CONFIG_NAME_DYNAMIC@"
44 else:
45 test_dir = "@CONFIG_NAME@"
46 config.test_exec_root = os.path.join("@COMPILER_RT_BINARY_DIR@",
47 "lib", "asan", "tests", test_dir)
49 config.test_source_root = config.test_exec_root
51 # When LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on, the initial value of
52 # config.compiler_rt_libdir (COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR) has the
53 # host triple as the trailing path component. The value is incorrect for i386
54 # tests on x86_64 hosts and vice versa. Adjust config.compiler_rt_libdir
55 # accordingly.
56 if config.enable_per_target_runtime_dir and config.target_arch != config.host_arch:
57 if config.target_arch == 'i386':
58 config.compiler_rt_libdir = re.sub(r'/x86_64(?=-[^/]+$)', '/i386', config.compiler_rt_libdir)
59 elif config.target_arch == 'x86_64':
60 config.compiler_rt_libdir = re.sub(r'/i386(?=-[^/]+$)', '/x86_64', config.compiler_rt_libdir)
62 # Set LD_LIBRARY_PATH to pick dynamic runtime up properly.
63 push_ld_library_path(config, config.compiler_rt_libdir)
65 if not config.parallelism_group:
66 config.parallelism_group = 'shadow-memory'