[Openmp-commits] [openmp] b845217 - [OpenMP][libomptarget] Separate lit tests for different offloading targets (1/2)

Joachim Protze via Openmp-commits openmp-commits at lists.llvm.org
Tue Apr 27 03:30:09 PDT 2021


Author: Joachim Protze
Date: 2021-04-27T12:30:01+02:00
New Revision: b845217b1dadc3e30c13720be1dfacd17ea3cbae

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

LOG: [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

Added: 
    

Modified: 
    openmp/libomptarget/test/CMakeLists.txt
    openmp/libomptarget/test/lit.cfg
    openmp/libomptarget/test/lit.site.cfg.in

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/test/CMakeLists.txt b/openmp/libomptarget/test/CMakeLists.txt
index aa3fffcfe60ef..08425c7a09ec1 100644
--- a/openmp/libomptarget/test/CMakeLists.txt
+++ b/openmp/libomptarget/test/CMakeLists.txt
@@ -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 the lit.site.cfg.in file
+  set(AUTO_GEN_COMMENT "## Autogenerated by libomptarget configuration.\n# Do not edit!")
+  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})
\ No newline at end of file

diff  --git a/openmp/libomptarget/test/lit.cfg b/openmp/libomptarget/test/lit.cfg
index 6936bfa0c3195..af9df8db73597 100644
--- a/openmp/libomptarget/test/lit.cfg
+++ b/openmp/libomptarget/test/lit.cfg
@@ -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 + \

diff  --git a/openmp/libomptarget/test/lit.site.cfg.in b/openmp/libomptarget/test/lit.site.cfg.in
index 53c91c91def79..08acdd2907740 100644
--- a/openmp/libomptarget/test/lit.site.cfg.in
+++ b/openmp/libomptarget/test/lit.site.cfg.in
@@ -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@


        


More information about the Openmp-commits mailing list