[libcxx-commits] [libcxx] Remove BLOCKLIT workaround. (PR #91001)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 3 12:54:26 PDT 2024


https://github.com/EricWF updated https://github.com/llvm/llvm-project/pull/91001

>From e0003585b872df6b6533256079fd0c49f98d8596 Mon Sep 17 00:00:00 2001
From: Eric Fiselier <eric at efcs.ca>
Date: Fri, 3 May 2024 15:51:52 -0400
Subject: [PATCH 1/2] Remove BLOCKLIT workaround.

Lit already has support for stopping LIT from parsing further test
directives. It is

// END.

After that directive, LIT will stop parsing.

This change removes the BLOCKLIT hack and replaces it with END.
---
 .../test/libcxx/clang_modules_include.gen.py  | 37 ++++++++++---------
 libcxx/test/libcxx/clang_tidy.gen.py          |  4 +-
 libcxx/test/libcxx/double_include.gen.py      | 11 +++---
 libcxx/test/libcxx/transitive_includes.gen.py | 30 ++++++++-------
 4 files changed, 44 insertions(+), 38 deletions(-)

diff --git a/libcxx/test/libcxx/clang_modules_include.gen.py b/libcxx/test/libcxx/clang_modules_include.gen.py
index 61a9258237640d..a823a47fd19b50 100644
--- a/libcxx/test/libcxx/clang_modules_include.gen.py
+++ b/libcxx/test/libcxx/clang_modules_include.gen.py
@@ -12,35 +12,36 @@
 
 # RUN: %{python} %s %{libcxx-dir}/utils
 
+# block Lit from interpreting a RUN/XFAIL/etc inside the generation script
+# END.
+
 import sys
 sys.path.append(sys.argv[1])
 from libcxx.header_information import lit_header_restrictions, public_headers
 
-BLOCKLIT = '' # block Lit from interpreting a RUN/XFAIL/etc inside the generation script
-
 for header in public_headers:
   print(f"""\
 //--- {header}.compile.pass.cpp
-// RUN{BLOCKLIT}: %{{cxx}} %s %{{flags}} %{{compile_flags}} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only
+// RUN: %{{cxx}} %s %{{flags}} %{{compile_flags}} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only
 
 // GCC doesn't support -fcxx-modules
-// UNSUPPORTED{BLOCKLIT}: gcc
+// UNSUPPORTED: gcc
 
 // The Windows headers don't appear to be compatible with modules
-// UNSUPPORTED{BLOCKLIT}: windows
-// UNSUPPORTED{BLOCKLIT}: buildhost=windows
+// UNSUPPORTED: windows
+// UNSUPPORTED: buildhost=windows
 
 // The AIX headers don't appear to be compatible with modules
-// UNSUPPORTED{BLOCKLIT}: LIBCXX-AIX-FIXME
+// UNSUPPORTED: LIBCXX-AIX-FIXME
 
 // The Android headers don't appear to be compatible with modules yet
-// UNSUPPORTED{BLOCKLIT}: LIBCXX-ANDROID-FIXME
+// UNSUPPORTED: LIBCXX-ANDROID-FIXME
 
 // TODO: Investigate this failure
-// UNSUPPORTED{BLOCKLIT}: LIBCXX-FREEBSD-FIXME
+// UNSUPPORTED: LIBCXX-FREEBSD-FIXME
 
 // TODO: Investigate this failure
-// UNSUPPORTED{BLOCKLIT}: LIBCXX-PICOLIBC-FIXME
+// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
 
 {lit_header_restrictions.get(header, '')}
 
@@ -49,25 +50,25 @@
 
 print(f"""\
 //--- __std_clang_module.compile.pass.mm
-// RUN{BLOCKLIT}: %{{cxx}} %s %{{flags}} %{{compile_flags}} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only
+// RUN: %{{cxx}} %s %{{flags}} %{{compile_flags}} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only
 
-// REQUIRES{BLOCKLIT}: clang-modules-build
+// REQUIRES: clang-modules-build
 
 // GCC doesn't support -fcxx-modules
-// UNSUPPORTED{BLOCKLIT}: gcc
+// UNSUPPORTED: gcc
 
 // The Windows headers don't appear to be compatible with modules
-// UNSUPPORTED{BLOCKLIT}: windows
-// UNSUPPORTED{BLOCKLIT}: buildhost=windows
+// UNSUPPORTED: windows
+// UNSUPPORTED: buildhost=windows
 
 // The AIX headers don't appear to be compatible with modules
-// UNSUPPORTED{BLOCKLIT}: LIBCXX-AIX-FIXME
+// UNSUPPORTED: LIBCXX-AIX-FIXME
 
 // The Android headers don't appear to be compatible with modules yet
-// UNSUPPORTED{BLOCKLIT}: LIBCXX-ANDROID-FIXME
+// UNSUPPORTED: LIBCXX-ANDROID-FIXME
 
 // TODO: Investigate this failure
-// UNSUPPORTED{BLOCKLIT}: LIBCXX-FREEBSD-FIXME
+// UNSUPPORTED: LIBCXX-FREEBSD-FIXME
 
 @import std;
 
diff --git a/libcxx/test/libcxx/clang_tidy.gen.py b/libcxx/test/libcxx/clang_tidy.gen.py
index 19b6a999df6073..64e970275f605c 100644
--- a/libcxx/test/libcxx/clang_tidy.gen.py
+++ b/libcxx/test/libcxx/clang_tidy.gen.py
@@ -10,12 +10,14 @@
 
 # RUN: %{python} %s %{libcxx-dir}/utils
 
+# block Lit from interpreting a RUN/XFAIL/etc inside the generation script
+# END.
+
 import sys
 sys.path.append(sys.argv[1])
 from libcxx.header_information import lit_header_restrictions, public_headers
 
 for header in public_headers:
-  BLOCKLIT = '' # block Lit from interpreting a RUN/XFAIL/etc inside the generation script
   print(f"""\
 //--- {header}.sh.cpp
 
diff --git a/libcxx/test/libcxx/double_include.gen.py b/libcxx/test/libcxx/double_include.gen.py
index 2fcfa50db693b4..a14dd77f95a31a 100644
--- a/libcxx/test/libcxx/double_include.gen.py
+++ b/libcxx/test/libcxx/double_include.gen.py
@@ -10,20 +10,21 @@
 
 # RUN: %{python} %s %{libcxx-dir}/utils
 
+# END.
+
 import sys
 sys.path.append(sys.argv[1])
 from libcxx.header_information import lit_header_restrictions, public_headers
 
 for header in public_headers:
-  BLOCKLIT = '' # block Lit from interpreting a RUN/XFAIL/etc inside the generation script
   print(f"""\
 //--- {header}.sh.cpp
 {lit_header_restrictions.get(header, '')}
 
-// RUN{BLOCKLIT}: %{{cxx}} -c %s -o %t.first.o %{{flags}} %{{compile_flags}}
-// RUN{BLOCKLIT}: %{{cxx}} -c %s -o %t.second.o -DWITH_MAIN %{{flags}} %{{compile_flags}}
-// RUN{BLOCKLIT}: %{{cxx}} -o %t.exe %t.first.o %t.second.o %{{flags}} %{{link_flags}}
-// RUN{BLOCKLIT}: %{{run}}
+// RUN: %{{cxx}} -c %s -o %t.first.o %{{flags}} %{{compile_flags}}
+// RUN: %{{cxx}} -c %s -o %t.second.o -DWITH_MAIN %{{flags}} %{{compile_flags}}
+// RUN: %{{cxx}} -o %t.exe %t.first.o %t.second.o %{{flags}} %{{link_flags}}
+// RUN: %{{run}}
 
 #include <{header}>
 
diff --git a/libcxx/test/libcxx/transitive_includes.gen.py b/libcxx/test/libcxx/transitive_includes.gen.py
index e4e1d3f232c12c..a67cab693b6e21 100644
--- a/libcxx/test/libcxx/transitive_includes.gen.py
+++ b/libcxx/test/libcxx/transitive_includes.gen.py
@@ -18,6 +18,9 @@
 
 # RUN: %{python} %s %{libcxx-dir}/utils
 
+# block Lit from interpreting a RUN/XFAIL/etc inside the generation script
+# END.
+
 import sys
 sys.path.append(sys.argv[1])
 from libcxx.header_information import lit_header_restrictions, public_headers
@@ -29,11 +32,10 @@
 # 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 libcxx/test/libcxx/transitive_includes.gen.py; done
 regenerate_expected_results = False
 
-BLOCKLIT = '' # block Lit from interpreting a RUN/XFAIL/etc inside the generation script
 if regenerate_expected_results:
   print(f"""\
 //--- generate-transitive-includes.sh.cpp
-// RUN{BLOCKLIT}: mkdir %t
+// RUN: mkdir %t
 """)
 
   all_traces = []
@@ -43,12 +45,12 @@
 
     normalized_header = re.sub('/', '_', header)
     print(f"""\
-// RUN{BLOCKLIT}: echo "#include <{header}>" | %{{cxx}} -xc++ - %{{flags}} %{{compile_flags}} --trace-includes -fshow-skipped-includes --preprocess > /dev/null 2> %t/trace-includes.{normalized_header}.txt
+// RUN: echo "#include <{header}>" | %{{cxx}} -xc++ - %{{flags}} %{{compile_flags}} --trace-includes -fshow-skipped-includes --preprocess > /dev/null 2> %t/trace-includes.{normalized_header}.txt
 """)
     all_traces.append(f'%t/trace-includes.{normalized_header}.txt')
 
   print(f"""\
-// RUN{BLOCKLIT}: %{{python}} %{{libcxx-dir}}/test/libcxx/transitive_includes_to_csv.py {' '.join(all_traces)} > %{{libcxx-dir}}/test/libcxx/transitive_includes/%{{cxx_std}}.csv
+// RUN: %{{python}} %{{libcxx-dir}}/test/libcxx/transitive_includes_to_csv.py {' '.join(all_traces)} > %{{libcxx-dir}}/test/libcxx/transitive_includes/%{{cxx_std}}.csv
 """)
 
 else:
@@ -64,27 +66,27 @@
 {lit_header_restrictions.get(header, '')}
 
 // TODO: Fix this test to make it work with localization or wide characters disabled
-// UNSUPPORTED{BLOCKLIT}: no-localization, no-wide-characters, no-threads, no-filesystem, libcpp-has-no-experimental-tzdb, no-tzdb
+// UNSUPPORTED: no-localization, no-wide-characters, no-threads, no-filesystem, libcpp-has-no-experimental-tzdb, no-tzdb
 
 // When built with modules, this test doesn't work because --trace-includes doesn't
 // report the stack of includes correctly.
-// UNSUPPORTED{BLOCKLIT}: clang-modules-build
+// UNSUPPORTED: clang-modules-build
 
 // This test uses --trace-includes, which is not supported by GCC.
-// UNSUPPORTED{BLOCKLIT}: gcc
+// UNSUPPORTED: gcc
 
 // This test is not supported when we remove the transitive includes provided for backwards
 // compatibility. When we bulk-remove them, we'll adjust the includes that are expected by
 // this test instead.
-// UNSUPPORTED{BLOCKLIT}: transitive-includes-disabled
+// UNSUPPORTED: transitive-includes-disabled
 
 // TODO: Figure out why <stdatomic.h> doesn't work on FreeBSD
-// UNSUPPORTED{BLOCKLIT}: LIBCXX-FREEBSD-FIXME
+// UNSUPPORTED: LIBCXX-FREEBSD-FIXME
 
-// RUN{BLOCKLIT}: mkdir %t
-// RUN{BLOCKLIT}: %{{cxx}} %s %{{flags}} %{{compile_flags}} --trace-includes -fshow-skipped-includes --preprocess > /dev/null 2> %t/trace-includes.txt
-// RUN{BLOCKLIT}: %{{python}} %{{libcxx-dir}}/test/libcxx/transitive_includes_to_csv.py %t/trace-includes.txt > %t/actual_transitive_includes.csv
-// RUN{BLOCKLIT}: cat %{{libcxx-dir}}/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
+// RUN: mkdir %t
+// RUN: %{{cxx}} %s %{{flags}} %{{compile_flags}} --trace-includes -fshow-skipped-includes --preprocess > /dev/null 2> %t/trace-includes.txt
+// RUN: %{{python}} %{{libcxx-dir}}/test/libcxx/transitive_includes_to_csv.py %t/trace-includes.txt > %t/actual_transitive_includes.csv
+// RUN: cat %{{libcxx-dir}}/test/libcxx/transitive_includes/%{{cxx_std}}.csv | awk '/^{escaped_header} / {{ print }}' > %t/expected_transitive_includes.csv
+// RUN: diff -w %t/expected_transitive_includes.csv %t/actual_transitive_includes.csv
 #include <{header}>
 """)

>From 47822db6cceebb27c36486f01bed3967c1d93f0b Mon Sep 17 00:00:00 2001
From: Eric <eric at efcs.ca>
Date: Fri, 3 May 2024 15:54:17 -0400
Subject: [PATCH 2/2] Update double_include.gen.py

---
 libcxx/test/libcxx/double_include.gen.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libcxx/test/libcxx/double_include.gen.py b/libcxx/test/libcxx/double_include.gen.py
index a14dd77f95a31a..c7cb38b8f35901 100644
--- a/libcxx/test/libcxx/double_include.gen.py
+++ b/libcxx/test/libcxx/double_include.gen.py
@@ -10,6 +10,7 @@
 
 # RUN: %{python} %s %{libcxx-dir}/utils
 
+# Block Lit from interpreting a RUN/XFAIL/etc inside the generation script.
 # END.
 
 import sys



More information about the libcxx-commits mailing list