aboutsummaryrefslogtreecommitdiff
path: root/test/profile/lit.cfg
diff options
context:
space:
mode:
Diffstat (limited to 'test/profile/lit.cfg')
-rw-r--r--test/profile/lit.cfg53
1 files changed, 53 insertions, 0 deletions
diff --git a/test/profile/lit.cfg b/test/profile/lit.cfg
new file mode 100644
index 000000000000..e4910abbe7a4
--- /dev/null
+++ b/test/profile/lit.cfg
@@ -0,0 +1,53 @@
+# -*- Python -*-
+
+import os
+
+# Setup config name.
+config.name = 'Profile'
+
+# Setup source root.
+config.test_source_root = os.path.dirname(__file__)
+
+# Setup executable root.
+if hasattr(config, 'profile_lit_binary_dir') and \
+ config.profile_lit_binary_dir is not None:
+ config.test_exec_root = config.profile_lit_binary_dir
+
+# 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_linkflags = ["-ldl"]
+else:
+ extra_linkflags = []
+
+# Test suffixes.
+config.suffixes = ['.c', '.cc', '.cpp', '.m', '.mm', '.ll', '.test']
+
+# What to exclude.
+config.excludes = ['Inputs']
+
+# Clang flags.
+clang_cflags = [config.target_cflags] + extra_linkflags
+
+def build_invocation(compile_flags):
+ return " " + " ".join([config.clang] + compile_flags) + " "
+
+# Add clang substitutions.
+config.substitutions.append( ("%clang ", build_invocation(clang_cflags)) )
+config.substitutions.append( ("%clang_profgen ", build_invocation(clang_cflags) + " -fprofile-instr-generate ") )
+config.substitutions.append( ("%clang_profuse=", build_invocation(clang_cflags) + " -fprofile-instr-use=") )
+
+if config.host_os not in ['Darwin', 'FreeBSD', 'Linux']:
+ config.unsupported = True
+
+if config.target_arch in ['armv7l']:
+ config.unsupported = True