[cfe-commits] [libcxx] r168749 - /libcxx/trunk/test/lit.cfg

Daniel Dunbar daniel at zuster.org
Tue Nov 27 15:56:28 PST 2012


Author: ddunbar
Date: Tue Nov 27 17:56:28 2012
New Revision: 168749

URL: http://llvm.org/viewvc/llvm-project?rev=168749&view=rev
Log:
tests/lit: Change test default parameters to assume local build.
 - Also, support overriding them with lit parameters.

Modified:
    libcxx/trunk/test/lit.cfg

Modified: libcxx/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/lit.cfg?rev=168749&r1=168748&r2=168749&view=diff
==============================================================================
--- libcxx/trunk/test/lit.cfg (original)
+++ libcxx/trunk/test/lit.cfg Tue Nov 27 17:56:28 2012
@@ -114,31 +114,42 @@
 # test_source_root: The root path where tests are located.
 config.test_source_root = os.path.dirname(__file__)
 
-# FIXME: Would be nice to Use -stdlib=libc++ option with Clang's that accept it.
+# Gather various compiler parameters.
 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++)')
-include_paths = []
-library_paths = []
 
-libcxx_src_root = getattr(config, 'libcxx_src_root', None)
-if libcxx_src_root is not None:
-  include_paths += ['-I' + libcxx_src_root + '/include']
+libcxx_src_root = lit.params.get('libcxx_src_root', None)
+if libcxx_src_root is None:
+    libcxx_src_root = getattr(config, 'libcxx_src_root', None)
+    if libcxx_src_root is None:
+        libcxx_src_root = os.path.dirname(config.test_source_root)
+
+libcxx_obj_root = lit.params.get('libcxx_obj_root', None)
+if libcxx_obj_root is None:
+    libcxx_obj_root = getattr(config, 'libcxx_obj_root', None)
+    if libcxx_obj_root is None:
+        libcxx_obj_root = libcxx_src_root
+
+cxx_has_stdcxx0x_flag_str = lit.params.get('cxx_has_stdcxx0x_flag', None)
+if cxx_has_stdcxx0x_flag_str is not None:
+    if cxx_has_stdcxx0x_flag_str in ('1', 'True'):
+        cxx_has_stdcxx0x_flag = True
+    elif cxx_has_stdcxx0x_flag_str in ('', '0', 'False'):
+        cxx_has_stdcxx0x_flag = False
+    else:
+        lit.fatal('user parameter cxx_has_stdcxx0x_flag_str should be 0 or 1')
 else:
-  include_paths += ['-I/usr/include/c++/v1']
-
-libcxx_obj_root = getattr(config, 'libcxx_obj_root', None)
-if libcxx_obj_root is not None:
-  library_paths += ['-L' + libcxx_obj_root + '/lib']
-else:
-  libcxx_obj_root = "/usr"
+    cxx_has_stdcxx0x_flag = getattr(config, 'cxx_has_stdcxx0x_flag', True)
 
 # Configure extra compiler flags.
+include_paths = ['-I' + libcxx_src_root + '/include']
+library_paths = ['-L' + libcxx_obj_root + '/lib']
 compile_flags = []
-if getattr(config, 'cxx_has_stdcxx0x_flag', False):
+if cxx_has_stdcxx0x_flag:
   compile_flags += ['-std=c++0x']
 
 # Configure extra libraries.
@@ -149,8 +160,9 @@
   libraries += ['-lgcc_eh', '-lsupc++', '-lc', '-lm', '-lrt', '-lgcc_s']
   libraries += ['-Wl,-R', libcxx_obj_root + '/lib']
 
-config.test_format = LibcxxTestFormat(cxx_under_test,
-                                      cpp_flags = ['-nostdinc++'] + compile_flags + include_paths,
-                                      ld_flags = ['-nodefaultlibs'] + library_paths + ['-lc++'] + libraries)
+config.test_format = LibcxxTestFormat(
+    cxx_under_test,
+    cpp_flags = ['-nostdinc++'] + compile_flags + include_paths,
+    ld_flags = ['-nodefaultlibs'] + library_paths + ['-lc++'] + libraries)
 
 config.target_triple = None





More information about the cfe-commits mailing list