[Openmp-commits] [PATCH] D106247: [OpenMP][CMake] Fix an issue when there is space in the argument LIBOMPTARGET_LIT_ARGS

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sun Jul 18 14:03:30 PDT 2021


tianshilei1992 created this revision.
tianshilei1992 added reviewers: jdoerfert, JonChesterfield.
Herald added subscribers: guansong, yaxunl, mgorny.
tianshilei1992 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

D106236 <https://reviews.llvm.org/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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106247

Files:
  openmp/libomptarget/test/CMakeLists.txt


Index: openmp/libomptarget/test/CMakeLists.txt
===================================================================
--- openmp/libomptarget/test/CMakeLists.txt
+++ openmp/libomptarget/test/CMakeLists.txt
@@ -12,6 +12,10 @@
   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 " " ";" LIT_ARGS ${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 @@
     "Running libomptarget tests"
     ${CMAKE_CURRENT_BINARY_DIR}/${CURRENT_TARGET}
     DEPENDS omptarget omp ${LIBOMPTARGET_TESTED_PLUGINS}
-    ARGS ${LIBOMPTARGET_LIT_ARGS})
+    ARGS ${LIT_ARGS})
   list(APPEND LIBOMPTARGET_LIT_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CURRENT_TARGET})
 
   # Configure the lit.site.cfg.in file
@@ -33,4 +37,4 @@
   ${LIBOMPTARGET_LIT_TESTSUITES}
   EXCLUDE_FROM_CHECK_ALL
   DEPENDS omptarget omp ${LIBOMPTARGET_TESTED_PLUGINS}
-  ARGS ${LIBOMPTARGET_LIT_ARGS})
+  ARGS ${LIT_ARGS})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106247.359648.patch
Type: text/x-patch
Size: 1170 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210718/3adaaa3f/attachment.bin>


More information about the Openmp-commits mailing list