Skip to content

Commit

Permalink
[libomptarget] Align test code with runtime/
Browse files Browse the repository at this point in the history
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.

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

llvm-svn: 294284
  • Loading branch information
Jonas Hahnfeld authored and Jonas Hahnfeld committed Feb 7, 2017
1 parent 5f1a2c2 commit a620a07
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions openmp/libomptarget/test/CMakeLists.txt
Expand Up @@ -23,22 +23,22 @@ if(${LIBOMPTARGET_STANDALONE_BUILD})
"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()
Expand All @@ -55,7 +55,7 @@ if(${LIBOMPTARGET_STANDALONE_BUILD})
"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}
Expand All @@ -70,7 +70,7 @@ else()
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()
Expand Down
2 changes: 1 addition & 1 deletion openmp/libomptarget/test/lit.site.cfg.in
Expand Up @@ -13,7 +13,7 @@ config.omp_host_rtl_directory = "@LIBOMPTARGET_OPENMP_HOST_RTL_FOLDER@"
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")
Expand Down

0 comments on commit a620a07

Please sign in to comment.