61 lines · plain
1import os2import glob3 4import lit.util5 6# python 2.7 backwards compatibility7try:8 from shlex import quote as shell_quote9except ImportError:10 from pipes import quote as shell_quote11 12 13if config.standalone_build:14 # These tests require the update_cc_test_checks.py script from the llvm15 # source tree, so skip these tests if we are doing standalone builds.16 # These tests are only relevant to developers working with the17 # update_cc_test_checks.py tool; they don't provide any coverage18 # for any of the clang source code.19 config.unsupported = True20else:21 22 config.test_format = lit.formats.ShTest(execute_external=False)23 config.suffixes = [".test"]24 25 clang_path = os.path.join(config.clang_tools_dir, "clang")26 extra_args = "--clang " + shell_quote(clang_path)27 opt_path = os.path.join(config.llvm_tools_dir, "opt")28 extra_args += " --opt " + shell_quote(opt_path)29 # Specify an explicit default version in UTC tests, so that the --version30 # embedded in UTC_ARGS does not change in all test expectations every time31 # the default is bumped.32 extra_args += " --version=1"33 script_path = os.path.join(34 config.llvm_src_root, "utils", "update_cc_test_checks.py"35 )36 assert os.path.isfile(script_path)37 # Windows: llvm-lit.py, Linux: llvm-lit38 if config.llvm_external_lit:39 lit = config.llvm_external_lit40 else:41 lit = shell_quote(42 os.path.join(config.llvm_tools_dir, "llvm-lit.py" if os.name == "nt" else "llvm-lit")43 )44 python = shell_quote(config.python_executable)45 config.substitutions.append(46 (47 "%update_cc_test_checks",48 "%s %s %s" % (python, shell_quote(script_path), extra_args),49 )50 )51 config.substitutions.append(52 ("%clang_tools_dir", shell_quote(config.clang_tools_dir))53 )54 config.substitutions.append(55 (56 "%lit",57 "%s %s -Dclang_lit_site_cfg=%s -j1 -vv"58 % (python, lit, shell_quote(config.clang_lit_site_cfg)),59 )60 )61