Skip to content
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

[libc++] Split the module_std and module_std_compat tests #107275

Closed
wants to merge 1 commit into from

Conversation

ldionne
Copy link
Member

@ldionne ldionne commented Sep 4, 2024

The C++20 modules tests were set up such that the top-level gen-py test would generate a single ShTest which would then run tests for all the module parts.

However, gen-py tests were originally intended to generate multiple smaller independent Lit tests that would be executed by Lit directly. Doing so increases test suite parallelism, makes error messages easier to understand and avoids nesting multiple layers of test generation, which is confusing.

This patch modifies the C++20 modules test to generate individual Lit tests instead.

The C++20 modules tests were set up such that the top-level gen-py
test would generate a single ShTest which would then run tests for
all the module parts.

However, gen-py tests were originally intended to generate multiple
smaller independent Lit tests that would be executed by Lit directly.
Doing so increases test suite parallelism, makes error messages easier
to understand and avoids nesting multiple layers of test generation,
which is confusing.

This patch modifies the C++20 modules test to generate individual
Lit tests instead.
@ldionne ldionne requested a review from a team as a code owner September 4, 2024 17:54
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Sep 4, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Sep 4, 2024

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

Changes

The C++20 modules tests were set up such that the top-level gen-py test would generate a single ShTest which would then run tests for all the module parts.

However, gen-py tests were originally intended to generate multiple smaller independent Lit tests that would be executed by Lit directly. Doing so increases test suite parallelism, makes error messages easier to understand and avoids nesting multiple layers of test generation, which is confusing.

This patch modifies the C++20 modules test to generate individual Lit tests instead.


Full diff: https://github.com/llvm/llvm-project/pull/107275.diff

3 Files Affected:

  • (modified) libcxx/test/libcxx/module_std.gen.py (-2)
  • (modified) libcxx/test/libcxx/module_std_compat.gen.py (-2)
  • (modified) libcxx/utils/libcxx/test/modules.py (+5-5)
diff --git a/libcxx/test/libcxx/module_std.gen.py b/libcxx/test/libcxx/module_std.gen.py
index fc23985caf30de..ea62df88151feb 100644
--- a/libcxx/test/libcxx/module_std.gen.py
+++ b/libcxx/test/libcxx/module_std.gen.py
@@ -33,6 +33,4 @@
     "std",
 )
 
-
-print("//--- module_std.sh.cpp")
 generator.write_test("std")
diff --git a/libcxx/test/libcxx/module_std_compat.gen.py b/libcxx/test/libcxx/module_std_compat.gen.py
index 000aa299861220..960cfd9b80b10e 100644
--- a/libcxx/test/libcxx/module_std_compat.gen.py
+++ b/libcxx/test/libcxx/module_std_compat.gen.py
@@ -34,8 +34,6 @@
     "std.compat",
 )
 
-
-print("//--- module_std_compat.sh.cpp")
 generator.write_test(
     "std.compat",
     module_c_headers,
diff --git a/libcxx/utils/libcxx/test/modules.py b/libcxx/utils/libcxx/test/modules.py
index b7758dc9a41ee8..67c433d3a5eede 100644
--- a/libcxx/utils/libcxx/test/modules.py
+++ b/libcxx/utils/libcxx/test/modules.py
@@ -283,13 +283,13 @@ def test_module(self, module):
         )
 
     def write_test(self, module, c_headers=[]):
-        self.write_lit_configuration()
-
-        # Validate all module parts.
         for header in module_headers:
+            print(f"//--- {header}.sh.cpp")
+            self.write_lit_configuration()
+
             is_c_header = header in c_headers
             include = self.process_module_partition(header, is_c_header)
             self.process_header(header, include, is_c_header)
 
-        self.process_module(module)
-        self.test_module(module)
+            self.process_module(module)
+            self.test_module(module)

@ldionne
Copy link
Member Author

ldionne commented Sep 4, 2024

Nevermind, it seems like the test is accumulating something in a file shared by all the "sub-tests", so this can't work.

@ldionne ldionne closed this Sep 4, 2024
@ldionne ldionne deleted the review/cxx20-modules-test branch September 4, 2024 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants