summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/profile/lit.cfg
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/test/profile/lit.cfg')
-rw-r--r--compiler-rt/test/profile/lit.cfg11
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler-rt/test/profile/lit.cfg b/compiler-rt/test/profile/lit.cfg
index 7f0d95a9a39..9ca394212e9 100644
--- a/compiler-rt/test/profile/lit.cfg
+++ b/compiler-rt/test/profile/lit.cfg
@@ -22,6 +22,17 @@ if hasattr(config, 'profile_lit_binary_dir') and \
config.profile_lit_binary_dir is not None:
config.test_exec_root = os.path.join(config.profile_lit_binary_dir, config.name)
+# If the above check didn't work, we're probably in the source tree. Use some
+# magic to re-execute from the build tree.
+if config.test_exec_root is None:
+ # The magic relies on knowing compilerrt_site_basedir.
+ compilerrt_basedir = lit_config.params.get('compilerrt_site_basedir', None)
+ if compilerrt_basedir:
+ site_cfg = os.path.join(compilerrt_basedir, 'profile', 'lit.site.cfg')
+ if os.path.exists(site_cfg):
+ lit_config.load_config(config, site_cfg)
+ raise SystemExit
+
if config.host_os in ['Linux']:
extra_link_flags = ["-ldl"]
else:
OpenPOWER on IntegriCloud