mirror-llvm-project/libcxx/test/libcxx-03/module_std_compat.gen.py
Nikolas Klauser f12cd86923
[libc++][C++03] Split libc++-specific tests for the frozen headers (#144093)
The C++03 headers are essentially a separate implementation, so it
doesn't make a ton of sense to try to test two implementations with a
single set of implementation-specific tests.

This patch doesn't copy over any tests that will not be run in C++03
mode. The most notable changes are that `lit.local.cfg` files are
touched to change the path from `libcxx/test/libcxx` to
`libcxx/test/libcxx-03` in a few places.

This also modifies `lit.local.cfg` files to run `libcxx/test/libcxx-03`
only when using the frozen headers and `lbcxx/test/libcxx` tests only
when _not_ using the frozen headers.

This is part of
https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc.
2025-08-26 08:03:47 +02:00

42 lines
1.3 KiB
Python

# ===----------------------------------------------------------------------===##
#
# 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
#
# ===----------------------------------------------------------------------===##
# Test that all named declarations with external linkage match the
# exported declarations in their associated module partition.
# Then it tests the sum of the exported declarations in the module
# partitions matches the export of the std.compat module.
# Note the test of the std.compat module requires all partitions to be tested
# first. Since lit tests have no dependencies, this means the test needs
# to be one monolitic test. Since the test doesn't take very long it's
# not a huge issue.
# RUN: %{python} %s %{libcxx-dir}/utils
import sys
sys.path.append(sys.argv[1])
from libcxx.header_information import module_c_headers
from libcxx.test.modules import module_test_generator
generator = module_test_generator(
"%t",
"%{module-dir}",
"%{clang-tidy}",
"%{test-tools-dir}/clang_tidy_checks/libcxx-tidy.plugin",
"%{cxx}",
"%{flags} %{compile_flags}",
"std.compat",
)
print("//--- module_std_compat.sh.cpp")
generator.write_test(
"std.compat",
module_c_headers,
)