[libcxx-commits] [libcxx] [libc++] Make libcxx/selftest a top-level test directory (PR #144852)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 19 01:00:17 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- libcxx/test/libcxx/modules/no-modules.sh.cpp libcxx/test/libcxx/modules/std-and-std.compat-module.sh.cpp libcxx/test/libcxx/modules/std-module.sh.cpp libcxx/test/libcxx/modules/std.compat-module.sh.cpp libcxx/test/selftest/additional_compile_flags/conditional-compile-flags.sh.cpp libcxx/test/selftest/additional_compile_flags/substitutes-in-compile-flags.sh.cpp libcxx/test/selftest/additional_compile_flags/substitutes-in-run.sh.cpp libcxx/test/selftest/compile.fail.cpp/compile-error.compile.fail.cpp libcxx/test/selftest/compile.fail.cpp/compile-success.compile.fail.cpp libcxx/test/selftest/compile.pass.cpp/compile-error.compile.pass.cpp libcxx/test/selftest/compile.pass.cpp/compile-success.compile.pass.cpp libcxx/test/selftest/compile.pass.cpp/link-error.compile.pass.cpp libcxx/test/selftest/compile.pass.cpp/run-error.compile.pass.cpp libcxx/test/selftest/convenience_substitutions/build_run.sh.cpp libcxx/test/selftest/convenience_substitutions/verify.sh.cpp libcxx/test/selftest/file_dependencies/absolute-and-relative-paths.sh.cpp libcxx/test/selftest/file_dependencies/substitute-in-dependencies.sh.cpp libcxx/test/selftest/gen.cpp/empty.gen.cpp libcxx/test/selftest/gen.cpp/one.gen.cpp libcxx/test/selftest/gen.cpp/two.gen.cpp libcxx/test/selftest/link.fail.cpp/compile-error.link.fail.cpp libcxx/test/selftest/link.fail.cpp/link-error.link.fail.cpp libcxx/test/selftest/link.fail.cpp/link-success.link.fail.cpp libcxx/test/selftest/link.pass.cpp/compile-error.link.pass.cpp libcxx/test/selftest/link.pass.cpp/link-error.link.pass.cpp libcxx/test/selftest/link.pass.cpp/link-success.link.pass.cpp libcxx/test/selftest/link.pass.cpp/run-error.link.pass.cpp libcxx/test/selftest/pass.cpp/compile-error.pass.cpp libcxx/test/selftest/pass.cpp/link-error.pass.cpp libcxx/test/selftest/pass.cpp/run-error.pass.cpp libcxx/test/selftest/pass.cpp/run-success.pass.cpp libcxx/test/selftest/pass.cpp/werror.pass.cpp libcxx/test/selftest/remote-substitutions.sh.cpp libcxx/test/selftest/sh.cpp/run-error.sh.cpp libcxx/test/selftest/sh.cpp/run-success.sh.cpp libcxx/test/selftest/sh.cpp/substitutions.sh.cpp libcxx/test/selftest/sh.cpp/werror.sh.cpp libcxx/test/selftest/shell-no-escape-builtins.sh.cpp libcxx/test/selftest/stdin-is-piped.sh.cpp libcxx/test/selftest/test_macros.pass.cpp libcxx/test/selftest/tmpdir-exists.sh.cpp libcxx/test/selftest/verify.cpp/no-diagnostics-unmarked.verify.cpp libcxx/test/selftest/verify.cpp/no-diagnostics.verify.cpp libcxx/test/selftest/verify.cpp/no-werror.verify.cpp libcxx/test/selftest/verify.cpp/right-diagnostic.verify.cpp libcxx/test/selftest/verify.cpp/wrong-diagnostic.verify.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/test/selftest/compile.fail.cpp/compile-error.compile.fail.cpp b/libcxx/test/selftest/compile.fail.cpp/compile-error.compile.fail.cpp
index 9390f7c8e..31781f94e 100644
--- a/libcxx/test/selftest/compile.fail.cpp/compile-error.compile.fail.cpp
+++ b/libcxx/test/selftest/compile.fail.cpp/compile-error.compile.fail.cpp
@@ -8,7 +8,7 @@
 
 // Make sure the test passes if it fails at compile-time
 
-struct Foo { };
+struct Foo {};
 typedef Foo::x x;
 
 int main(int, char**) { return 0; }
diff --git a/libcxx/test/selftest/compile.pass.cpp/compile-error.compile.pass.cpp b/libcxx/test/selftest/compile.pass.cpp/compile-error.compile.pass.cpp
index 6ff885053..e564b0fcf 100644
--- a/libcxx/test/selftest/compile.pass.cpp/compile-error.compile.pass.cpp
+++ b/libcxx/test/selftest/compile.pass.cpp/compile-error.compile.pass.cpp
@@ -10,7 +10,7 @@
 
 // Make sure the test DOES NOT pass if it fails at compile-time
 
-struct Foo { };
+struct Foo {};
 typedef Foo::x x;
 
 int main(int, char**) { return 0; }
diff --git a/libcxx/test/selftest/compile.pass.cpp/link-error.compile.pass.cpp b/libcxx/test/selftest/compile.pass.cpp/link-error.compile.pass.cpp
index b5f6e5df1..a919652dd 100644
--- a/libcxx/test/selftest/compile.pass.cpp/link-error.compile.pass.cpp
+++ b/libcxx/test/selftest/compile.pass.cpp/link-error.compile.pass.cpp
@@ -11,6 +11,6 @@
 extern void this_is_an_undefined_symbol();
 
 int main(int, char**) {
-    this_is_an_undefined_symbol();
-    return 0;
+  this_is_an_undefined_symbol();
+  return 0;
 }
diff --git a/libcxx/test/selftest/compile.pass.cpp/run-error.compile.pass.cpp b/libcxx/test/selftest/compile.pass.cpp/run-error.compile.pass.cpp
index dd1f084f6..29ea4ec0d 100644
--- a/libcxx/test/selftest/compile.pass.cpp/run-error.compile.pass.cpp
+++ b/libcxx/test/selftest/compile.pass.cpp/run-error.compile.pass.cpp
@@ -8,6 +8,4 @@
 
 // Make sure the test passes even if there's a runtime error, i.e. it isn't run.
 
-int main(int, char**) {
-    return 1;
-}
+int main(int, char**) { return 1; }
diff --git a/libcxx/test/selftest/link.fail.cpp/compile-error.link.fail.cpp b/libcxx/test/selftest/link.fail.cpp/compile-error.link.fail.cpp
index 607be79b8..4fa6873dc 100644
--- a/libcxx/test/selftest/link.fail.cpp/compile-error.link.fail.cpp
+++ b/libcxx/test/selftest/link.fail.cpp/compile-error.link.fail.cpp
@@ -10,7 +10,7 @@
 
 // Make sure the test DOES NOT pass if it fails at compile-time.
 
-struct Foo { };
+struct Foo {};
 typedef Foo::x x;
 
 int main(int, char**) { return 0; }
diff --git a/libcxx/test/selftest/link.fail.cpp/link-error.link.fail.cpp b/libcxx/test/selftest/link.fail.cpp/link-error.link.fail.cpp
index 728940672..212bbe9f7 100644
--- a/libcxx/test/selftest/link.fail.cpp/link-error.link.fail.cpp
+++ b/libcxx/test/selftest/link.fail.cpp/link-error.link.fail.cpp
@@ -11,6 +11,6 @@
 extern void this_is_an_undefined_symbol();
 
 int main(int, char**) {
-    this_is_an_undefined_symbol();
-    return 0;
+  this_is_an_undefined_symbol();
+  return 0;
 }
diff --git a/libcxx/test/selftest/link.pass.cpp/compile-error.link.pass.cpp b/libcxx/test/selftest/link.pass.cpp/compile-error.link.pass.cpp
index 607be79b8..4fa6873dc 100644
--- a/libcxx/test/selftest/link.pass.cpp/compile-error.link.pass.cpp
+++ b/libcxx/test/selftest/link.pass.cpp/compile-error.link.pass.cpp
@@ -10,7 +10,7 @@
 
 // Make sure the test DOES NOT pass if it fails at compile-time.
 
-struct Foo { };
+struct Foo {};
 typedef Foo::x x;
 
 int main(int, char**) { return 0; }
diff --git a/libcxx/test/selftest/link.pass.cpp/link-error.link.pass.cpp b/libcxx/test/selftest/link.pass.cpp/link-error.link.pass.cpp
index 422c9a16a..a7928c608 100644
--- a/libcxx/test/selftest/link.pass.cpp/link-error.link.pass.cpp
+++ b/libcxx/test/selftest/link.pass.cpp/link-error.link.pass.cpp
@@ -13,6 +13,6 @@
 extern void this_is_an_undefined_symbol();
 
 int main(int, char**) {
-    this_is_an_undefined_symbol();
-    return 0;
+  this_is_an_undefined_symbol();
+  return 0;
 }
diff --git a/libcxx/test/selftest/link.pass.cpp/run-error.link.pass.cpp b/libcxx/test/selftest/link.pass.cpp/run-error.link.pass.cpp
index ee44d1798..819dbf543 100644
--- a/libcxx/test/selftest/link.pass.cpp/run-error.link.pass.cpp
+++ b/libcxx/test/selftest/link.pass.cpp/run-error.link.pass.cpp
@@ -9,6 +9,4 @@
 // Make sure the test passes if it succeeds to link, even though it would have
 // failed at runtime.
 
-int main(int, char**) {
-    return 1;
-}
+int main(int, char**) { return 1; }
diff --git a/libcxx/test/selftest/pass.cpp/compile-error.pass.cpp b/libcxx/test/selftest/pass.cpp/compile-error.pass.cpp
index 6ff885053..e564b0fcf 100644
--- a/libcxx/test/selftest/pass.cpp/compile-error.pass.cpp
+++ b/libcxx/test/selftest/pass.cpp/compile-error.pass.cpp
@@ -10,7 +10,7 @@
 
 // Make sure the test DOES NOT pass if it fails at compile-time
 
-struct Foo { };
+struct Foo {};
 typedef Foo::x x;
 
 int main(int, char**) { return 0; }
diff --git a/libcxx/test/selftest/pass.cpp/link-error.pass.cpp b/libcxx/test/selftest/pass.cpp/link-error.pass.cpp
index 70e2ab66e..38ae1dc55 100644
--- a/libcxx/test/selftest/pass.cpp/link-error.pass.cpp
+++ b/libcxx/test/selftest/pass.cpp/link-error.pass.cpp
@@ -13,6 +13,6 @@
 extern void this_is_an_undefined_symbol();
 
 int main(int, char**) {
-    this_is_an_undefined_symbol();
-    return 0;
+  this_is_an_undefined_symbol();
+  return 0;
 }
diff --git a/libcxx/test/selftest/pass.cpp/run-error.pass.cpp b/libcxx/test/selftest/pass.cpp/run-error.pass.cpp
index eac7d8846..8ef0c35f3 100644
--- a/libcxx/test/selftest/pass.cpp/run-error.pass.cpp
+++ b/libcxx/test/selftest/pass.cpp/run-error.pass.cpp
@@ -10,6 +10,4 @@
 
 // Make sure the test DOES NOT pass if it fails at runtime.
 
-int main(int, char**) {
-    return 1;
-}
+int main(int, char**) { return 1; }
diff --git a/libcxx/test/selftest/pass.cpp/run-success.pass.cpp b/libcxx/test/selftest/pass.cpp/run-success.pass.cpp
index c37b79a99..4c41e7510 100644
--- a/libcxx/test/selftest/pass.cpp/run-success.pass.cpp
+++ b/libcxx/test/selftest/pass.cpp/run-success.pass.cpp
@@ -8,6 +8,4 @@
 
 // Make sure the test passes pass if it succeeds at runtime.
 
-int main(int, char**) {
-    return 0;
-}
+int main(int, char**) { return 0; }
diff --git a/libcxx/test/selftest/pass.cpp/werror.pass.cpp b/libcxx/test/selftest/pass.cpp/werror.pass.cpp
index 590785fc1..e08160d6a 100644
--- a/libcxx/test/selftest/pass.cpp/werror.pass.cpp
+++ b/libcxx/test/selftest/pass.cpp/werror.pass.cpp
@@ -17,6 +17,4 @@
 // TODO: We don't enable -Werror on GCC right now, because too many tests fail.
 // UNSUPPORTED: gcc
 
-int main(int, char**) {
-    int foo;
-}
+int main(int, char**) { int foo; }
diff --git a/libcxx/test/selftest/sh.cpp/werror.sh.cpp b/libcxx/test/selftest/sh.cpp/werror.sh.cpp
index 3188f57ec..b3ecf73a1 100644
--- a/libcxx/test/selftest/sh.cpp/werror.sh.cpp
+++ b/libcxx/test/selftest/sh.cpp/werror.sh.cpp
@@ -18,6 +18,6 @@
 // RUN: %{run}
 
 int main(int, char**) {
-    int foo;
-    return 0;
+  int foo;
+  return 0;
 }
diff --git a/libcxx/test/selftest/test_macros.pass.cpp b/libcxx/test/selftest/test_macros.pass.cpp
index 9bcf7cf9a..86954d843 100644
--- a/libcxx/test/selftest/test_macros.pass.cpp
+++ b/libcxx/test/selftest/test_macros.pass.cpp
@@ -14,28 +14,25 @@
 #include "test_macros.h"
 
 #ifndef TEST_STD_VER
-#error TEST_STD_VER must be defined
+#  error TEST_STD_VER must be defined
 #endif
 
 #ifndef TEST_NOEXCEPT
-#error TEST_NOEXCEPT must be defined
+#  error TEST_NOEXCEPT must be defined
 #endif
 
 #ifndef LIBCPP_ASSERT
-#error LIBCPP_ASSERT must be defined
+#  error LIBCPP_ASSERT must be defined
 #endif
 
 #ifndef LIBCPP_STATIC_ASSERT
-#error LIBCPP_STATIC_ASSERT must be defined
+#  error LIBCPP_STATIC_ASSERT must be defined
 #endif
 
-void test_noexcept() TEST_NOEXCEPT
-{
-}
+void test_noexcept() TEST_NOEXCEPT {}
 
-int main(int, char**)
-{
-    test_noexcept();
+int main(int, char**) {
+  test_noexcept();
 
-    return 0;
+  return 0;
 }
diff --git a/libcxx/test/selftest/verify.cpp/no-werror.verify.cpp b/libcxx/test/selftest/verify.cpp/no-werror.verify.cpp
index e96d6be90..12d753949 100644
--- a/libcxx/test/selftest/verify.cpp/no-werror.verify.cpp
+++ b/libcxx/test/selftest/verify.cpp/no-werror.verify.cpp
@@ -11,5 +11,5 @@
 // ADDITIONAL_COMPILE_FLAGS: -Wunused-variable
 
 void f() {
-    int foo; // expected-warning {{unused variable}}
+  int foo; // expected-warning {{unused variable}}
 }
diff --git a/libcxx/test/selftest/verify.cpp/right-diagnostic.verify.cpp b/libcxx/test/selftest/verify.cpp/right-diagnostic.verify.cpp
index 8bca56870..9ed7a978e 100644
--- a/libcxx/test/selftest/verify.cpp/right-diagnostic.verify.cpp
+++ b/libcxx/test/selftest/verify.cpp/right-diagnostic.verify.cpp
@@ -8,5 +8,5 @@
 
 // Make sure the test passes if the expected diagnostic is correct.
 
-struct Foo { };
+struct Foo {};
 typedef Foo::x x; // expected-error{{no type named 'x' in 'Foo'}}
diff --git a/libcxx/test/selftest/verify.cpp/wrong-diagnostic.verify.cpp b/libcxx/test/selftest/verify.cpp/wrong-diagnostic.verify.cpp
index 3bc2ba841..493a133cd 100644
--- a/libcxx/test/selftest/verify.cpp/wrong-diagnostic.verify.cpp
+++ b/libcxx/test/selftest/verify.cpp/wrong-diagnostic.verify.cpp
@@ -10,5 +10,5 @@
 
 // Make sure the test DOES NOT pass if the expected diagnostic is wrong.
 
-struct Foo { };
+struct Foo {};
 typedef Foo::x x; // expected-error{{this is not found in the errors}}

``````````

</details>


https://github.com/llvm/llvm-project/pull/144852


More information about the libcxx-commits mailing list