https://github.com/MatzeB created https://github.com/llvm/llvm-project/pull/91275
None >From c0b7ec2e336476b1a1d6cf05d07bfde2f3dc88a4 Mon Sep 17 00:00:00 2001 From: Matthias Braun <ma...@braunis.de> Date: Mon, 6 May 2024 14:39:37 -0700 Subject: [PATCH] Use cmake to find perl executable --- clang/CMakeLists.txt | 2 ++ clang/test/Analysis/scan-build/cxx-name.test | 2 +- clang/test/Analysis/scan-build/deduplication.test | 3 +-- clang/test/Analysis/scan-build/exclude_directories.test | 3 +-- clang/test/Analysis/scan-build/help.test | 3 +-- clang/test/Analysis/scan-build/html_output.test | 3 +-- clang/test/Analysis/scan-build/lit.local.cfg | 3 ++- clang/test/Analysis/scan-build/plist_html_output.test | 3 +-- clang/test/Analysis/scan-build/plist_output.test | 3 +-- .../test/Analysis/scan-build/rebuild_index/rebuild_index.test | 3 +-- clang/test/Analysis/scan-build/silence-core-checkers.test | 3 +-- clang/test/lit.cfg.py | 3 +++ clang/test/lit.site.cfg.py.in | 1 + 13 files changed, 17 insertions(+), 18 deletions(-) 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/cxx-name.test b/clang/test/Analysis/scan-build/cxx-name.test index 483762d619d178..789f7e0ac197c6 100644 --- a/clang/test/Analysis/scan-build/cxx-name.test +++ b/clang/test/Analysis/scan-build/cxx-name.test @@ -1,4 +1,4 @@ -REQUIRES: shell +REQUIRES: perl RUN: %scan-build sh -c 'echo "CLANG_CXX=/$(basename "$CLANG_CXX")/"' | FileCheck %s diff --git a/clang/test/Analysis/scan-build/deduplication.test b/clang/test/Analysis/scan-build/deduplication.test index 56d888e5fc12a2..62375d9aadfa85 100644 --- a/clang/test/Analysis/scan-build/deduplication.test +++ b/clang/test/Analysis/scan-build/deduplication.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %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..c15568f0b6bb9e 100644 --- a/clang/test/Analysis/scan-build/exclude_directories.test +++ b/clang/test/Analysis/scan-build/exclude_directories.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir %clang -S \ diff --git a/clang/test/Analysis/scan-build/help.test b/clang/test/Analysis/scan-build/help.test index 61915d32609439..2966507b6080cd 100644 --- a/clang/test/Analysis/scan-build/help.test +++ b/clang/test/Analysis/scan-build/help.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl 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..2d5c001e83960d 100644 --- a/clang/test/Analysis/scan-build/html_output.test +++ b/clang/test/Analysis/scan-build/html_output.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir %clang -S %S/Inputs/single_null_dereference.c \ diff --git a/clang/test/Analysis/scan-build/lit.local.cfg b/clang/test/Analysis/scan-build/lit.local.cfg index fab52b1c7bd679..e606243ea73a48 100644 --- a/clang/test/Analysis/scan-build/lit.local.cfg +++ b/clang/test/Analysis/scan-build/lit.local.cfg @@ -12,8 +12,9 @@ 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 " % ( + config.perl_executable, lit.util.which( "scan-build", os.path.join(config.clang_src_dir, "tools", "scan-build", "bin"), diff --git a/clang/test/Analysis/scan-build/plist_html_output.test b/clang/test/Analysis/scan-build/plist_html_output.test index c07891e35fbf33..811bca22b07643 100644 --- a/clang/test/Analysis/scan-build/plist_html_output.test +++ b/clang/test/Analysis/scan-build/plist_html_output.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -plist-html -o %t.output_dir %clang -S %S/Inputs/single_null_dereference.c \ diff --git a/clang/test/Analysis/scan-build/plist_output.test b/clang/test/Analysis/scan-build/plist_output.test index 0112e84630eda2..45c9dd0a5aa2e7 100644 --- a/clang/test/Analysis/scan-build/plist_output.test +++ b/clang/test/Analysis/scan-build/plist_output.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -plist -o %t.output_dir %clang -S %S/Inputs/single_null_dereference.c \ 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..5ce04e132f9fbc 100644 --- a/clang/test/Analysis/scan-build/rebuild_index/rebuild_index.test +++ b/clang/test/Analysis/scan-build/rebuild_index/rebuild_index.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: cp %S/report-1.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..dae54cbfb6579c 100644 --- a/clang/test/Analysis/scan-build/silence-core-checkers.test +++ b/clang/test/Analysis/scan-build/silence-core-checkers.test @@ -1,5 +1,4 @@ -// FIXME: Actually, "perl". -REQUIRES: shell +REQUIRES: perl RUN: rm -rf %t.output_dir && mkdir %t.output_dir RUN: %scan-build -o %t.output_dir \ diff --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py index e5630a07424c7c..f82981a0880f08 100644 --- a/clang/test/lit.cfg.py +++ b/clang/test/lit.cfg.py @@ -181,6 +181,9 @@ def have_host_clang_repl_cuda(): ) ) +if config.perl_executable: + config.available_features.add("perl") + llvm_config.add_tool_substitutions(tools, tool_dirs) config.substitutions.append( diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in index 6641811c588395..24d9a64bcbf6a6 100644 --- a/clang/test/lit.site.cfg.py.in +++ b/clang/test/lit.site.cfg.py.in @@ -35,6 +35,7 @@ config.enable_threads = @LLVM_ENABLE_THREADS@ config.reverse_iteration = @LLVM_ENABLE_REVERSE_ITERATION@ config.host_arch = "@HOST_ARCH@" config.python_executable = "@Python3_EXECUTABLE@" +config.perl_executable = "@PERL_EXECUTABLE@" config.use_z3_solver = lit_config.params.get('USE_Z3_SOLVER', "@USE_Z3_SOLVER@") config.has_plugins = @CLANG_PLUGIN_SUPPORT@ config.clang_vendor_uti = "@CLANG_VENDOR_UTI@" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits