[Openmp-commits] [openmp] 4504e11 - [OpenMP][CMake] Fix an issue when there is space in the argument LIBOMPTARGET_LIT_ARGS

Shilei Tian via Openmp-commits openmp-commits at lists.llvm.org
Sun Jul 18 18:54:21 PDT 2021


Author: Shilei Tian
Date: 2021-07-18T21:54:14-04:00
New Revision: 4504e1134c9118f3c322685f8a90129e09bab92c

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

LOG: [OpenMP][CMake] Fix an issue when there is space in the argument LIBOMPTARGET_LIT_ARGS

D106236 added a new CMake argument for `libomptarget` test, but when user's
input contains white spaces, CMake will add escape char to the final lit command,
which leads to an error. This patch converts the user's input `LIBOMPTARGET_LIT_ARGS`
into a local array, and then passes the array to the function.

Reviewed By: JonChesterfield

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

Added: 
    

Modified: 
    openmp/libomptarget/test/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/test/CMakeLists.txt b/openmp/libomptarget/test/CMakeLists.txt
index 9b6de8ba08df9..5cc9d241edb92 100644
--- a/openmp/libomptarget/test/CMakeLists.txt
+++ b/openmp/libomptarget/test/CMakeLists.txt
@@ -12,6 +12,10 @@ else()
   set(LIBOMPTARGET_DEBUG False)
 endif()
 
+# Replace the space from user's input with ";" in case that CMake add escape
+# char into the lit command.
+string(REPLACE " " ";" LIBOMPTARGET_LIT_ARG_LIST "${LIBOMPTARGET_LIT_ARGS}")
+
 string(REGEX MATCHALL "([^\ ]+\ |[^\ ]+$)" SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}")
 foreach(CURRENT_TARGET IN LISTS SYSTEM_TARGETS)
   string(STRIP "${CURRENT_TARGET}" CURRENT_TARGET)
@@ -19,7 +23,7 @@ foreach(CURRENT_TARGET IN LISTS SYSTEM_TARGETS)
     "Running libomptarget tests"
     ${CMAKE_CURRENT_BINARY_DIR}/${CURRENT_TARGET}
     DEPENDS omptarget omp ${LIBOMPTARGET_TESTED_PLUGINS}
-    ARGS ${LIBOMPTARGET_LIT_ARGS})
+    ARGS ${LIBOMPTARGET_LIT_ARG_LIST})
   list(APPEND LIBOMPTARGET_LIT_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CURRENT_TARGET})
 
   # Configure the lit.site.cfg.in file
@@ -33,4 +37,4 @@ add_openmp_testsuite(check-libomptarget
   ${LIBOMPTARGET_LIT_TESTSUITES}
   EXCLUDE_FROM_CHECK_ALL
   DEPENDS omptarget omp ${LIBOMPTARGET_TESTED_PLUGINS}
-  ARGS ${LIBOMPTARGET_LIT_ARGS})
+  ARGS ${LIBOMPTARGET_LIT_ARG_LIST})


        


More information about the Openmp-commits mailing list