[clang] 61dd060 - Move update_cc_test_checks.py tests to clang

Alex Richardson via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 14 06:40:08 PST 2020


Author: Alex Richardson
Date: 2020-02-14T14:39:55Z
New Revision: 61dd0603bd8afeaa0d467d19c1522b5fbcf0104c

URL: https://github.com/llvm/llvm-project/commit/61dd0603bd8afeaa0d467d19c1522b5fbcf0104c
DIFF: https://github.com/llvm/llvm-project/commit/61dd0603bd8afeaa0d467d19c1522b5fbcf0104c.diff

LOG: 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

Added: 
    clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c
    clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c.expected
    clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c
    clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.expected
    clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected
    clang/test/utils/update_cc_test_checks/def-and-decl.test
    clang/test/utils/update_cc_test_checks/lit.local.cfg
    clang/test/utils/update_cc_test_checks/mangled_names.test

Modified: 
    llvm/test/tools/UpdateTestChecks/lit.local.cfg

Removed: 
    llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c
    llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/def-and-decl.c.expected
    llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c
    llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.expected
    llvm/test/tools/UpdateTestChecks/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected
    llvm/test/tools/UpdateTestChecks/update_cc_test_checks/def-and-decl.test
    llvm/test/tools/UpdateTestChecks/update_cc_test_checks/lit.local.cfg
    llvm/test/tools/UpdateTestChecks/update_cc_test_checks/mangled_names.test


################################################################################
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 000000000000..0250446423cb
--- /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 74164e808e47..d9d11b5a06c0 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 99346daabcb0..000000000000
--- 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


        


More information about the cfe-commits mailing list