Add error handling for when a bad lit.site.cfg value is found.

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,17 @@
+# -*- Python -*- vim: set syntax=python tabstop=4 expandtab cc=80:
+
+import os
+
+# Try getting the site 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:
+    if not os.exists(cfg_path):
+        lit_config.fatal("No site configuration exists at '%s'" % cfg_path)
+    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