Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/libcxx-build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: always() # Upload artifacts even if the build or test suite fails
Expand Down
7 changes: 7 additions & 0 deletions libcxx/docs/TestingLibcxx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----

Expand Down
5 changes: 5 additions & 0 deletions libcxx/test/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#
# This file defines Python requirements to run the libc++ test suite.
#
filecheck
psutil
15 changes: 15 additions & 0 deletions libcxx/test/selftest/filecheck.sh.cpp
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions libcxx/utils/ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions libcxx/utils/libcxx/test/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
Comment on lines +358 to +365
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think allowing the external version is very reasonable, but IMO we should also look for FileCheck, since folks may very well have that already on their system (e.g. I do).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue though is that we have to standardize on the case we're going to use in the tests. LLVM uses FileCheck and the Python port is filecheck (all lowercase).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we do something similar to clang-tidy where we have %{clang-tidy}, which resolves to the executable we found on the system?

]

# Deduce and add the test features that that are implied by the #defines in
Expand Down
Loading