From 61dd0603bd8afeaa0d467d19c1522b5fbcf0104c Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 14 Feb 2020 10:26:07 +0000 Subject: [PATCH] Move update_cc_test_checks.py tests to clang Having tests that depend on clang inside llvm/ are not a good idea since it can break incremental `ninja check-llvm`. Fixes https://llvm.org/PR44798 Reviewed By: lebedev.ri, MaskRay, rsmith Differential Revision: https://reviews.llvm.org/D74051 --- .../update_cc_test_checks/Inputs/def-and-decl.c | 0 .../Inputs/def-and-decl.c.expected | 0 .../update_cc_test_checks/Inputs/mangled_names.c | 0 .../Inputs/mangled_names.c.expected | 0 .../Inputs/mangled_names.c.funcsig.expected | 0 .../utils}/update_cc_test_checks/def-and-decl.test | 0 .../test/utils/update_cc_test_checks/lit.local.cfg | 25 ++++++++++++++++++++++ .../update_cc_test_checks/mangled_names.test | 0 llvm/test/tools/UpdateTestChecks/lit.local.cfg | 8 ------- .../update_cc_test_checks/lit.local.cfg | 3 --- 10 files changed, 25 insertions(+), 11 deletions(-) rename {llvm/test/tools/UpdateTestChecks => clang/test/utils}/update_cc_test_checks/Inputs/def-and-decl.c (100%) rename {llvm/test/tools/UpdateTestChecks => clang/test/utils}/update_cc_test_checks/Inputs/def-and-decl.c.expected (100%) rename {llvm/test/tools/UpdateTestChecks => clang/test/utils}/update_cc_test_checks/Inputs/mangled_names.c (100%) rename {llvm/test/tools/UpdateTestChecks => clang/test/utils}/update_cc_test_checks/Inputs/mangled_names.c.expected (100%) rename {llvm/test/tools/UpdateTestChecks => clang/test/utils}/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected (100%) rename {llvm/test/tools/UpdateTestChecks => clang/test/utils}/update_cc_test_checks/def-and-decl.test (100%) create mode 100644 clang/test/utils/update_cc_test_checks/lit.local.cfg rename {llvm/test/tools/UpdateTestChecks => clang/test/utils}/update_cc_test_checks/mangled_names.test (100%) delete mode 100644 llvm/test/tools/UpdateTestChecks/update_cc_test_checks/lit.local.cfg diff --git a/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c b/clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c similarity index 100% rename from llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c rename to clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c diff --git a/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c.expected b/clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c.expected similarity index 100% rename from llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c.expected rename to clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c.expected diff --git a/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c b/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c similarity index 100% rename from llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c rename to clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c diff --git a/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.expected b/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.expected similarity index 100% rename from llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.expected rename to clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.expected diff --git a/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected b/clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected similarity index 100% rename from llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected rename to clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected diff --git a/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/def-and-decl.test b/clang/test/utils/update_cc_test_checks/def-and-decl.test similarity index 100% rename from llvm/test/tools/UpdateTestChecks/update_cc_test_checks/def-and-decl.test rename to clang/test/utils/update_cc_test_checks/def-and-decl.test diff --git a/clang/test/utils/update_cc_test_checks/lit.local.cfg b/clang/test/utils/update_cc_test_checks/lit.local.cfg new file mode 100644 index 0000000..0250446 --- /dev/null +++ b/clang/test/utils/update_cc_test_checks/lit.local.cfg @@ -0,0 +1,25 @@ +import os + +import lit.util + +# python 2.7 backwards compatibility +try: + from shlex import quote as shell_quote +except ImportError: + from pipes import quote as shell_quote + + +config.test_format = lit.formats.ShTest(execute_external=False) +config.suffixes = ['.test'] + +clang_path = os.path.join(config.clang_tools_dir, 'clang') +extra_args = '--clang ' + shell_quote(clang_path) +opt_path = os.path.join(config.llvm_tools_dir, 'opt') +extra_args += ' --opt ' + shell_quote(opt_path) +script_path = os.path.join(config.llvm_src_root, 'utils', + 'update_cc_test_checks.py') +assert os.path.isfile(script_path) +config.substitutions.append( + ('%update_cc_test_checks', "%s %s %s" % ( + shell_quote(config.python_executable), shell_quote(script_path), + extra_args))) diff --git a/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/mangled_names.test b/clang/test/utils/update_cc_test_checks/mangled_names.test similarity index 100% rename from llvm/test/tools/UpdateTestChecks/update_cc_test_checks/mangled_names.test rename to clang/test/utils/update_cc_test_checks/mangled_names.test diff --git a/llvm/test/tools/UpdateTestChecks/lit.local.cfg b/llvm/test/tools/UpdateTestChecks/lit.local.cfg index 74164e8..d9d11b5 100644 --- a/llvm/test/tools/UpdateTestChecks/lit.local.cfg +++ b/llvm/test/tools/UpdateTestChecks/lit.local.cfg @@ -42,11 +42,3 @@ if os.path.isfile(llvm_mca_path): config.available_features.add('llvm-mca-binary') mca_arg = '--llvm-mca-binary ' + shell_quote(llvm_mca_path) add_update_script_substition('%update_test_checks', extra_args=mca_arg) - -clang_path = os.path.join(config.llvm_tools_dir, 'clang') -if os.path.isfile(clang_path): - config.available_features.add('clang-binary') - extra_args = '--clang ' + shell_quote(clang_path) - if os.path.isfile(opt_path): - extra_args += ' --opt ' + shell_quote(opt_path) - add_update_script_substition('%update_cc_test_checks', extra_args=extra_args) diff --git a/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/lit.local.cfg b/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/lit.local.cfg deleted file mode 100644 index 99346da..0000000 --- a/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/lit.local.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# These tests require clang. -if 'clang-binary' not in config.available_features: - config.unsupported = True -- 2.7.4