[libcxx-commits] [libcxx] [libc++] Move a few tests into more correct places (PR #147557)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 10 08:09:03 PDT 2025


https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/147557

>From c971209a0cb7b3140adbfd0f9fee64abe6334260 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Mon, 30 Jun 2025 14:07:51 +0200
Subject: [PATCH] [libc++] Move a few tests into more correct places

---
 .../all}/cstddef.compile.pass.cpp                            | 1 +
 .../clang}/clang_modules_include.gen.py                      | 0
 libcxx/test/extensions/clang/lit.local.cfg                   | 4 ++++
 libcxx/test/{ => extensions}/libcxx/include_as_c.sh.cpp      | 0
 libcxx/test/{ => extensions}/libcxx/libcpp_version.gen.py    | 2 +-
 libcxx/test/extensions/libcxx/lit.local.cfg                  | 3 +++
 libcxx/test/{ => extensions}/libcxx/no_assert_include.gen.py | 0
 libcxx/test/selftest/lit.local.cfg                           | 5 -----
 libcxx/test/{libcxx => std}/double_include.gen.py            | 3 +++
 libcxx/test/{libcxx => std}/header_inclusions.gen.py         | 3 +++
 10 files changed, 15 insertions(+), 6 deletions(-)
 rename libcxx/test/{libcxx/language.support/support.types => extensions/all}/cstddef.compile.pass.cpp (99%)
 rename libcxx/test/{libcxx => extensions/clang}/clang_modules_include.gen.py (100%)
 create mode 100644 libcxx/test/extensions/clang/lit.local.cfg
 rename libcxx/test/{ => extensions}/libcxx/include_as_c.sh.cpp (100%)
 rename libcxx/test/{ => extensions}/libcxx/libcpp_version.gen.py (93%)
 create mode 100644 libcxx/test/extensions/libcxx/lit.local.cfg
 rename libcxx/test/{ => extensions}/libcxx/no_assert_include.gen.py (100%)
 delete mode 100644 libcxx/test/selftest/lit.local.cfg
 rename libcxx/test/{libcxx => std}/double_include.gen.py (93%)
 rename libcxx/test/{libcxx => std}/header_inclusions.gen.py (91%)

diff --git a/libcxx/test/libcxx/language.support/support.types/cstddef.compile.pass.cpp b/libcxx/test/extensions/all/cstddef.compile.pass.cpp
similarity index 99%
rename from libcxx/test/libcxx/language.support/support.types/cstddef.compile.pass.cpp
rename to libcxx/test/extensions/all/cstddef.compile.pass.cpp
index 514353a103029..c6f670d7bfc06 100644
--- a/libcxx/test/libcxx/language.support/support.types/cstddef.compile.pass.cpp
+++ b/libcxx/test/extensions/all/cstddef.compile.pass.cpp
@@ -11,6 +11,7 @@
 // appear to provide that behavior too.
 
 #include <cstddef>
+
 #include "test_macros.h"
 
 using PtrdiffT = ::ptrdiff_t;
diff --git a/libcxx/test/libcxx/clang_modules_include.gen.py b/libcxx/test/extensions/clang/clang_modules_include.gen.py
similarity index 100%
rename from libcxx/test/libcxx/clang_modules_include.gen.py
rename to libcxx/test/extensions/clang/clang_modules_include.gen.py
diff --git a/libcxx/test/extensions/clang/lit.local.cfg b/libcxx/test/extensions/clang/lit.local.cfg
new file mode 100644
index 0000000000000..b0a1c7d9b17e4
--- /dev/null
+++ b/libcxx/test/extensions/clang/lit.local.cfg
@@ -0,0 +1,4 @@
+
+# Only libc++ supports clang-specific extensions
+if "stdlib=libc++" not in config.available_features:
+    config.unsupported = True
diff --git a/libcxx/test/libcxx/include_as_c.sh.cpp b/libcxx/test/extensions/libcxx/include_as_c.sh.cpp
similarity index 100%
rename from libcxx/test/libcxx/include_as_c.sh.cpp
rename to libcxx/test/extensions/libcxx/include_as_c.sh.cpp
diff --git a/libcxx/test/libcxx/libcpp_version.gen.py b/libcxx/test/extensions/libcxx/libcpp_version.gen.py
similarity index 93%
rename from libcxx/test/libcxx/libcpp_version.gen.py
rename to libcxx/test/extensions/libcxx/libcpp_version.gen.py
index b30623fe2c388..ebeab777c934f 100644
--- a/libcxx/test/libcxx/libcpp_version.gen.py
+++ b/libcxx/test/extensions/libcxx/libcpp_version.gen.py
@@ -6,7 +6,7 @@
 #
 # ===----------------------------------------------------------------------===##
 
-# Test that all headers define the _LIBCPP_VERSION macro.
+# Test that all public headers define the _LIBCPP_VERSION macro.
 
 # RUN: %{python} %s %{libcxx-dir}/utils
 
diff --git a/libcxx/test/extensions/libcxx/lit.local.cfg b/libcxx/test/extensions/libcxx/lit.local.cfg
new file mode 100644
index 0000000000000..2b128105558b2
--- /dev/null
+++ b/libcxx/test/extensions/libcxx/lit.local.cfg
@@ -0,0 +1,3 @@
+
+if "stdlib=libc++" not in config.available_features:
+    config.unsupported = True
diff --git a/libcxx/test/libcxx/no_assert_include.gen.py b/libcxx/test/extensions/libcxx/no_assert_include.gen.py
similarity index 100%
rename from libcxx/test/libcxx/no_assert_include.gen.py
rename to libcxx/test/extensions/libcxx/no_assert_include.gen.py
diff --git a/libcxx/test/selftest/lit.local.cfg b/libcxx/test/selftest/lit.local.cfg
deleted file mode 100644
index 4467d8070cc70..0000000000000
--- a/libcxx/test/selftest/lit.local.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-# The tests in this directory need to run Python
-import shlex
-import sys
-
-config.substitutions.append(("%{python}", shlex.quote(sys.executable)))
diff --git a/libcxx/test/libcxx/double_include.gen.py b/libcxx/test/std/double_include.gen.py
similarity index 93%
rename from libcxx/test/libcxx/double_include.gen.py
rename to libcxx/test/std/double_include.gen.py
index f58e72f94a353..fcf3b9a8fa2e0 100644
--- a/libcxx/test/libcxx/double_include.gen.py
+++ b/libcxx/test/std/double_include.gen.py
@@ -28,6 +28,9 @@
 {lit_header_restrictions.get(header, '')}
 {lit_header_undeprecations.get(header, '')}
 
+// We're using compiler-specific flags in this test
+// REQUIRES: (gcc || clang)
+
 // 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}}
diff --git a/libcxx/test/libcxx/header_inclusions.gen.py b/libcxx/test/std/header_inclusions.gen.py
similarity index 91%
rename from libcxx/test/libcxx/header_inclusions.gen.py
rename to libcxx/test/std/header_inclusions.gen.py
index e00cf180d17ad..8ff93810069fa 100644
--- a/libcxx/test/libcxx/header_inclusions.gen.py
+++ b/libcxx/test/std/header_inclusions.gen.py
@@ -48,6 +48,9 @@
 //--- {header}.compile.pass.cpp
 // UNSUPPORTED: FROZEN-CXX03-HEADERS-FIXME
 
+// TODO: This is currently a libc++-specific way of testing the includes, but is a requirement for all implementation
+// REQUIRES: stdlib=libc++
+
 {lit_header_restrictions.get(header, '')}
 {lit_header_undeprecations.get(header, '')}
 



More information about the libcxx-commits mailing list