[libc-commits] [libc] [libc] Replace check-libc with lit-based test execution (PR #184163)

Jeff Bailey via libc-commits libc-commits at lists.llvm.org
Wed Apr 22 04:48:07 PDT 2026


https://github.com/kaladron updated https://github.com/llvm/llvm-project/pull/184163

>From cb79e4cd6a5347b2ec23b4d16d82ba7a8798c9ee Mon Sep 17 00:00:00 2001
From: Jeff Bailey <jeffbailey at google.com>
Date: Mon, 2 Mar 2026 16:14:10 +0000
Subject: [PATCH 1/5] [libc] Replace check-libc with lit-based test execution

Now that check-libc-lit has been validated alongside check-libc,
make lit the default test runner by renaming check-libc-lit to
check-libc. Remove the old CMake-driven check-libc custom target.
---
 libc/test/CMakeLists.txt | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libc/test/CMakeLists.txt b/libc/test/CMakeLists.txt
index dcfae50790c2e..9382ab4168c95 100644
--- a/libc/test/CMakeLists.txt
+++ b/libc/test/CMakeLists.txt
@@ -1,11 +1,6 @@
-add_custom_target(check-libc)
 add_custom_target(libc-unit-tests)
 add_custom_target(libc-hermetic-tests)
 
-if (TARGET check-hdrgen)
-  add_dependencies(check-libc check-hdrgen)
-endif()
-
 add_custom_target(exhaustive-check-libc)
 add_custom_target(libc-long-running-tests)
 
@@ -31,11 +26,16 @@ configure_lit_site_cfg(
   "CMAKE_CROSSCOMPILING_EMULATOR"
 )
 
-add_lit_testsuite(check-libc-lit
+add_lit_testsuite(check-libc
   "Running libc tests via lit"
   ${LIBC_BUILD_DIR}/test
 )
 
+if (TARGET check-hdrgen)
+  add_dependencies(check-libc check-hdrgen)
+endif()
+
+
 if(LIBC_ENABLE_UNITTESTS AND NOT LIBC_TEST_HERMETIC_TEST_ONLY)
   add_dependencies(check-libc libc-unit-tests)
   add_dependencies(check-libc-lit libc-unit-tests-build)

>From 659da59ce2b1e5f1e9dce928efdd64c0a9c21bc1 Mon Sep 17 00:00:00 2001
From: Jeff Bailey <jeffbailey at google.com>
Date: Tue, 3 Mar 2026 18:01:34 +0000
Subject: [PATCH 2/5] [libc] Remove old lit targets

---
 libc/test/include/CMakeLists.txt     | 1 -
 libc/test/integration/CMakeLists.txt | 1 -
 2 files changed, 2 deletions(-)

diff --git a/libc/test/include/CMakeLists.txt b/libc/test/include/CMakeLists.txt
index 1d5bc3d8da2c8..3ac5615d7e209 100644
--- a/libc/test/include/CMakeLists.txt
+++ b/libc/test/include/CMakeLists.txt
@@ -1,6 +1,5 @@
 add_custom_target(libc_include_tests)
 add_dependencies(check-libc libc_include_tests)
-add_dependencies(check-libc-lit libc_include_tests-build)
 
 add_libc_test(
   assert_test
diff --git a/libc/test/integration/CMakeLists.txt b/libc/test/integration/CMakeLists.txt
index 4c9970cf364eb..7dbcc9544a0b9 100644
--- a/libc/test/integration/CMakeLists.txt
+++ b/libc/test/integration/CMakeLists.txt
@@ -1,6 +1,5 @@
 add_custom_target(libc-integration-tests)
 add_dependencies(check-libc libc-integration-tests)
-add_dependencies(check-libc-lit libc-integration-tests-build)
 
 function(add_libc_integration_test_suite name)
   add_custom_target(${name})

>From 81d872d0a326a50cec73b814153628a757d87e3e Mon Sep 17 00:00:00 2001
From: Jeff Bailey <jbailey at raspberryginger.com>
Date: Wed, 22 Apr 2026 09:28:17 +0100
Subject: [PATCH 3/5] [libc] Fixed NameError in format.py and resolved test
 CMake conflicts

---
 libc/test/CMakeLists.txt      | 5 +++--
 libc/utils/libctest/format.py | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libc/test/CMakeLists.txt b/libc/test/CMakeLists.txt
index 9382ab4168c95..ba5356ce49032 100644
--- a/libc/test/CMakeLists.txt
+++ b/libc/test/CMakeLists.txt
@@ -38,13 +38,14 @@ endif()
 
 if(LIBC_ENABLE_UNITTESTS AND NOT LIBC_TEST_HERMETIC_TEST_ONLY)
   add_dependencies(check-libc libc-unit-tests)
-  add_dependencies(check-libc-lit libc-unit-tests-build)
+  add_dependencies(check-libc libc-unit-tests-build)
 endif()
 if(LIBC_ENABLE_HERMETIC_TESTS AND NOT LIBC_TEST_UNIT_TEST_ONLY)
   add_dependencies(check-libc libc-hermetic-tests)
-  add_dependencies(check-libc-lit libc-hermetic-tests-build)
+  add_dependencies(check-libc libc-hermetic-tests-build)
 endif()
 
+
 add_subdirectory(UnitTest)
 
 if(LIBC_TARGET_OS_IS_GPU)
diff --git a/libc/utils/libctest/format.py b/libc/utils/libctest/format.py
index 37c7e16905be9..713f3e61850a3 100644
--- a/libc/utils/libctest/format.py
+++ b/libc/utils/libctest/format.py
@@ -194,9 +194,10 @@ def execute(self, test, litConfig):
             )
         else:
             out, err, exit_code = lit.util.executeCommand(
-                [test_path] + extra_args, cwd=exec_dir, env=env
+                [test_path] + test_args, cwd=exec_dir, env=env
             )
 
+
         if not exit_code:
             return lit.Test.PASS, ""
 

>From e42dd3e182f2832f40778a66efb88a78d2bcfa27 Mon Sep 17 00:00:00 2001
From: Jeff Bailey <jbailey at raspberryginger.com>
Date: Wed, 22 Apr 2026 09:49:40 +0100
Subject: [PATCH 4/5] [libc] Remove direct test execution dependencies from
 check-libc

Removed dependencies on targets that run tests directly from check-libc, keeping only dependencies on targets that build tests. This ensures tests are solely executed via Lit.

Modified:
* libc/test/CMakeLists.txt
* libc/test/include/CMakeLists.txt
* libc/test/integration/CMakeLists.txt
---
 libc/test/CMakeLists.txt             | 3 +--
 libc/test/include/CMakeLists.txt     | 3 ++-
 libc/test/integration/CMakeLists.txt | 3 ++-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/libc/test/CMakeLists.txt b/libc/test/CMakeLists.txt
index ba5356ce49032..8c32fb029521b 100644
--- a/libc/test/CMakeLists.txt
+++ b/libc/test/CMakeLists.txt
@@ -37,15 +37,14 @@ endif()
 
 
 if(LIBC_ENABLE_UNITTESTS AND NOT LIBC_TEST_HERMETIC_TEST_ONLY)
-  add_dependencies(check-libc libc-unit-tests)
   add_dependencies(check-libc libc-unit-tests-build)
 endif()
 if(LIBC_ENABLE_HERMETIC_TESTS AND NOT LIBC_TEST_UNIT_TEST_ONLY)
-  add_dependencies(check-libc libc-hermetic-tests)
   add_dependencies(check-libc libc-hermetic-tests-build)
 endif()
 
 
+
 add_subdirectory(UnitTest)
 
 if(LIBC_TARGET_OS_IS_GPU)
diff --git a/libc/test/include/CMakeLists.txt b/libc/test/include/CMakeLists.txt
index 3ac5615d7e209..c9140c22c3ab5 100644
--- a/libc/test/include/CMakeLists.txt
+++ b/libc/test/include/CMakeLists.txt
@@ -1,5 +1,6 @@
 add_custom_target(libc_include_tests)
-add_dependencies(check-libc libc_include_tests)
+add_dependencies(check-libc libc_include_tests-build)
+
 
 add_libc_test(
   assert_test
diff --git a/libc/test/integration/CMakeLists.txt b/libc/test/integration/CMakeLists.txt
index 7dbcc9544a0b9..425b7384b53fe 100644
--- a/libc/test/integration/CMakeLists.txt
+++ b/libc/test/integration/CMakeLists.txt
@@ -1,5 +1,6 @@
 add_custom_target(libc-integration-tests)
-add_dependencies(check-libc libc-integration-tests)
+add_dependencies(check-libc libc-integration-tests-build)
+
 
 function(add_libc_integration_test_suite name)
   add_custom_target(${name})

>From 0cf189aad028e6f009916063b531b725a94871b1 Mon Sep 17 00:00:00 2001
From: Jeff Bailey <jbailey at raspberryginger.com>
Date: Wed, 22 Apr 2026 12:47:39 +0100
Subject: [PATCH 5/5] [libc][NFC] Clean up extra blank lines in CMake and
 Python files

Removed extra blank lines that were inadvertently added during the lit migration in the following files:
* libc/test/CMakeLists.txt
* libc/test/include/CMakeLists.txt
* libc/test/integration/CMakeLists.txt
* libc/utils/libctest/format.py
---
 libc/test/CMakeLists.txt             | 3 ---
 libc/test/include/CMakeLists.txt     | 1 -
 libc/test/integration/CMakeLists.txt | 1 -
 libc/utils/libctest/format.py        | 1 -
 4 files changed, 6 deletions(-)

diff --git a/libc/test/CMakeLists.txt b/libc/test/CMakeLists.txt
index 8c32fb029521b..5c45467453354 100644
--- a/libc/test/CMakeLists.txt
+++ b/libc/test/CMakeLists.txt
@@ -35,7 +35,6 @@ if (TARGET check-hdrgen)
   add_dependencies(check-libc check-hdrgen)
 endif()
 
-
 if(LIBC_ENABLE_UNITTESTS AND NOT LIBC_TEST_HERMETIC_TEST_ONLY)
   add_dependencies(check-libc libc-unit-tests-build)
 endif()
@@ -43,8 +42,6 @@ if(LIBC_ENABLE_HERMETIC_TESTS AND NOT LIBC_TEST_UNIT_TEST_ONLY)
   add_dependencies(check-libc libc-hermetic-tests-build)
 endif()
 
-
-
 add_subdirectory(UnitTest)
 
 if(LIBC_TARGET_OS_IS_GPU)
diff --git a/libc/test/include/CMakeLists.txt b/libc/test/include/CMakeLists.txt
index c9140c22c3ab5..dc044a5848e7c 100644
--- a/libc/test/include/CMakeLists.txt
+++ b/libc/test/include/CMakeLists.txt
@@ -1,7 +1,6 @@
 add_custom_target(libc_include_tests)
 add_dependencies(check-libc libc_include_tests-build)
 
-
 add_libc_test(
   assert_test
   SUITE
diff --git a/libc/test/integration/CMakeLists.txt b/libc/test/integration/CMakeLists.txt
index 425b7384b53fe..0eb8bc38c4bf7 100644
--- a/libc/test/integration/CMakeLists.txt
+++ b/libc/test/integration/CMakeLists.txt
@@ -1,7 +1,6 @@
 add_custom_target(libc-integration-tests)
 add_dependencies(check-libc libc-integration-tests-build)
 
-
 function(add_libc_integration_test_suite name)
   add_custom_target(${name})
   add_dependencies(libc-integration-tests ${name})
diff --git a/libc/utils/libctest/format.py b/libc/utils/libctest/format.py
index 713f3e61850a3..cc38b4f17aca9 100644
--- a/libc/utils/libctest/format.py
+++ b/libc/utils/libctest/format.py
@@ -197,7 +197,6 @@ def execute(self, test, litConfig):
                 [test_path] + test_args, cwd=exec_dir, env=env
             )
 
-
         if not exit_code:
             return lit.Test.PASS, ""
 



More information about the libc-commits mailing list