[libc-commits] [libc] d9c1dbc - [libc] Remove startup option from integration tests

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Thu Mar 16 10:38:50 PDT 2023


Author: Joseph Huber
Date: 2023-03-16T12:38:41-05:00
New Revision: d9c1dbc204011083d6194731bf3ac8ade677ac70

URL: https://github.com/llvm/llvm-project/commit/d9c1dbc204011083d6194731bf3ac8ade677ac70
DIFF: https://github.com/llvm/llvm-project/commit/d9c1dbc204011083d6194731bf3ac8ade677ac70.diff

LOG: [libc] Remove startup option from integration tests

This generalizes handling of the integration tests. We now implicitly
depend on the `libc.startup.${LIBC_TARGET_OS}.crt1` file rather than
passing it in manually. This simplifies the interface.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D146237

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCTestRules.cmake
    libc/test/integration/src/__support/threads/CMakeLists.txt
    libc/test/integration/src/pthread/CMakeLists.txt
    libc/test/integration/src/spawn/CMakeLists.txt
    libc/test/integration/src/stdio/CMakeLists.txt
    libc/test/integration/src/stdlib/CMakeLists.txt
    libc/test/integration/src/threads/CMakeLists.txt
    libc/test/integration/src/unistd/CMakeLists.txt
    libc/test/integration/startup/linux/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 6054f46bfb541..19a0c3bd03b66 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -402,7 +402,6 @@ endfunction(add_libc_fuzzer)
 #     SUITE <the suite to which the test should belong>
 #     SRCS <src1.cpp> [src2.cpp ...]
 #     HDRS [hdr1.cpp ...]
-#     STARTUP <fully qualified startup system target name>
 #     DEPENDS <list of entrypoint or other object targets>
 #     ARGS <list of command line arguments to be passed to the test>
 #     ENV <list of environment variables to set before running the test>
@@ -420,7 +419,7 @@ function(add_integration_test test_name)
   cmake_parse_arguments(
     "INTEGRATION_TEST"
     "" # No optional arguments
-    "SUITE;STARTUP" # Single value arguments
+    "SUITE" # Single value arguments
     "SRCS;HDRS;DEPENDS;ARGS;ENV;COMPILE_OPTIONS" # Multi-value arguments
     ${ARGN}
   )
@@ -428,20 +427,20 @@ function(add_integration_test test_name)
   if(NOT INTEGRATION_TEST_SUITE)
     message(FATAL_ERROR "SUITE not specified for ${fq_target_name}")
   endif()
-  if(NOT INTEGRATION_TEST_STARTUP)
-    message(FATAL_ERROR "The STARTUP to link to the integration test is missing.")
-  endif()
   if(NOT INTEGRATION_TEST_SRCS)
     message(FATAL_ERROR "The SRCS list for add_integration_test is missing.")
   endif()
+  if(NOT TARGET libc.startup.${LIBC_TARGET_OS}.crt1)
+    message(FATAL_ERROR "The 'crt1' target for the integration test is missing.")
+  endif()
 
   get_fq_target_name(${test_name}.libc fq_libc_target_name)
 
   get_fq_deps_list(fq_deps_list ${INTEGRATION_TEST_DEPENDS})
   list(APPEND fq_deps_list
-      # All integration tests need to inherit the same dependencies as the
-      # startup code.
-      ${INTEGRATION_TEST_STARTUP}
+      # All integration tests use the operating system's startup object and need
+      # to inherit the same dependencies.
+      libc.startup.${LIBC_TARGET_OS}.crt1
       # We always add the memory functions objects. This is because the
       # compiler's codegen can emit calls to the C memory functions.
       libc.src.string.bcmp

diff  --git a/libc/test/integration/src/__support/threads/CMakeLists.txt b/libc/test/integration/src/__support/threads/CMakeLists.txt
index 592c0b31261f3..5a12d28ada3fd 100644
--- a/libc/test/integration/src/__support/threads/CMakeLists.txt
+++ b/libc/test/integration/src/__support/threads/CMakeLists.txt
@@ -11,8 +11,6 @@ add_integration_test(
     libc-support-threads-integration-tests
   SRCS
     thread_detach_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.src.__support.threads.mutex
     libc.src.__support.threads.thread
@@ -24,8 +22,6 @@ add_integration_test(
     libc-support-threads-integration-tests
   SRCS
     thread_tls_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.src.__support.threads.thread
 )

diff  --git a/libc/test/integration/src/pthread/CMakeLists.txt b/libc/test/integration/src/pthread/CMakeLists.txt
index a6a1690f609ba..106cac8e4d802 100644
--- a/libc/test/integration/src/pthread/CMakeLists.txt
+++ b/libc/test/integration/src/pthread/CMakeLists.txt
@@ -6,8 +6,6 @@ add_integration_test(
     libc-pthread-integration-tests
   SRCS
     pthread_mutex_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.include.pthread
     libc.src.errno.errno
@@ -25,8 +23,6 @@ add_integration_test(
     libc-pthread-integration-tests
   SRCS
     pthread_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.include.pthread
     libc.src.pthread.pthread_create
@@ -39,8 +35,6 @@ add_integration_test(
     libc-pthread-integration-tests
   SRCS
     pthread_equal_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.include.pthread
     libc.src.errno.errno
@@ -60,8 +54,6 @@ add_integration_test(
     libc-pthread-integration-tests
   SRCS
     pthread_name_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.include.errno
     libc.include.pthread
@@ -83,8 +75,6 @@ add_integration_test(
     libc-pthread-integration-tests
   SRCS
     pthread_exit_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.include.pthread
     libc.src.pthread.pthread_create
@@ -98,8 +88,6 @@ add_integration_test(
     libc-pthread-integration-tests
   SRCS
     pthread_tss_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.include.pthread
     libc.src.pthread.pthread_create
@@ -117,8 +105,6 @@ add_integration_test(
     libc-pthread-integration-tests
   SRCS
     pthread_once_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.include.pthread
     libc.src.pthread.pthread_once

diff  --git a/libc/test/integration/src/spawn/CMakeLists.txt b/libc/test/integration/src/spawn/CMakeLists.txt
index d6307cb2ad883..caed59fc1b7aa 100644
--- a/libc/test/integration/src/spawn/CMakeLists.txt
+++ b/libc/test/integration/src/spawn/CMakeLists.txt
@@ -26,8 +26,6 @@ add_integration_test(
     spawn-integration-tests
   SRCS
     posix_spawn_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc_posix_spawn_test_binary
     libc.test.integration.src.spawn.test_binary_properties

diff  --git a/libc/test/integration/src/stdio/CMakeLists.txt b/libc/test/integration/src/stdio/CMakeLists.txt
index ed9af297257b2..61caa2e5fa17b 100644
--- a/libc/test/integration/src/stdio/CMakeLists.txt
+++ b/libc/test/integration/src/stdio/CMakeLists.txt
@@ -9,8 +9,6 @@ add_integration_test(
     stdio-integration-tests
   SRCS
     sprintf_size_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.src.stdio.sprintf
   ARGS
@@ -26,8 +24,6 @@ add_integration_test(
     stdio-integration-tests
   SRCS
     sprintf_size_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   ARGS
     "%s %c %d"
     "First arg"

diff  --git a/libc/test/integration/src/stdlib/CMakeLists.txt b/libc/test/integration/src/stdlib/CMakeLists.txt
index 1f600f8dfa5c8..0985a80ce7a09 100644
--- a/libc/test/integration/src/stdlib/CMakeLists.txt
+++ b/libc/test/integration/src/stdlib/CMakeLists.txt
@@ -7,8 +7,6 @@ add_integration_test(
     stdlib-integration-tests
   SRCS
     getenv_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.src.stdlib.getenv
   ENV

diff  --git a/libc/test/integration/src/threads/CMakeLists.txt b/libc/test/integration/src/threads/CMakeLists.txt
index 5f9e49ed5a8d3..d74b923751ad6 100644
--- a/libc/test/integration/src/threads/CMakeLists.txt
+++ b/libc/test/integration/src/threads/CMakeLists.txt
@@ -6,8 +6,6 @@ add_integration_test(
     libc-threads-integration-tests
   SRCS
     mtx_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.include.threads
     libc.src.errno.errno
@@ -25,8 +23,6 @@ add_integration_test(
     libc-threads-integration-tests
   SRCS
     thrd_equal_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.include.threads
     libc.src.threads.mtx_destroy
@@ -45,8 +41,6 @@ add_integration_test(
     libc-threads-integration-tests
   SRCS
     thrd_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.include.threads
     libc.src.errno.errno
@@ -60,8 +54,6 @@ add_integration_test(
     libc-threads-integration-tests
   SRCS
     thrd_exit_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.include.threads
     libc.src.threads.thrd_create
@@ -75,8 +67,6 @@ add_integration_test(
     libc-threads-integration-tests
   SRCS
     tss_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.include.threads
     libc.src.threads.thrd_create
@@ -94,8 +84,6 @@ add_integration_test(
     libc-threads-integration-tests
   SRCS
     call_once_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.include.threads
     libc.src.threads.call_once
@@ -114,8 +102,6 @@ add_integration_test(
     libc-threads-integration-tests
   SRCS
     cnd_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.include.threads
     libc.src.threads.cnd_init

diff  --git a/libc/test/integration/src/unistd/CMakeLists.txt b/libc/test/integration/src/unistd/CMakeLists.txt
index 046dc6c4bfbfe..72fdb8fc7e6b0 100644
--- a/libc/test/integration/src/unistd/CMakeLists.txt
+++ b/libc/test/integration/src/unistd/CMakeLists.txt
@@ -7,8 +7,6 @@ add_integration_test(
     unistd-integration-tests
   SRCS
     getcwd_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.src.__support.CPP.string_view
     libc.src.errno.errno
@@ -22,8 +20,6 @@ add_integration_test(
     unistd-integration-tests
   SRCS
     fork_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc.include.errno
     libc.include.signal
@@ -67,8 +63,6 @@ add_integration_test(
     unistd-integration-tests
   SRCS
     execv_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc_execv_test_normal_exit
     libc_execv_test_signal_exit
@@ -86,8 +80,6 @@ add_integration_test(
     unistd-integration-tests
   SRCS
     execve_test.cpp
-  STARTUP
-    libc.startup.linux.crt1
   DEPENDS
     libc_execv_test_normal_exit
     libc_execv_test_signal_exit

diff  --git a/libc/test/integration/startup/linux/CMakeLists.txt b/libc/test/integration/startup/linux/CMakeLists.txt
index 675e8e3d1540b..6f0517a832d20 100644
--- a/libc/test/integration/startup/linux/CMakeLists.txt
+++ b/libc/test/integration/startup/linux/CMakeLists.txt
@@ -9,8 +9,6 @@ add_dependencies(libc-integration-tests libc-startup-tests)
 add_integration_test(
   startup_args_test
   SUITE libc-startup-tests
-  STARTUP
-    libc.startup.linux.crt1
   SRCS
     args_test.cpp
   ARGS
@@ -23,8 +21,6 @@ add_integration_test(
 add_integration_test(
   startup_no_envp_test
   SUITE libc-startup-tests
-  STARTUP
-    libc.startup.linux.crt1
   SRCS
     main_without_envp.cpp
 )
@@ -32,8 +28,6 @@ add_integration_test(
 add_integration_test(
   startup_no_args_test
   SUITE libc-startup-tests
-  STARTUP
-    libc.startup.linux.crt1
   SRCS
     main_without_args.cpp
 )
@@ -41,8 +35,6 @@ add_integration_test(
 add_integration_test(
   startup_tls_test
   SUITE libc-startup-tests
-  STARTUP
-    libc.startup.linux.crt1
   SRCS
     tls_test.cpp
   DEPENDS
@@ -55,8 +47,6 @@ add_integration_test(
 add_integration_test(
   init_fini_array_test
   SUITE libc-startup-tests
-  STARTUP
-    libc.startup.linux.crt1
   SRCS
     init_fini_array_test.cpp
 )


        


More information about the libc-commits mailing list