xref: /llvm-project/clang/test/utils/update_cc_test_checks/lit.local.cfg (revision dd3c26a045c081620375a878159f536758baba6e)
161dd0603SAlex Richardsonimport os
25aa0f9ccSYaron Kerenimport glob
361dd0603SAlex Richardson
461dd0603SAlex Richardsonimport lit.util
561dd0603SAlex Richardson
661dd0603SAlex Richardson# python 2.7 backwards compatibility
761dd0603SAlex Richardsontry:
861dd0603SAlex Richardson    from shlex import quote as shell_quote
961dd0603SAlex Richardsonexcept ImportError:
1061dd0603SAlex Richardson    from pipes import quote as shell_quote
1161dd0603SAlex Richardson
1261dd0603SAlex Richardson
1374384c7fSTom Stellardif config.standalone_build:
1474384c7fSTom Stellard    # These tests require the update_cc_test_checks.py script from the llvm
1574384c7fSTom Stellard    # source tree, so skip these tests if we are doing standalone builds.
1674384c7fSTom Stellard    # These tests are only relevant to developers working with the
1774384c7fSTom Stellard    # update_cc_test_checks.py tool; they don't provide any coverage
1874384c7fSTom Stellard    # for any of the clang source code.
1974384c7fSTom Stellard    config.unsupported = True
2074384c7fSTom Stellardelse:
2174384c7fSTom Stellard
2261dd0603SAlex Richardson    config.test_format = lit.formats.ShTest(execute_external=False)
23*dd3c26a0STobias Hieta    config.suffixes = [".test"]
2461dd0603SAlex Richardson
25*dd3c26a0STobias Hieta    clang_path = os.path.join(config.clang_tools_dir, "clang")
26*dd3c26a0STobias Hieta    extra_args = "--clang " + shell_quote(clang_path)
27*dd3c26a0STobias Hieta    opt_path = os.path.join(config.llvm_tools_dir, "opt")
28*dd3c26a0STobias Hieta    extra_args += " --opt " + shell_quote(opt_path)
295375b638SNikita Popov    # Specify an explicit default version in UTC tests, so that the --version
305375b638SNikita Popov    # embedded in UTC_ARGS does not change in all test expectations every time
315375b638SNikita Popov    # the default is bumped.
32*dd3c26a0STobias Hieta    extra_args += " --version=1"
33*dd3c26a0STobias Hieta    script_path = os.path.join(
34*dd3c26a0STobias Hieta        config.llvm_src_root, "utils", "update_cc_test_checks.py"
35*dd3c26a0STobias Hieta    )
3661dd0603SAlex Richardson    assert os.path.isfile(script_path)
375aa0f9ccSYaron Keren    # Windows: llvm-lit.py, Linux: llvm-lit
3810d78a06SYaron Keren    if config.llvm_external_lit:
3910d78a06SYaron Keren        lit = config.llvm_external_lit
4010d78a06SYaron Keren    else:
41*dd3c26a0STobias Hieta        lit = shell_quote(
42*dd3c26a0STobias Hieta            glob.glob(os.path.join(config.llvm_tools_dir, "llvm-lit*"))[0]
43*dd3c26a0STobias Hieta        )
449eaf0d12SJoel E. Denny    python = shell_quote(config.python_executable)
4561dd0603SAlex Richardson    config.substitutions.append(
46*dd3c26a0STobias Hieta        (
47*dd3c26a0STobias Hieta            "%update_cc_test_checks",
48*dd3c26a0STobias Hieta            "%s %s %s" % (python, shell_quote(script_path), extra_args),
49*dd3c26a0STobias Hieta        )
50*dd3c26a0STobias Hieta    )
51e150d2caSAlex Richardson    config.substitutions.append(
52*dd3c26a0STobias Hieta        ("%clang_tools_dir", shell_quote(config.clang_tools_dir))
53*dd3c26a0STobias Hieta    )
549eaf0d12SJoel E. Denny    config.substitutions.append(
55*dd3c26a0STobias Hieta        (
56*dd3c26a0STobias Hieta            "%lit",
57*dd3c26a0STobias Hieta            "%s %s -Dclang_lit_site_cfg=%s -j1 -vv"
58*dd3c26a0STobias Hieta            % (python, lit, shell_quote(config.clang_lit_site_cfg)),
59*dd3c26a0STobias Hieta        )
60*dd3c26a0STobias Hieta    )
61