[tests] Infer the cxx_under_test (as clang++).
authorDaniel Dunbar <daniel@zuster.org>
Wed, 6 Feb 2013 20:24:23 +0000 (20:24 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 6 Feb 2013 20:24:23 +0000 (20:24 +0000)
 - This is a reasonable default, and makes testing just work with no required
   parameters.

 - Add notes on all of the inferred or default values.

llvm-svn: 174538

libcxx/test/lit.cfg

index 4b91708..7d8e518 100644 (file)
@@ -209,9 +209,15 @@ config.test_source_root = os.path.dirname(__file__)
 cxx_under_test = lit.params.get('cxx_under_test', None)
 if cxx_under_test is None:
     cxx_under_test = getattr(config, 'cxx_under_test', None)
-    if cxx_under_test is None:
-        lit.fatal('must specify user parameter cxx_under_test '
-                  '(e.g., --param=cxx_under_test=clang++)')
+
+    # If no specific cxx_under_test was given, attempt to infer it as clang++.
+    clangxx = lit.util.which('clang++', config.environment['PATH'])
+    if clangxx is not None:
+        cxx_under_test = clangxx
+        lit.note("inferred cxx_under_test as: %r" % (cxx_under_test,))
+if cxx_under_test is None:
+    lit.fatal('must specify user parameter cxx_under_test '
+              '(e.g., --param=cxx_under_test=clang++)')
 
 libcxx_src_root = lit.params.get('libcxx_src_root', None)
 if libcxx_src_root is None:
@@ -250,6 +256,7 @@ if use_system_lib_str is not None:
 else:
     # Default to testing against the locally built libc++ library.
     use_system_lib = False
+    lit.note("inferred use_system_lib as: %r" % (use_system_lib,))
 
 # Configure extra compiler flags.
 include_paths = ['-I' + libcxx_src_root + '/include', '-I' + libcxx_src_root + '/test/support']
@@ -284,7 +291,7 @@ config.target_triple = lit.params.get('target_triple', None)
 if config.target_triple is None:
     config.target_triple = lit.util.capture(
         [cxx_under_test, '-dumpmachine']).strip()
-    lit.note("inferred target triple as: %r" % (config.target_triple,))
+    lit.note("inferred target_triple as: %r" % (config.target_triple,))
 
 # Write an "available feature" that combines the triple when use_system_lib is
 # enabled. This is so that we can easily write XFAIL markers for tests that are