[Openmp-commits] [PATCH] D29172: [libomptarget] Align test code with runtime/

Jonas Hahnfeld via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Jan 26 03:23:42 PST 2017


Hahnfeld created this revision.

This change allows setting `LIBOMPTARGET_LLVM_LIT_EXECUTABLE` and `LIBOMPTARGET_FILECHECK_EXECUTABLE` as full path. It also honors `OPENMP_LLVM_TOOLS_DIR` which is meant as a common configuration for both libomp and libomptarget.

Maybe this should be done in a common CMake module, but I'm no expert here.


https://reviews.llvm.org/D29172

Files:
  libomptarget/test/CMakeLists.txt
  libomptarget/test/lit.site.cfg.in


Index: libomptarget/test/lit.site.cfg.in
===================================================================
--- libomptarget/test/lit.site.cfg.in
+++ libomptarget/test/lit.site.cfg.in
@@ -13,7 +13,7 @@
 config.operating_system = "@CMAKE_SYSTEM_NAME@"
 config.libomptarget_all_targets = "@LIBOMPTARGET_ALL_TARGETS@".split()
 config.libomptarget_system_targets = "@LIBOMPTARGET_SYSTEM_TARGETS@".split()
-config.libomptarget_filecheck = "@LIBOMPTARGET_FILECHECK@"
+config.libomptarget_filecheck = "@LIBOMPTARGET_FILECHECK_EXECUTABLE@"
 
 # Let the main config do the real work.
 lit_config.load_config(config, "@LIBOMPTARGET_BASE_DIR@/test/lit.cfg")
Index: libomptarget/test/CMakeLists.txt
===================================================================
--- libomptarget/test/CMakeLists.txt
+++ libomptarget/test/CMakeLists.txt
@@ -23,22 +23,22 @@
     "C++ compiler to use for testing OpenMP offloading library")
   set(LIBOMPTARGET_TEST_OPENMP_FLAG -fopenmp CACHE STRING
     "OpenMP compiler flag to use for testing OpenMP offloading library")
-  set(LIBOMPTARGET_LLVM_LIT_EXECUTABLE "" CACHE STRING
-    "Path to llvm-lit")
-  find_program(LIT_EXECUTABLE NAMES llvm-lit ${LIBOMPTARGET_LLVM_LIT_EXECUTABLE})
-  if(NOT LIT_EXECUTABLE)
+  find_program(LIBOMPTARGET_LLVM_LIT_EXECUTABLE
+    NAMES llvm-lit lit.py lit
+    PATHS ${OPENMP_LLVM_TOOLS_DIR})
+  if(NOT LIBOMPTARGET_LLVM_LIT_EXECUTABLE)
     libomptarget_say("Cannot find llvm-lit.")
-    libomptarget_say("Please put llvm-lit in your PATH or set LIBOMPTARGET_LLVM_LIT_EXECUTABLE to its full path")
+    libomptarget_say("Please put llvm-lit in your PATH or set LIBOMPTARGET_LLVM_LIT_EXECUTABLE to its full path or point OPENMP_LLVM_TOOLS_DIR to its directory")
     libomptarget_warning_say("The check-libomptarget target will not be available!")
     return()
   endif()
   
-  set(LIBOMPTARGET_FILECHECK_EXECUTABLE "" CACHE STRING
-    "Path to FileCheck")
-  find_program(LIBOMPTARGET_FILECHECK NAMES FileCheck ${LIBOMPTARGET_FILECHECK_EXECUTABLE})
-  if(NOT LIBOMPTARGET_FILECHECK)
+  find_program(LIBOMPTARGET_FILECHECK_EXECUTABLE
+    NAMES FileCheck
+    PATHS ${OPENMP_LLVM_TOOLS_DIR})
+  if(NOT LIBOMPTARGET_FILECHECK_EXECUTABLE)
     libomptarget_say("Cannot find FileCheck.")
-    libomptarget_say("Please put FileCheck in your PATH or set LIBOMPTARGET_FILECHECK_EXECUTABLE to its full path")
+    libomptarget_say("Please put FileCheck in your PATH or set LIBOMPTARGET_FILECHECK_EXECUTABLE to its full path or point OPENMP_LLVM_TOOLS_DIR to its directory")
     libomptarget_warning_say("The check-libomptarget target will not be available!")
     return()
   endif()
@@ -55,7 +55,7 @@
     "Default options for lit")
   separate_arguments(LIBOMPTARGET_LIT_ARGS)
   add_custom_target(check-libomptarget
-    COMMAND ${PYTHON_EXECUTABLE} ${LIT_EXECUTABLE} ${LIBOMPTARGET_LIT_ARGS} ${CMAKE_CURRENT_BINARY_DIR}
+    COMMAND ${PYTHON_EXECUTABLE} ${LIBOMPTARGET_LLVM_LIT_EXECUTABLE} ${LIBOMPTARGET_LIT_ARGS} ${CMAKE_CURRENT_BINARY_DIR}
     DEPENDS omptarget
     COMMENT "Running libomptarget tests"
     ${cmake_3_2_USES_TERMINAL}
@@ -70,7 +70,7 @@
   if(NOT MSVC)
     set(LIBOMPTARGET_TEST_C_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
     set(LIBOMPTARGET_TEST_CXX_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++)
-    set(LIBOMPTARGET_FILECHECK ${LLVM_RUNTIME_OUTPUT_INTDIR}/FileCheck)
+    set(LIBOMPTARGET_FILECHECK_EXECUTABLE ${LLVM_RUNTIME_OUTPUT_INTDIR}/FileCheck)
   else()
     libomptarget_warning_say("Not prepared to run tests on Windows systems.")
   endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29172.85881.patch
Type: text/x-patch
Size: 3549 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20170126/c3ab6e29/attachment.bin>


More information about the Openmp-commits mailing list