diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index cf97e3c6e851ae..c20ce47a12abbd 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -523,6 +523,8 @@ endif() if( CLANG_INCLUDE_TESTS ) + find_package(Perl) + add_subdirectory(unittests) list(APPEND CLANG_TEST_DEPS ClangUnitTests) list(APPEND CLANG_TEST_PARAMS diff --git a/clang/test/Analysis/scan-build/deduplication.test b/clang/test/Analysis/scan-build/deduplication.test index 56d888e5fc12a2..2ec3061701fceb 100644 --- a/clang/test/Analysis/scan-build/deduplication.test +++ b/clang/test/Analysis/scan-build/deduplication.test @@ -1,4 +1,3 @@ -// FIXME: Actually, "perl". REQUIRES: shell RUN: rm -rf %t.output_dir && mkdir %t.output_dir diff --git a/clang/test/Analysis/scan-build/exclude_directories.test b/clang/test/Analysis/scan-build/exclude_directories.test index c161e51b6d26c5..2c79ed842af113 100644 --- a/clang/test/Analysis/scan-build/exclude_directories.test +++ b/clang/test/Analysis/scan-build/exclude_directories.test @@ -1,6 +1,3 @@ -// FIXME: Actually, "perl". -REQUIRES: shell - RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir %clang -S \ RUN: %S/Inputs/multidirectory_project/directory1/file1.c \ diff --git a/clang/test/Analysis/scan-build/help.test b/clang/test/Analysis/scan-build/help.test index 61915d32609439..d1f17cd69f51d1 100644 --- a/clang/test/Analysis/scan-build/help.test +++ b/clang/test/Analysis/scan-build/help.test @@ -1,6 +1,3 @@ -// FIXME: Actually, "perl". -REQUIRES: shell - RUN: %scan-build -h | FileCheck %s RUN: %scan-build --help | FileCheck %s diff --git a/clang/test/Analysis/scan-build/html_output.test b/clang/test/Analysis/scan-build/html_output.test index add35d83b95887..c2b509d9ef6611 100644 --- a/clang/test/Analysis/scan-build/html_output.test +++ b/clang/test/Analysis/scan-build/html_output.test @@ -1,4 +1,3 @@ -// FIXME: Actually, "perl". REQUIRES: shell RUN: rm -rf %t.output_dir && mkdir %t.output_dir diff --git a/clang/test/Analysis/scan-build/lit.local.cfg b/clang/test/Analysis/scan-build/lit.local.cfg index fab52b1c7bd679..aed76ca0e8087d 100644 --- a/clang/test/Analysis/scan-build/lit.local.cfg +++ b/clang/test/Analysis/scan-build/lit.local.cfg @@ -1,8 +1,8 @@ # -*- Python -*- -import lit.util import lit.formats import os +import platform use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL") config.test_format = lit.formats.ShTest(use_lit_shell == "0") @@ -12,13 +12,16 @@ clang_path = config.clang if config.have_llvm_driver else os.path.realpath(confi config.substitutions.append( ( "%scan-build", - "'%s' --use-analyzer=%s " + "'%s' '%s' --use-analyzer=%s " % ( - lit.util.which( - "scan-build", - os.path.join(config.clang_src_dir, "tools", "scan-build", "bin"), + config.perl_executable, + os.path.join( + config.clang_src_dir, "tools", "scan-build", "bin", "scan-build" ), clang_path, ), ) ) + +if not config.perl_executable or platform.system() == "Windows": + config.unsupported = True diff --git a/clang/test/Analysis/scan-build/plist_html_output.test b/clang/test/Analysis/scan-build/plist_html_output.test index c07891e35fbf33..ca9c5256b9d75a 100644 --- a/clang/test/Analysis/scan-build/plist_html_output.test +++ b/clang/test/Analysis/scan-build/plist_html_output.test @@ -1,4 +1,3 @@ -// FIXME: Actually, "perl". REQUIRES: shell RUN: rm -rf %t.output_dir && mkdir %t.output_dir diff --git a/clang/test/Analysis/scan-build/plist_output.test b/clang/test/Analysis/scan-build/plist_output.test index 0112e84630eda2..4d01640bff6eab 100644 --- a/clang/test/Analysis/scan-build/plist_output.test +++ b/clang/test/Analysis/scan-build/plist_output.test @@ -1,4 +1,3 @@ -// FIXME: Actually, "perl". REQUIRES: shell RUN: rm -rf %t.output_dir && mkdir %t.output_dir diff --git a/clang/test/Analysis/scan-build/rebuild_index/rebuild_index.test b/clang/test/Analysis/scan-build/rebuild_index/rebuild_index.test index ab70435c60542f..711a74f3fd02bd 100644 --- a/clang/test/Analysis/scan-build/rebuild_index/rebuild_index.test +++ b/clang/test/Analysis/scan-build/rebuild_index/rebuild_index.test @@ -1,6 +1,3 @@ -// FIXME: Actually, "perl". -REQUIRES: shell - RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: cp %S/report-1.html %t.output_dir RUN: cp %S/report-2.html %t.output_dir diff --git a/clang/test/Analysis/scan-build/silence-core-checkers.test b/clang/test/Analysis/scan-build/silence-core-checkers.test index 6d9a3017fcd612..7ffa744a545cff 100644 --- a/clang/test/Analysis/scan-build/silence-core-checkers.test +++ b/clang/test/Analysis/scan-build/silence-core-checkers.test @@ -1,6 +1,3 @@ -// FIXME: Actually, "perl". -REQUIRES: shell - RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir \ RUN: %clang -S %S/Inputs/null_dereference_and_division_by_zero.c \ diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in index 6641811c588395..ec6d30e6c2203a 100644 --- a/clang/test/lit.site.cfg.py.in +++ b/clang/test/lit.site.cfg.py.in @@ -34,6 +34,7 @@ config.enable_backtrace = @ENABLE_BACKTRACES@ config.enable_threads = @LLVM_ENABLE_THREADS@ config.reverse_iteration = @LLVM_ENABLE_REVERSE_ITERATION@ config.host_arch = "@HOST_ARCH@" +config.perl_executable = "@PERL_EXECUTABLE@" config.python_executable = "@Python3_EXECUTABLE@" config.use_z3_solver = lit_config.params.get('USE_Z3_SOLVER', "@USE_Z3_SOLVER@") config.has_plugins = @CLANG_PLUGIN_SUPPORT@