Make it easier to run the libc++ test suite against libstdc++

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283958 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/lit.cfg b/test/lit.cfg
index f7fa614..af41f6c 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -20,20 +20,24 @@
 # test_source_root: The root path where tests are located.
 config.test_source_root = os.path.dirname(__file__)
 
+loaded_site_cfg = getattr(config, 'loaded_site_config', False)
+if not loaded_site_cfg:
+    import libcxx.test.config
+    libcxx.test.config.loadSiteConfig(lit_config, config, 'libcxx_site_config',
+                                      'LIBCXX_SITE_CONFIG')
+
 # Infer the test_exec_root from the libcxx_object root.
 obj_root = getattr(config, 'libcxx_obj_root', None)
 
 # Check that the test exec root is known.
 if obj_root is None:
-    import libcxx.test.config
-    libcxx.test.config.loadSiteConfig(lit_config, config, 'libcxx_site_config',
-                                      'LIBCXX_SITE_CONFIG')
     obj_root = getattr(config, 'libcxx_obj_root', None)
     if obj_root is None:
         import tempfile
         obj_root = tempfile.mkdtemp(prefix='libcxx-testsuite-')
         lit_config.warning('Creating temporary directory for object root: %s' %
                            obj_root)
+        config.libcxx_obj_root = obj_root
 
 config.test_exec_root = os.path.join(obj_root, 'test')