Skip to content

[NFC] Remove BLOCKLIT workaround. #91001

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 5, 2024
Merged
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
37 changes: 19 additions & 18 deletions libcxx/test/libcxx/clang_modules_include.gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, '')}

Expand All @@ -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;

Expand Down
12 changes: 7 additions & 5 deletions libcxx/test/libcxx/clang_tidy.gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,27 @@

# 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

// REQUIRES{BLOCKLIT}: has-clang-tidy
// REQUIRES: has-clang-tidy

// The GCC compiler flags are not always compatible with clang-tidy.
// UNSUPPORTED{BLOCKLIT}: gcc
// UNSUPPORTED: gcc

{lit_header_restrictions.get(header, '')}

// TODO: run clang-tidy with modules enabled once they are supported
// RUN{BLOCKLIT}: %{{clang-tidy}} %s --warnings-as-errors=* -header-filter=.* --checks='-*,libcpp-*' --load=%{{test-tools-dir}}/clang_tidy_checks/libcxx-tidy.plugin -- %{{compile_flags}} -fno-modules
// RUN{BLOCKLIT}: %{{clang-tidy}} %s --warnings-as-errors=* -header-filter=.* --config-file=%{{libcxx-dir}}/.clang-tidy -- -Wweak-vtables %{{compile_flags}} -fno-modules
// RUN: %{{clang-tidy}} %s --warnings-as-errors=* -header-filter=.* --checks='-*,libcpp-*' --load=%{{test-tools-dir}}/clang_tidy_checks/libcxx-tidy.plugin -- %{{compile_flags}} -fno-modules
// RUN: %{{clang-tidy}} %s --warnings-as-errors=* -header-filter=.* --config-file=%{{libcxx-dir}}/.clang-tidy -- -Wweak-vtables %{{compile_flags}} -fno-modules

#include <{header}>
""")
12 changes: 7 additions & 5 deletions libcxx/test/libcxx/double_include.gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,22 @@

# 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
{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}>

Expand Down
30 changes: 16 additions & 14 deletions libcxx/test/libcxx/transitive_includes.gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 = []
Expand All @@ -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:
Expand All @@ -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}>
""")