diff --git a/lld/test/CMakeLists.txt b/lld/test/CMakeLists.txt index 7406a2b66146..4d14570a51ef 100644 --- a/lld/test/CMakeLists.txt +++ b/lld/test/CMakeLists.txt @@ -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 ) diff --git a/lld/test/lit.cfg b/lld/test/lit.cfg index 1580025b8d96..bae7b520f391 100644 --- a/lld/test/lit.cfg +++ b/lld/test/lit.cfg @@ -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'])