Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / profile / Linux / lit.local.cfg.py
blobc1e89581a1ab9dedaf45ff5934e594b68ce71501
1 import subprocess
4 def getRoot(config):
5 if not config.parent:
6 return config
7 return getRoot(config.parent)
10 def is_gold_linker_available():
12 if not config.gold_executable:
13 return False
14 try:
15 ld_cmd = subprocess.Popen(
16 [config.gold_executable, "--help"], stdout=subprocess.PIPE
18 ld_out = ld_cmd.stdout.read().decode()
19 ld_cmd.wait()
20 except:
21 return False
23 if not "-plugin" in ld_out:
24 return False
26 # config.clang is not guaranteed to be just the executable!
27 clang_cmd = subprocess.Popen(
28 " ".join([config.clang, "-fuse-ld=gold", "-xc", "-"]),
29 shell=True,
30 universal_newlines=True,
31 stdin=subprocess.PIPE,
32 stdout=subprocess.PIPE,
33 stderr=subprocess.PIPE,
35 clang_err = clang_cmd.communicate("int main() { return 0; }")[1]
37 if not "invalid linker" in clang_err:
38 return True
40 return False
43 root = getRoot(config)
45 if root.host_os not in ["Linux"] or not is_gold_linker_available():
46 config.unsupported = True
48 if config.have_curl:
49 config.available_features.add("curl")