[test] use llvm-config to drive testing in assert mode/debug mode
llvm-svn: 202101
This commit is contained in:
parent
822ea4f9a3
commit
7a0818dd4a
|
@ -24,7 +24,7 @@ if ( NOT LLD_BUILT_STANDALONE )
|
|||
set(LLD_TEST_DEPS
|
||||
lld-test.deps
|
||||
FileCheck not llvm-nm
|
||||
lld llc llvm-objdump llvm-readobj llvm-mc yaml2obj
|
||||
lld llvm-config llvm-objdump llvm-readobj llvm-mc yaml2obj
|
||||
linker-script-test
|
||||
LLDUnitTests
|
||||
)
|
||||
|
|
|
@ -120,21 +120,26 @@ if lit_config.useValgrind:
|
|||
if platform.system() not in ['Windows'] or lit_config.getBashPath() != '':
|
||||
config.available_features.add('shell')
|
||||
|
||||
# llc knows whether it is compiled with -DNDEBUG.
|
||||
# llvm-config knows whether it is compiled with asserts (and)
|
||||
# whether we are operating in release/debug mode.
|
||||
import subprocess
|
||||
try:
|
||||
llc_cmd = subprocess.Popen([os.path.join(llvm_tools_dir, 'llc'), '-version'],
|
||||
stdout = subprocess.PIPE)
|
||||
llvm_config_cmd = \
|
||||
subprocess.Popen([os.path.join(llvm_tools_dir, 'llvm-config'),
|
||||
'--build-mode', '--assertion-mode'],
|
||||
stdout = subprocess.PIPE)
|
||||
except OSError, why:
|
||||
print "Could not find llc in " + llvm_tools_dir
|
||||
print "Could not find llvm-config in " + llvm_tools_dir
|
||||
exit(42)
|
||||
|
||||
llc_output = llc_cmd.stdout.read()
|
||||
if re.search(r'DEBUG', llc_output):
|
||||
llvm_config_output = llvm_config_cmd.stdout.read()
|
||||
llvm_config_output_list = llvm_config_output.split("\n")
|
||||
|
||||
if re.search(r'DEBUG', llvm_config_output_list[0]):
|
||||
config.available_features.add('debug')
|
||||
if re.search(r'with assertions', llc_output):
|
||||
if re.search(r'ON', llvm_config_output_list[1]):
|
||||
config.available_features.add('asserts')
|
||||
llc_cmd.wait()
|
||||
llvm_config_cmd.wait()
|
||||
|
||||
# Check if Windows resource file compiler exists.
|
||||
cvtres = lit.util.which('cvtres', config.environment['PATH'])
|
||||
|
|
Loading…
Reference in New Issue