[lld] r202101 - [test] use llvm-config to drive testing in assert mode/debug mode

Shankar Easwaran shankare at codeaurora.org
Mon Feb 24 18:29:18 PST 2014


Author: shankare
Date: Mon Feb 24 20:29:17 2014
New Revision: 202101

URL: http://llvm.org/viewvc/llvm-project?rev=202101&view=rev
Log:
[test] use llvm-config to drive testing in assert mode/debug mode

Modified:
    lld/trunk/test/CMakeLists.txt
    lld/trunk/test/lit.cfg

Modified: lld/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/CMakeLists.txt?rev=202101&r1=202100&r2=202101&view=diff
==============================================================================
--- lld/trunk/test/CMakeLists.txt (original)
+++ lld/trunk/test/CMakeLists.txt Mon Feb 24 20:29:17 2014
@@ -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
     )

Modified: lld/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/lit.cfg?rev=202101&r1=202100&r2=202101&view=diff
==============================================================================
--- lld/trunk/test/lit.cfg (original)
+++ lld/trunk/test/lit.cfg Mon Feb 24 20:29:17 2014
@@ -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'])





More information about the llvm-commits mailing list