[libc-commits] [PATCH] D148786: [libc] Actually run integration tests.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Apr 20 00:57:26 PDT 2023


sivachandra created this revision.
sivachandra added reviewers: michaelrj, lntue.
Herald added subscribers: libc-commits, ecnelises, tschuett.
Herald added projects: libc-project, All.
sivachandra requested review of this revision.

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`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148786

Files:
  libc/cmake/modules/LLVMLibCTestRules.cmake


Index: libc/cmake/modules/LLVMLibCTestRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCTestRules.cmake
+++ libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -529,12 +529,21 @@
     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` to 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})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148786.515244.patch
Type: text/x-patch
Size: 1476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230420/c19ecb15/attachment.bin>


More information about the libc-commits mailing list