[OpenMP][libomptarget] Separate lit tests for different offloading targets (1/2)

This patch creates a separate test directory for each offloading target to be
tested. This allows to test multiple architectures in one configuration, while
still see all failing tests separately. The lit test names include the target
triple, so that it will be easier to spot the failing target.

This patch also allows to mark expected failing tests based on the
target-triple, as the currently used triple is added to the lit "features":
```
// XFAIL: nvptx64-nvidia-cuda
```

Differential Revision: https://reviews.llvm.org/D101315
This commit is contained in:
Joachim Protze 2021-04-27 12:23:18 +02:00
parent fb7be0d912
commit b845217b1d
3 changed files with 41 additions and 8 deletions

View File

@ -12,8 +12,15 @@ else()
set(LIBOMPTARGET_DEBUG False)
endif()
add_openmp_testsuite(check-libomptarget "Running libomptarget tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS omptarget omp ${LIBOMPTARGET_TESTED_PLUGINS})
string(REGEX MATCHALL "([^\ ]+\ |[^\ ]+$)" SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}")
foreach(CURRENT_TARGET IN LISTS SYSTEM_TARGETS)
string(STRIP "${CURRENT_TARGET}" CURRENT_TARGET)
add_openmp_testsuite(check-libomptarget-${CURRENT_TARGET} "Running libomptarget tests" ${CMAKE_CURRENT_BINARY_DIR}/${CURRENT_TARGET} DEPENDS omptarget omp ${LIBOMPTARGET_TESTED_PLUGINS})
list(APPEND LIBOMPTARGET_LIT_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CURRENT_TARGET})
# Configure the lit.site.cfg.in file
set(AUTO_GEN_COMMENT "## Autogenerated by libomptarget configuration.\n# Do not edit!")
configure_file(lit.site.cfg.in lit.site.cfg @ONLY)
configure_file(lit.site.cfg.in ${CURRENT_TARGET}/lit.site.cfg @ONLY)
endforeach()
add_openmp_testsuite(check-libomptarget "Running libomptarget tests" ${LIBOMPTARGET_LIT_TESTSUITES} EXCLUDE_FROM_CHECK_ALL DEPENDS omptarget omp ${LIBOMPTARGET_TESTED_PLUGINS})

View File

@ -24,7 +24,7 @@ def append_dynamic_library_path(name, value, sep):
config.environment[name] = value
# name: The name of this test suite.
config.name = 'libomptarget'
config.name = 'libomptarget :: ' + config.libomptarget_current_target
# suffixes: A list of file extensions to treat as test files.
config.suffixes = ['.c', '.cpp', '.cc']
@ -57,6 +57,8 @@ for feature in config.test_compiler_features:
if config.libomptarget_debug:
config.available_features.add('libomptarget-debug')
config.available_features.add(config.libomptarget_current_target)
# Setup environment to find dynamic library at runtime
if config.operating_system == 'Windows':
append_dynamic_library_path('PATH', config.library_dir, ";")
@ -84,7 +86,31 @@ else: # Unices
for libomptarget_target in config.libomptarget_all_targets:
# Is this target in the current system? If so create a compile, run and test
# command. Otherwise create command that return false.
if libomptarget_target in config.libomptarget_system_targets:
if libomptarget_target == config.libomptarget_current_target:
config.substitutions.append(("%libomptarget-compilexx-run-and-check-generic",
"%libomptarget-compilexx-run-and-check-" + libomptarget_target))
config.substitutions.append(("%libomptarget-compile-run-and-check-generic",
"%libomptarget-compile-run-and-check-" + libomptarget_target))
config.substitutions.append(("%libomptarget-compilexx-and-run-generic",
"%libomptarget-compilexx-and-run-" + libomptarget_target))
config.substitutions.append(("%libomptarget-compile-and-run-generic",
"%libomptarget-compile-and-run-" + libomptarget_target))
config.substitutions.append(("%libomptarget-compilexx-generic",
"%libomptarget-compilexx-" + libomptarget_target))
config.substitutions.append(("%libomptarget-compile-generic",
"%libomptarget-compile-" + libomptarget_target))
config.substitutions.append(("%libomptarget-run-generic",
"%libomptarget-run-" + libomptarget_target))
config.substitutions.append(("%libomptarget-run-fail-generic",
"%libomptarget-run-fail-" + libomptarget_target))
config.substitutions.append(("%clangxx-generic",
"%clangxx-" + libomptarget_target))
config.substitutions.append(("%clang-generic",
"%clang-" + libomptarget_target))
config.substitutions.append(("%fcheck-generic",
config.libomptarget_filecheck + " %s"))
config.substitutions.append(("%libomptarget-compilexx-run-and-check-" + \
libomptarget_target, \
"%libomptarget-compilexx-and-run-" + libomptarget_target + \

View File

@ -5,13 +5,13 @@ config.test_cxx_compiler = "@OPENMP_TEST_CXX_COMPILER@"
config.test_compiler_features = @OPENMP_TEST_COMPILER_FEATURES@
config.test_openmp_flags = "@OPENMP_TEST_OPENMP_FLAGS@"
config.test_extra_flags = "@OPENMP_TEST_FLAGS@"
config.libomptarget_obj_root = "@CMAKE_CURRENT_BINARY_DIR@"
config.libomptarget_obj_root = "@CMAKE_CURRENT_BINARY_DIR@/@CURRENT_TARGET@"
config.library_dir = "@LIBOMPTARGET_LIBRARY_DIR@"
config.omp_header_directory = "@LIBOMPTARGET_OPENMP_HEADER_FOLDER@"
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_current_target = "@CURRENT_TARGET@"
config.libomptarget_filecheck = "@OPENMP_FILECHECK_EXECUTABLE@"
config.libomptarget_not = "@OPENMP_NOT_EXECUTABLE@"
config.libomptarget_debug = @LIBOMPTARGET_DEBUG@