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
This commit is contained in:
Alex Richardson 2020-02-14 10:26:07 +00:00
parent 74c97ca1b4
commit 61dd0603bd
10 changed files with 25 additions and 11 deletions

View File

@ -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)))

View File

@ -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)

View File

@ -1,3 +0,0 @@
# These tests require clang.
if 'clang-binary' not in config.available_features:
config.unsupported = True