[libcxx-commits] [libcxx] [llvm] [libc++] Optionally support filecheck and split-file (PR #165769)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 7 12:06:18 PDT 2026


https://github.com/ldionne updated https://github.com/llvm/llvm-project/pull/165769

>From 76cb3e9a5daff12e23d229f7744c8b311578cdb3 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Thu, 30 Oct 2025 12:01:11 -0700
Subject: [PATCH 01/11] [libc++] Optionally support filecheck-based tests

This patch adds support for filecheck tests in libc++'s test suite.
However, it doesn't use LLVM's filecheck program, which requires
building a bunch of LLVM utilities. Instead, it installs the Python
port of filecheck at https://github.com/AntonLydike/filecheck which
supports basically the same functionality.

The test suite still works when filecheck is not available, since
tests that use filecheck should be guarded on the `has-filecheck`
Lit feature.

This should make it possible to test several things that were
previously impossible to test, especially for specific code generation.
---
 .github/workflows/libcxx-build-and-test.yaml |  2 +-
 libcxx/docs/TestingLibcxx.rst                |  7 +++++++
 libcxx/test/requirements.txt                 |  5 +++++
 libcxx/test/selftest/filecheck.sh.cpp        | 15 +++++++++++++++
 libcxx/utils/ci/Dockerfile                   |  3 +++
 libcxx/utils/libcxx/test/features.py         |  8 ++++++++
 6 files changed, 39 insertions(+), 1 deletion(-)
 create mode 100644 libcxx/test/requirements.txt
 create mode 100644 libcxx/test/selftest/filecheck.sh.cpp

diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml
index 6c8f2cb45ee0a..6097174f5e553 100644
--- a/.github/workflows/libcxx-build-and-test.yaml
+++ b/.github/workflows/libcxx-build-and-test.yaml
@@ -221,7 +221,7 @@ jobs:
         run: |
           python3 -m venv .venv
           source .venv/bin/activate
-          python -m pip install psutil
+          pip install -r libcxx/test/requirements.txt
           bash libcxx/utils/ci/run-buildbot ${{ matrix.config }}
       - uses: actions/upload-artifact at ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
         if: always()  # Upload artifacts even if the build or test suite fails
diff --git a/libcxx/docs/TestingLibcxx.rst b/libcxx/docs/TestingLibcxx.rst
index dbe69484abedf..d77c1c80fd307 100644
--- a/libcxx/docs/TestingLibcxx.rst
+++ b/libcxx/docs/TestingLibcxx.rst
@@ -23,6 +23,13 @@ Please see the `Lit Command Guide`_ for more information about LIT.
 
 .. _LIT Command Guide: https://llvm.org/docs/CommandGuide/lit.html
 
+Dependencies
+------------
+
+The libc++ test suite has a few optional dependencies. These can be installed
+with ``pip install -r libcxx/test/requirements.txt``. Installing these dependencies
+will ensure that the maximum number of tests can be run.
+
 Usage
 -----
 
diff --git a/libcxx/test/requirements.txt b/libcxx/test/requirements.txt
new file mode 100644
index 0000000000000..842b8ca4ef901
--- /dev/null
+++ b/libcxx/test/requirements.txt
@@ -0,0 +1,5 @@
+#
+# This file defines Python requirements to run the libc++ test suite.
+#
+filecheck
+psutil
diff --git a/libcxx/test/selftest/filecheck.sh.cpp b/libcxx/test/selftest/filecheck.sh.cpp
new file mode 100644
index 0000000000000..911d22b414b3b
--- /dev/null
+++ b/libcxx/test/selftest/filecheck.sh.cpp
@@ -0,0 +1,15 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: has-filecheck
+
+// Make sure that we can use filecheck to write tests when the `has-filecheck`
+// Lit feature is defined.
+
+// RUN: echo "hello world" | filecheck %s
+// CHECK: hello world
diff --git a/libcxx/utils/ci/Dockerfile b/libcxx/utils/ci/Dockerfile
index d22deec4dadab..40592c3770c76 100644
--- a/libcxx/utils/ci/Dockerfile
+++ b/libcxx/utils/ci/Dockerfile
@@ -111,6 +111,9 @@ RUN sudo apt-get update \
         xz-utils \
     && sudo rm -rf /var/lib/apt/lists/*
 
+COPY ../../test/requirements.txt .
+RUN python3 -m pip install -r requirements.txt
+
 RUN <<EOF
   set -e
   wget -qO /tmp/ninja.gz https://github.com/ninja-build/ninja/releases/latest/download/ninja-linux.zip
diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index 7d6e78de343c5..21e86a44e745b 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -355,6 +355,14 @@ def _mingwSupportsModules(cfg):
         name="has-no-zdump",
         when=lambda cfg: runScriptExitCode(cfg, ["zdump --version"]) != 0,
     ),
+    # Whether the `filecheck` executable is available. Note that this corresponds to
+    # a Python port of LLVM's FileCheck, not LLVM's actual FileCheck program, since
+    # that one requires building parts of LLVM that we don't want to build when merely
+    # testing libc++.
+    Feature(
+        name="has-filecheck",
+        when=lambda cfg: runScriptExitCode(cfg, ["filecheck --version"]) == 0,
+    ),
 ]
 
 # Deduce and add the test features that that are implied by the #defines in

>From cc5832247f7a5f52d7bff21adc55347cccbae94e Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Thu, 19 Mar 2026 16:03:59 -0400
Subject: [PATCH 02/11] Support both filecheck and FileCheck

---
 libcxx/utils/libcxx/test/features/misc.py | 24 ++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/libcxx/utils/libcxx/test/features/misc.py b/libcxx/utils/libcxx/test/features/misc.py
index 5a5f0b3e915c5..76571534bcd26 100644
--- a/libcxx/utils/libcxx/test/features/misc.py
+++ b/libcxx/utils/libcxx/test/features/misc.py
@@ -7,7 +7,7 @@
 # ===----------------------------------------------------------------------===##
 
 from libcxx.test.dsl import compilerMacros, sourceBuilds, hasCompileFlag, programSucceeds, runScriptExitCode
-from libcxx.test.dsl import Feature, AddCompileFlag, AddLinkFlag
+from libcxx.test.dsl import Feature, AddCompileFlag, AddLinkFlag, AddSubstitution
 import platform
 import sys
 
@@ -246,14 +246,6 @@ def _mingwSupportsModules(cfg):
         name="has-no-zdump",
         when=lambda cfg: runScriptExitCode(cfg, ["zdump --version"]) != 0,
     ),
-    # Whether the `filecheck` executable is available. Note that this corresponds to
-    # a Python port of LLVM's FileCheck, not LLVM's actual FileCheck program, since
-    # that one requires building parts of LLVM that we don't want to build when merely
-    # testing libc++.
-    Feature(
-        name="has-filecheck",
-        when=lambda cfg: runScriptExitCode(cfg, ["filecheck --version"]) == 0,
-    ),
     Feature(
         name="can-create-symlinks",
         when=lambda cfg: "_WIN32" not in compilerMacros(cfg)
@@ -304,4 +296,18 @@ def _mingwSupportsModules(cfg):
             """,
         ),
     ),
+
+    # Whether a `FileCheck` executable is available. Note that we intend not to depend
+    # on how that executable has been installed: we can either use the LLVM FileCheck
+    # executable or the `filecheck` Python port of the same utility.
+    Feature(
+        name="has-filecheck",
+        when=lambda cfg: runScriptExitCode(cfg, ["filecheck --version"]) == 0,
+        actions=[AddSubstitution("%{filecheck}", "filecheck")]
+    ),
+    Feature(
+        name="has-filecheck",
+        when=lambda cfg: runScriptExitCode(cfg, ["FileCheck --version"]) == 0,
+        actions=[AddSubstitution("%{filecheck}", "FileCheck")]
+    ),
 ]

>From d78de5a7a4670f96a2624b8b93ee35354befc152 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Thu, 19 Mar 2026 16:06:09 -0400
Subject: [PATCH 03/11] Fix selftest

---
 libcxx/test/selftest/filecheck.sh.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libcxx/test/selftest/filecheck.sh.cpp b/libcxx/test/selftest/filecheck.sh.cpp
index 911d22b414b3b..33b7d683e792d 100644
--- a/libcxx/test/selftest/filecheck.sh.cpp
+++ b/libcxx/test/selftest/filecheck.sh.cpp
@@ -8,8 +8,8 @@
 
 // REQUIRES: has-filecheck
 
-// Make sure that we can use filecheck to write tests when the `has-filecheck`
+// Make sure that we can use %{filecheck} to write tests when the `has-filecheck`
 // Lit feature is defined.
 
-// RUN: echo "hello world" | filecheck %s
+// RUN: echo "hello world" | %{filecheck} %s
 // CHECK: hello world

>From b769d02beec94bed3ea99fb54d97a88b5f3bdede Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Thu, 19 Mar 2026 16:16:47 -0400
Subject: [PATCH 04/11] Add negative filecheck test

---
 libcxx/test/selftest/filecheck.negative.sh.cpp | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 libcxx/test/selftest/filecheck.negative.sh.cpp

diff --git a/libcxx/test/selftest/filecheck.negative.sh.cpp b/libcxx/test/selftest/filecheck.negative.sh.cpp
new file mode 100644
index 0000000000000..5227b3e43752f
--- /dev/null
+++ b/libcxx/test/selftest/filecheck.negative.sh.cpp
@@ -0,0 +1,16 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: has-filecheck
+
+// Make sure that %{filecheck} fails when it should fail. This ensure that %{filecheck}
+// actually checks the content of the file.
+// XFAIL: *
+
+// RUN: echo "hello world" | %{filecheck} %s
+// CHECK: foobar

>From a4295c2a135be7e9767548719337d1c5abaa8e1f Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Thu, 19 Mar 2026 16:26:52 -0400
Subject: [PATCH 05/11] Don't install in the Docker image

Long term, this is something that should be done automatically by the
test suite on setup.
---
 .github/workflows/libcxx-build-and-test.yaml  | 20 +++++++++++++++----
 .../ci/docker/linux-builder-base.dockerfile   |  5 -----
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml
index 80bc40f544998..0321dd3e1b379 100644
--- a/.github/workflows/libcxx-build-and-test.yaml
+++ b/.github/workflows/libcxx-build-and-test.yaml
@@ -56,7 +56,11 @@ jobs:
     steps:
       - uses: actions/checkout at 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
       - name: ${{ matrix.config }}.${{ matrix.cxx }}
-        run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
+        run: |
+          python3 -m venv .venv
+          source .venv/bin/activate
+          pip install -r libcxx/test/requirements.txt
+          libcxx/utils/ci/run-buildbot ${{ matrix.config }}
         env:
           CC: ${{ matrix.cc }}
           CXX: ${{ matrix.cxx }}
@@ -101,7 +105,11 @@ jobs:
     steps:
       - uses: actions/checkout at 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
       - name: ${{ matrix.config }}
-        run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
+        run: |
+          python3 -m venv .venv
+          source .venv/bin/activate
+          pip install -r libcxx/test/requirements.txt
+          libcxx/utils/ci/run-buildbot ${{ matrix.config }}
         env:
           CC: ${{ matrix.cc }}
           CXX: ${{ matrix.cxx }}
@@ -156,7 +164,11 @@ jobs:
     steps:
       - uses: actions/checkout at 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
       - name: ${{ matrix.config }}
-        run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
+        run: |
+          python3 -m venv .venv
+          source .venv/bin/activate
+          pip install -r libcxx/test/requirements.txt
+          libcxx/utils/ci/run-buildbot ${{ matrix.config }}
         env:
           CC: clang-22
           CXX: clang++-22
@@ -250,7 +262,7 @@ jobs:
       - uses: actions/checkout at 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
       - name: Install dependencies
         run: |
-          pip install psutil
+          pip install -r libcxx/test/requirements.txt
       - name: Install a current LLVM
         if: ${{ matrix.mingw != true }}
         run: |
diff --git a/libcxx/utils/ci/docker/linux-builder-base.dockerfile b/libcxx/utils/ci/docker/linux-builder-base.dockerfile
index f13f7cb1b8d67..71be99a1ffb20 100644
--- a/libcxx/utils/ci/docker/linux-builder-base.dockerfile
+++ b/libcxx/utils/ci/docker/linux-builder-base.dockerfile
@@ -83,11 +83,6 @@ RUN sudo apt-get update \
         xz-utils \
     && sudo rm -rf /var/lib/apt/lists/*
 
-# Install the Python dependencies needed by the test suite.
-# TODO: We should be installing from libcxx/test/requirements.txt, however
-# the Docker context doesn't easily allow us to COPY from the source tree.
-RUN python3 -m pip install --break-system-packages filecheck
-
 # These two locales are not enabled by default so generate them
 RUN <<EOF
   set -e

>From 2d06f880ac8d397feb6318155ccffba9550fb088 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Fri, 20 Mar 2026 13:29:35 -0400
Subject: [PATCH 06/11] Try installing venv on Linux runners

---
 .github/workflows/libcxx-build-and-test.yaml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml
index 0321dd3e1b379..e8e1ae874246e 100644
--- a/.github/workflows/libcxx-build-and-test.yaml
+++ b/.github/workflows/libcxx-build-and-test.yaml
@@ -56,7 +56,9 @@ jobs:
     steps:
       - uses: actions/checkout at 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
       - name: ${{ matrix.config }}.${{ matrix.cxx }}
+        # TODO: install venv in the Docker image instead
         run: |
+          apt install python3.12-venv
           python3 -m venv .venv
           source .venv/bin/activate
           pip install -r libcxx/test/requirements.txt
@@ -106,6 +108,7 @@ jobs:
       - uses: actions/checkout at 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
       - name: ${{ matrix.config }}
         run: |
+          apt install python3.12-venv
           python3 -m venv .venv
           source .venv/bin/activate
           pip install -r libcxx/test/requirements.txt
@@ -165,6 +168,7 @@ jobs:
       - uses: actions/checkout at 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
       - name: ${{ matrix.config }}
         run: |
+          apt install python3.12-venv
           python3 -m venv .venv
           source .venv/bin/activate
           pip install -r libcxx/test/requirements.txt

>From d48fa6e54c362c3eca10a5a9f5338cf85241d9bf Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Fri, 20 Mar 2026 13:36:11 -0400
Subject: [PATCH 07/11] sudo

---
 .github/workflows/libcxx-build-and-test.yaml | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml
index e8e1ae874246e..eb19d3689e878 100644
--- a/.github/workflows/libcxx-build-and-test.yaml
+++ b/.github/workflows/libcxx-build-and-test.yaml
@@ -58,7 +58,8 @@ jobs:
       - name: ${{ matrix.config }}.${{ matrix.cxx }}
         # TODO: install venv in the Docker image instead
         run: |
-          apt install python3.12-venv
+          sudo apt-get update
+          sudo apt-get install python3.12-venv
           python3 -m venv .venv
           source .venv/bin/activate
           pip install -r libcxx/test/requirements.txt
@@ -108,7 +109,8 @@ jobs:
       - uses: actions/checkout at 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
       - name: ${{ matrix.config }}
         run: |
-          apt install python3.12-venv
+          sudo apt-get update
+          sudo apt-get install python3.12-venv
           python3 -m venv .venv
           source .venv/bin/activate
           pip install -r libcxx/test/requirements.txt
@@ -168,7 +170,8 @@ jobs:
       - uses: actions/checkout at 8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
       - name: ${{ matrix.config }}
         run: |
-          apt install python3.12-venv
+          sudo apt-get update
+          sudo apt-get install python3.12-venv
           python3 -m venv .venv
           source .venv/bin/activate
           pip install -r libcxx/test/requirements.txt

>From 7b8b38d89fc306d0dda8efd11a478d4a9680d7b5 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Fri, 20 Mar 2026 13:50:49 -0400
Subject: [PATCH 08/11] Using apt-get is harder than it looks

---
 .github/workflows/libcxx-build-and-test.yaml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml
index eb19d3689e878..9cb7e6e3c1be5 100644
--- a/.github/workflows/libcxx-build-and-test.yaml
+++ b/.github/workflows/libcxx-build-and-test.yaml
@@ -59,7 +59,7 @@ jobs:
         # TODO: install venv in the Docker image instead
         run: |
           sudo apt-get update
-          sudo apt-get install python3.12-venv
+          sudo apt-get install -y python3.12-venv
           python3 -m venv .venv
           source .venv/bin/activate
           pip install -r libcxx/test/requirements.txt
@@ -110,7 +110,7 @@ jobs:
       - name: ${{ matrix.config }}
         run: |
           sudo apt-get update
-          sudo apt-get install python3.12-venv
+          sudo apt-get install -y python3.12-venv
           python3 -m venv .venv
           source .venv/bin/activate
           pip install -r libcxx/test/requirements.txt
@@ -171,7 +171,7 @@ jobs:
       - name: ${{ matrix.config }}
         run: |
           sudo apt-get update
-          sudo apt-get install python3.12-venv
+          sudo apt-get install -y python3.12-venv
           python3 -m venv .venv
           source .venv/bin/activate
           pip install -r libcxx/test/requirements.txt

>From d98779d63e32b302db06c76315553ccd7ad63e25 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Fri, 20 Mar 2026 14:01:51 -0400
Subject: [PATCH 09/11] format

---
 libcxx/utils/libcxx/test/features/misc.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libcxx/utils/libcxx/test/features/misc.py b/libcxx/utils/libcxx/test/features/misc.py
index 76571534bcd26..335b61313c7bb 100644
--- a/libcxx/utils/libcxx/test/features/misc.py
+++ b/libcxx/utils/libcxx/test/features/misc.py
@@ -296,18 +296,17 @@ def _mingwSupportsModules(cfg):
             """,
         ),
     ),
-
     # Whether a `FileCheck` executable is available. Note that we intend not to depend
     # on how that executable has been installed: we can either use the LLVM FileCheck
     # executable or the `filecheck` Python port of the same utility.
     Feature(
         name="has-filecheck",
         when=lambda cfg: runScriptExitCode(cfg, ["filecheck --version"]) == 0,
-        actions=[AddSubstitution("%{filecheck}", "filecheck")]
+        actions=[AddSubstitution("%{filecheck}", "filecheck")],
     ),
     Feature(
         name="has-filecheck",
         when=lambda cfg: runScriptExitCode(cfg, ["FileCheck --version"]) == 0,
-        actions=[AddSubstitution("%{filecheck}", "FileCheck")]
+        actions=[AddSubstitution("%{filecheck}", "FileCheck")],
     ),
 ]

>From c2cdca7e030fd5df88ff4afbb4cef9f309c5af8c Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Tue, 7 Apr 2026 10:44:18 -0400
Subject: [PATCH 10/11] Try using Pip package for llvm-testing-utils

---
 .github/workflows/libcxx-build-and-test.yaml  | 13 ++-----
 libcxx/test/requirements.txt                  |  2 +-
 .../test/selftest/filecheck.negative.sh.cpp   |  4 +-
 libcxx/test/selftest/filecheck.sh.cpp         |  4 +-
 libcxx/test/selftest/splitfile.sh.cpp         | 39 +++++++++++++++++++
 libcxx/utils/libcxx/test/features/misc.py     | 12 ++----
 6 files changed, 51 insertions(+), 23 deletions(-)
 create mode 100644 libcxx/test/selftest/splitfile.sh.cpp

diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml
index a0123259cba9d..a0fa335020811 100644
--- a/.github/workflows/libcxx-build-and-test.yaml
+++ b/.github/workflows/libcxx-build-and-test.yaml
@@ -58,11 +58,8 @@ jobs:
         with:
           persist-credentials: false
       - name: ${{ matrix.config }}.${{ matrix.cxx }}
-        # TODO: install venv in the Docker image instead
         run: |
-          sudo apt-get update
-          sudo apt-get install -y python3.12-venv
-          python3 -m venv .venv
+          python3 -m venv --system-site-packages .venv
           source .venv/bin/activate
           pip install -r libcxx/test/requirements.txt
           libcxx/utils/ci/run-buildbot ${{ matrix.config }}
@@ -113,9 +110,7 @@ jobs:
           persist-credentials: false
       - name: ${{ matrix.config }}
         run: |
-          sudo apt-get update
-          sudo apt-get install -y python3.12-venv
-          python3 -m venv .venv
+          python3 -m venv --system-site-packages .venv
           source .venv/bin/activate
           pip install -r libcxx/test/requirements.txt
           libcxx/utils/ci/run-buildbot ${{ matrix.config }}
@@ -176,9 +171,7 @@ jobs:
           persist-credentials: false
       - name: ${{ matrix.config }}
         run: |
-          sudo apt-get update
-          sudo apt-get install -y python3.12-venv
-          python3 -m venv .venv
+          python3 -m venv --system-site-packages .venv
           source .venv/bin/activate
           pip install -r libcxx/test/requirements.txt
           libcxx/utils/ci/run-buildbot ${{ matrix.config }}
diff --git a/libcxx/test/requirements.txt b/libcxx/test/requirements.txt
index 842b8ca4ef901..70d0ce63edef2 100644
--- a/libcxx/test/requirements.txt
+++ b/libcxx/test/requirements.txt
@@ -1,5 +1,5 @@
 #
 # This file defines Python requirements to run the libc++ test suite.
 #
-filecheck
+llvm-testing-tools
 psutil
diff --git a/libcxx/test/selftest/filecheck.negative.sh.cpp b/libcxx/test/selftest/filecheck.negative.sh.cpp
index 5227b3e43752f..fbfe4ce1548dd 100644
--- a/libcxx/test/selftest/filecheck.negative.sh.cpp
+++ b/libcxx/test/selftest/filecheck.negative.sh.cpp
@@ -8,9 +8,9 @@
 
 // REQUIRES: has-filecheck
 
-// Make sure that %{filecheck} fails when it should fail. This ensure that %{filecheck}
+// Make sure that FileCheck fails when it should fail. This ensure that FileCheck
 // actually checks the content of the file.
 // XFAIL: *
 
-// RUN: echo "hello world" | %{filecheck} %s
+// RUN: echo "hello world" | FileCheck %s
 // CHECK: foobar
diff --git a/libcxx/test/selftest/filecheck.sh.cpp b/libcxx/test/selftest/filecheck.sh.cpp
index 33b7d683e792d..f2cd6245ed1e0 100644
--- a/libcxx/test/selftest/filecheck.sh.cpp
+++ b/libcxx/test/selftest/filecheck.sh.cpp
@@ -8,8 +8,8 @@
 
 // REQUIRES: has-filecheck
 
-// Make sure that we can use %{filecheck} to write tests when the `has-filecheck`
+// Make sure that we can use FileCheck to write tests when the `has-filecheck`
 // Lit feature is defined.
 
-// RUN: echo "hello world" | %{filecheck} %s
+// RUN: echo "hello world" | FileCheck %s
 // CHECK: hello world
diff --git a/libcxx/test/selftest/splitfile.sh.cpp b/libcxx/test/selftest/splitfile.sh.cpp
new file mode 100644
index 0000000000000..0dae825f77110
--- /dev/null
+++ b/libcxx/test/selftest/splitfile.sh.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: has-splitfile
+
+// Make sure that we can use split-file to write tests when the `has-splitfile`
+// Lit feature is defined.
+
+// RUN: split-file %s %{temp}
+
+// RUN: grep 'int main' %{temp}/main.cpp
+// RUN: grep 'return 0' %{temp}/main.cpp
+// RUN: not grep -c 'Pre-delimiter' %{temp}/main.cpp
+// RUN: not grep -c 'foo' %{temp}/main.cpp
+// RUN: not grep -c '//---' %{temp}/main.cpp
+
+// RUN: grep foo %{temp}/input.txt
+// RUN: grep bar %{temp}/input.txt
+// RUN: not grep -c 'Pre-delimiter' %{temp}/input.txt
+// RUN: not grep -c 'int main' %{temp}/input.txt
+// RUN: not grep -c '//---' %{temp}/input.txt
+
+// Pre-delimiter comment.
+
+//--- main.cpp
+
+int main() {
+  return 0;
+}
+
+//--- input.txt
+
+foo
+bar
diff --git a/libcxx/utils/libcxx/test/features/misc.py b/libcxx/utils/libcxx/test/features/misc.py
index 335b61313c7bb..05d46bc161447 100644
--- a/libcxx/utils/libcxx/test/features/misc.py
+++ b/libcxx/utils/libcxx/test/features/misc.py
@@ -296,17 +296,13 @@ def _mingwSupportsModules(cfg):
             """,
         ),
     ),
-    # Whether a `FileCheck` executable is available. Note that we intend not to depend
-    # on how that executable has been installed: we can either use the LLVM FileCheck
-    # executable or the `filecheck` Python port of the same utility.
+    # Whether `FileCheck` and `split-file` executables are available.
     Feature(
         name="has-filecheck",
-        when=lambda cfg: runScriptExitCode(cfg, ["filecheck --version"]) == 0,
-        actions=[AddSubstitution("%{filecheck}", "filecheck")],
+        when=lambda cfg: runScriptExitCode(cfg, ["FileCheck --version"]) == 0,
     ),
     Feature(
-        name="has-filecheck",
-        when=lambda cfg: runScriptExitCode(cfg, ["FileCheck --version"]) == 0,
-        actions=[AddSubstitution("%{filecheck}", "FileCheck")],
+        name="has-splitfile",
+        when=lambda cfg: runScriptExitCode(cfg, ["split-file --version"]) == 0,
     ),
 ]

>From 37116a98f5bd2a6729707a40327057e04e962b86 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Tue, 7 Apr 2026 15:06:01 -0400
Subject: [PATCH 11/11] Update libcxx/utils/libcxx/test/features/misc.py

---
 libcxx/utils/libcxx/test/features/misc.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/utils/libcxx/test/features/misc.py b/libcxx/utils/libcxx/test/features/misc.py
index 05d46bc161447..92b6dc352d2e1 100644
--- a/libcxx/utils/libcxx/test/features/misc.py
+++ b/libcxx/utils/libcxx/test/features/misc.py
@@ -7,7 +7,7 @@
 # ===----------------------------------------------------------------------===##
 
 from libcxx.test.dsl import compilerMacros, sourceBuilds, hasCompileFlag, programSucceeds, runScriptExitCode
-from libcxx.test.dsl import Feature, AddCompileFlag, AddLinkFlag, AddSubstitution
+from libcxx.test.dsl import Feature, AddCompileFlag, AddLinkFlag
 import platform
 import sys
 



More information about the libcxx-commits mailing list