[libcxx-commits] [PATCH] D152008: [libc++] Use .gen.py tests for the transitive inclusion tests
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Jun 3 08:38:34 PDT 2023
ldionne marked an inline comment as done.
ldionne added inline comments.
================
Comment at: libcxx/test/libcxx/transitive_includes.gen.py:27-30
+# To re-generate the list of expected headers, temporarily set this to True, re-generate
+# the file and run this test.
+# Note that this needs to be done for all supported language versions of libc++:
+# for std in c++03 c++11 c++14 c++17 c++20 c++23 c++26; do <build>/bin/llvm-lit --param std=$std ${path_to_this_file}; done
----------------
Mordante wrote:
> These instructions seem outdated an no longer working. The regeneration happen when I try to run this test. Unfortunately running the test fails.
>
> `<build>/bin/llvm-lit --param std=c++03 test/libcxx/transitive_includes.gen.py` gives
> ```
> <llvm>/llvm/utils/lit/lit/discovery.py:189: error: 'llvm-libc++-shared.cfg.in :: libcxx/transitive_includes.gen.py' would not be run indirectly: change name or LIT config(e.g. suffixes or standalone_tests variables)
> 1 errors, exiting
> ```
>
> Running the generated test manually
> `<build>/bin/llvm-lit <build>/build/test/libcxx/transitive_includes.gen.py/algorithm.sh.cpp`
> gives
> ```
>
> llvm-lit: <llvm>/llvm/utils/lit/lit/discovery.py:137: warning: unable to find test suite for '<build>/test/libcxx/transitive_includes.gen.py/algorithm.sh.cpp'
> llvm-lit: <llvm>/llvm/utils/lit/lit/discovery.py:314: warning: input '<build>/test/libcxx/transitive_includes.gen.py/algorithm.sh.cpp' contained no tests
> error: did not discover any tests for provided path(s)
> ```
>
> How can we run this test and update the transitive includes?
This would be fixed by D151664.
================
Comment at: libcxx/test/libcxx/transitive_includes.gen.py:88
+// RUN{BLOCKLIT}: %{{python}} %{{libcxx}}/test/libcxx/transitive_includes_to_csv.py %t/trace-includes.txt > %t/actual_transitive_includes.csv
+// RUN{BLOCKLIT}: cat %{{libcxx}}/test/libcxx/transitive_includes/%{{cxx_std}}.csv | awk '/^{escaped_header} / {{ print }}' > %t/expected_transitive_includes.csv
+// RUN{BLOCKLIT}: diff -w %t/expected_transitive_includes.csv %t/actual_transitive_includes.csv
----------------
Mordante wrote:
> It seems we don't use awk in our tests yet. It's already a dependency since it's on of the POSIX tools. However I wonder why not using grep instead?
That's a good question. I was using `grep` first.
`grep` returns non-zero when there are no matches, which fails this test for headers that have no transitive dependencies.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152008/new/
https://reviews.llvm.org/D152008
More information about the libcxx-commits
mailing list