[libc-commits] [libc] e73fa20 - [libc] Actually run integration tests.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Thu Apr 20 13:10:53 PDT 2023


Author: Siva Chandra Reddy
Date: 2023-04-20T20:10:45Z
New Revision: e73fa20a637cfd8a3cb49f429b14561929fb2b58

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

LOG: [libc] Actually run integration tests.

After the switch to `add_custom_target` to run integration tests, most
of them were not actually being run because of the difference in the way
the COMMAND value is treated between `add_custom_target` and
`add_custom_command`. This patch gets the integration tests to run
again by passing the correct set of arguments to `add_custom_target`.

Reviewed By: michaelrj

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

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCTestRules.cmake

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 2322a158ada48..0757bd27cd392 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -529,12 +529,21 @@ function(add_integration_test test_name)
     get_target_property(gpu_loader_exe libc.utils.gpu.loader "EXECUTABLE")
   endif()
 
+  # We have to use a separate var to store the command as a list because
+  # the COMMAND option of `add_custom_target` cannot handle empty vars in the
+  # command. For example, if INTEGRATION_TEST_ENV is empty, the actual
+  # command also will not run. So, we use this list and tell `add_custom_target`
+  # to expand the list (by including the option COMMAND_EXPAND_LISTS). This
+  # makes `add_custom_target` construct the correct command and execute it.
+  set(test_cmd
+      ${INTEGRATION_TEST_ENV}
+      $<$<BOOL:${LIBC_TARGET_ARCHITECTURE_IS_GPU}>:${gpu_loader_exe}>
+      ${INTEGRATION_TEST_LOADER_ARGS}
+      $<TARGET_FILE:${fq_build_target_name}> ${INTEGRATION_TEST_ARGS})
   add_custom_target(
     ${fq_target_name}
-    COMMAND ${INTEGRATION_TEST_ENV}
-            $<$<BOOL:${LIBC_TARGET_ARCHITECTURE_IS_GPU}>:${gpu_loader_exe}>
-            ${INTEGRATION_TEST_LOADER_ARGS}
-            $<TARGET_FILE:${fq_build_target_name}> ${INTEGRATION_TEST_ARGS}
+    COMMAND ${test_cmd}
+    COMMAND_EXPAND_LISTS
     COMMENT "Running integration test ${fq_target_name}"
   )
   add_dependencies(${INTEGRATION_TEST_SUITE} ${fq_target_name})


        


More information about the libc-commits mailing list