[llvm] cc802ea - Only run mangled_names.test if python3 is available.

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 16 11:28:03 PST 2019


Author: Nico Weber
Date: 2019-12-16T14:27:54-05:00
New Revision: cc802ea67beb66d2f8a935e647c3aedcf7848211

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

LOG: Only run mangled_names.test if python3 is available.

The %update_cc_test_checks substitution only gets added if python3
is on path, so the test fails if it isn't. Don't run the test
when it would fail.

Also include the '%' in the arg to add_update_script_substition(),
to help greppability.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/UpdateTestChecks/lit.local.cfg b/llvm/test/tools/UpdateTestChecks/lit.local.cfg
index f6b35f4af204..073a901c71f2 100644
--- a/llvm/test/tools/UpdateTestChecks/lit.local.cfg
+++ b/llvm/test/tools/UpdateTestChecks/lit.local.cfg
@@ -12,10 +12,11 @@ except ImportError:
 
 def add_update_script_substition(name, python_exe=config.python_executable,
                                  extra_args=''):
-    script_path = os.path.join(config.llvm_src_root, 'utils', name + '.py')
+    assert name.startswith('%')
+    script_path = os.path.join(config.llvm_src_root, 'utils', name[1:] + '.py')
     assert os.path.isfile(script_path)
     config.substitutions.append(
-        ('%' + name, "'%s' %s %s" % (python_exe, script_path, extra_args)))
+        (name, "'%s' %s %s" % (python_exe, script_path, extra_args)))
 
 
 config.test_format = lit.formats.ShTest(execute_external=False)
@@ -25,22 +26,22 @@ llc_path = os.path.join(config.llvm_tools_dir, 'llc')
 if os.path.isfile(llc_path):
     config.available_features.add('llc-binary')
     llc_arg = '--llc-binary ' + shell_quote(llc_path)
-    add_update_script_substition('update_llc_test_checks', extra_args=llc_arg)
-    add_update_script_substition('update_mir_test_checks', extra_args=llc_arg)
+    add_update_script_substition('%update_llc_test_checks', extra_args=llc_arg)
+    add_update_script_substition('%update_mir_test_checks', extra_args=llc_arg)
 
 opt_path = os.path.join(config.llvm_tools_dir, 'opt')
 if os.path.isfile(opt_path):
     config.available_features.add('opt-binary')
     opt_arg = '--opt-binary ' + shell_quote(opt_path)
-    add_update_script_substition('update_test_checks', extra_args=opt_arg)
-    add_update_script_substition('update_analyze_test_checks',
+    add_update_script_substition('%update_test_checks', extra_args=opt_arg)
+    add_update_script_substition('%update_analyze_test_checks',
                                  extra_args=opt_arg)
 
 llvm_mca_path = os.path.join(config.llvm_tools_dir, 'llvm-mca')
 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)
+    add_update_script_substition('%update_test_checks', extra_args=mca_arg)
 
 # update_cc_test_checks requires python3
 py3_exe = lit.util.which('python3')
@@ -56,6 +57,6 @@ if os.path.isfile(clang_path):
         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',
+        add_update_script_substition('%update_cc_test_checks',
                                      python_exe=py3_exe,
                                      extra_args=extra_args)

diff  --git a/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/mangled_names.test b/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/mangled_names.test
index 082ed74304f0..4d2b66f38100 100644
--- a/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/mangled_names.test
+++ b/llvm/test/tools/UpdateTestChecks/update_cc_test_checks/mangled_names.test
@@ -1,5 +1,10 @@
 ## Basic test checking that update_cc_test_checks.py works as expected for
 ## functions with mangled names
+
+# %update_cc_test_checks is only set if python3 is on the path.
+# FIXME: Is this the best approach? See discussion on D70660.
+# REQUIRES: python3
+
 # RUN: cp -f %S/Inputs/mangled_names.c %t.c && %update_cc_test_checks -v %t.c
 # RUN: 
diff  -u %t.c %S/Inputs/mangled_names.c.expected
 ## Check that running the script again does not change the result:


        


More information about the llvm-commits mailing list