diff options
Diffstat (limited to 'test/profile/lit.cfg')
-rw-r--r-- | test/profile/lit.cfg | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/test/profile/lit.cfg b/test/profile/lit.cfg index b1b44a1a0665f..3512e0abcf1a6 100644 --- a/test/profile/lit.cfg +++ b/test/profile/lit.cfg @@ -2,8 +2,17 @@ import os +def get_required_attr(config, attr_name): + attr_value = getattr(config, attr_name, None) + if attr_value == None: + lit_config.fatal( + "No attribute %r in test configuration! You may need to run " + "tests from your build directory or add this attribute " + "to lit.site.cfg " % attr_name) + return attr_value + # Setup config name. -config.name = 'Profile' +config.name = 'Profile-' + config.target_arch # Setup source root. config.test_source_root = os.path.dirname(__file__) @@ -11,7 +20,7 @@ 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 + 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. @@ -36,15 +45,21 @@ config.suffixes = ['.c', '.cc', '.cpp', '.m', '.mm', '.ll', '.test'] config.excludes = ['Inputs'] # Clang flags. -clang_cflags = [config.target_cflags] + extra_linkflags +target_cflags=[get_required_attr(config, "target_cflags")] +clang_cflags = target_cflags + extra_linkflags +clang_cxxflags = config.cxx_mode_flags + clang_cflags 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( ("%clangxx ", build_invocation(clang_cxxflags)) ) config.substitutions.append( ("%clang_profgen ", build_invocation(clang_cflags) + " -fprofile-instr-generate ") ) +config.substitutions.append( ("%clang_profgen=", build_invocation(clang_cflags) + " -fprofile-instr-generate=") ) config.substitutions.append( ("%clang_profuse=", build_invocation(clang_cflags) + " -fprofile-instr-use=") ) +config.substitutions.append( ("%clangxx_profgen ", build_invocation(clang_cxxflags) + " -fprofile-instr-generate ") ) +config.substitutions.append( ("%clangxx_profuse=", build_invocation(clang_cxxflags) + " -fprofile-instr-use=") ) config.substitutions.append( ("%clang_profgen_gcc=", build_invocation(clang_cflags) + " -fprofile-generate=") ) config.substitutions.append( ("%clang_profuse_gcc=", build_invocation(clang_cflags) + " -fprofile-use=") ) |