Hi mclow.lists, danalbert, jroelofs,

Currently to run tests in tree you need to symlink the lit.site.cfg file 
generated by the cmake build into the source tree, and teach your VCS to ignore 
it.

This allows the user to specify where to find the lit.site.cfg file two 
different ways:
* lit_site_cfg lit parameter
* LIT_SITE_CFG enviroment variable. 

example usage:
```
lit -sv --param=libcxx_site_cfg=path/to/libcxx-build/test/lit.site.cfg 
path/to/tests
```
Or
```
export LIBCXX_SITE_CFG=path/to/libcxx-build/test/lit.site.cfg
lit -sv path/to/tests
```
The command line parameter will override the environment variable. 
If neither options are present a warning is issued and the `lit.cfg` file is 
loaded directly.

http://reviews.llvm.org/D6255

Files:
  test/lit.site.cfg
  www/index.html
Index: test/lit.site.cfg
===================================================================
--- /dev/null
+++ test/lit.site.cfg
@@ -0,0 +1,15 @@
+# -*- Python -*- vim: set syntax=python tabstop=4 expandtab cc=80:
+
+import os
+
+# Try getting the configuration from the libcxx_site_cfg parameter first
+# Then from the LIBCXX_SITE_CFG enviroment variable.
+cfg_path = lit_config.params.get('libcxx_site_cfg',
+                                 os.environ.get('LIBCXX_SITE_CFG'))
+if cfg_path is not None:
+    lit_config.note('Loading site configuration from: %s' % cfg_path)
+    lit_config.load_config(config, cfg_path)
+else:
+    lit_config.warning('Running lit.cfg without a site configuration')
+    main_cfg = os.path.join(os.path.dirname(__file__), 'lit.cfg')
+    lit_config.load_config(config, main_cfg)
Index: www/index.html
===================================================================
--- www/index.html
+++ www/index.html
@@ -222,8 +222,8 @@
   <ul>
     <li><code>cd path/to/libcxx/libcxx</code></li>
     <li><code>alias lit='python path/to/llvm/utils/lit/lit.py'</code></li>
-    <li><code>ln -s path/to/build/dir/projects/libcxx/test/lit.site.cfg
-        test/lit.site.cfg</code></li>
+    <li><code>export LIBCXX_SITE_CFG=path/to/libcxx-build/test/lit.site.cfg
+        </code></li>
     <li><code>lit -sv test/re/ # or whichever subset of tests you're interested
         in</code></li>
   </ul>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to