From fb0990ef04ab3c3f56bb6399403fc563b9dc89f8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 17 Apr 2024 12:05:29 -0400 Subject: Tests/CompileFeatures: Cover cuda_std_## meta-features --- .gitlab/ci/configure_cuda12.2_clang.cmake | 1 + .gitlab/ci/configure_cuda12.2_nvidia.cmake | 1 + Tests/CMakeLists.txt | 2 ++ Tests/CompileFeatures/CMakeLists.txt | 8 +++++++- Tests/CompileFeatures/cuda_std_03.cu | 0 Tests/CompileFeatures/cuda_std_11.cu | 4 ++++ Tests/CompileFeatures/cuda_std_14.cu | 4 ++++ Tests/CompileFeatures/cuda_std_17.cu | 4 ++++ Tests/CompileFeatures/cuda_std_20.cu | 4 ++++ Tests/CompileFeatures/cuda_std_23.cu | 4 ++++ Tests/CompileFeatures/cuda_std_26.cu | 4 ++++ 11 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 Tests/CompileFeatures/cuda_std_03.cu create mode 100644 Tests/CompileFeatures/cuda_std_11.cu create mode 100644 Tests/CompileFeatures/cuda_std_14.cu create mode 100644 Tests/CompileFeatures/cuda_std_17.cu create mode 100644 Tests/CompileFeatures/cuda_std_20.cu create mode 100644 Tests/CompileFeatures/cuda_std_23.cu create mode 100644 Tests/CompileFeatures/cuda_std_26.cu diff --git a/.gitlab/ci/configure_cuda12.2_clang.cmake b/.gitlab/ci/configure_cuda12.2_clang.cmake index e13ca88..8f10f86 100644 --- a/.gitlab/ci/configure_cuda12.2_clang.cmake +++ b/.gitlab/ci/configure_cuda12.2_clang.cmake @@ -1,3 +1,4 @@ set(CMake_TEST_CUDA "Clang" CACHE STRING "") +set(CMake_TEST_CUDA_STANDARDS "03;11;14;17;20;23" CACHE STRING "") include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake") diff --git a/.gitlab/ci/configure_cuda12.2_nvidia.cmake b/.gitlab/ci/configure_cuda12.2_nvidia.cmake index 2cb2950..51a2511 100644 --- a/.gitlab/ci/configure_cuda12.2_nvidia.cmake +++ b/.gitlab/ci/configure_cuda12.2_nvidia.cmake @@ -1,4 +1,5 @@ set(CMake_TEST_CUDA "NVIDIA" CACHE STRING "") set(CMake_TEST_CUDA_CUPTI "ON" CACHE STRING "") +set(CMake_TEST_CUDA_STANDARDS "03;11;14;17;20" CACHE STRING "") include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake") diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 42d958c..5d9d193 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -395,10 +395,12 @@ if(BUILD_TESTING) string(REPLACE ";" "$" TEST_STDS_C "${CMake_TEST_C_STANDARDS}") string(REPLACE ";" "$" TEST_STDS_CXX "${CMake_TEST_CXX_STANDARDS}") + string(REPLACE ";" "$" TEST_STDS_CUDA "${CMake_TEST_CUDA_STANDARDS}") set(CompileFeatures_BUILD_OPTIONS -DCMake_TEST_C_STANDARDS=${TEST_STDS_C} -DCMake_TEST_CXX_STANDARDS=${TEST_STDS_CXX} -DCMake_TEST_CUDA=${CMake_TEST_CUDA} + -DCMake_TEST_CUDA_STANDARDS=${TEST_STDS_CUDA} ) ADD_TEST_MACRO(CompileFeatures CompileFeatures) set_property(TEST CompileFeatures APPEND PROPERTY LABELS "CUDA") diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index 8f118f3..469a085 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -9,7 +9,13 @@ set(ext_CXX cpp) set(std_C 90 99 11 17 23) set(std_CXX 98 11 14 17 20 23 26) -foreach(lang C CXX) +if(CMake_TEST_CUDA) + enable_language(CUDA) + set(ext_CUDA cu) + set(std_CUDA 03 11 14 17 20 23 26) +endif() + +foreach(lang C CXX CUDA) foreach(std IN LISTS std_${lang}) string(TOLOWER "${lang}_std_${std}" feature) if("${std}" IN_LIST CMake_TEST_${lang}_STANDARDS diff --git a/Tests/CompileFeatures/cuda_std_03.cu b/Tests/CompileFeatures/cuda_std_03.cu new file mode 100644 index 0000000..e69de29 diff --git a/Tests/CompileFeatures/cuda_std_11.cu b/Tests/CompileFeatures/cuda_std_11.cu new file mode 100644 index 0000000..76813fd --- /dev/null +++ b/Tests/CompileFeatures/cuda_std_11.cu @@ -0,0 +1,4 @@ +#include "cxx_std.h" +#if defined(CXX_STD) && CXX_STD < CXX_STD_11 +# error "cuda_std_11 not honored" +#endif diff --git a/Tests/CompileFeatures/cuda_std_14.cu b/Tests/CompileFeatures/cuda_std_14.cu new file mode 100644 index 0000000..53e23c8 --- /dev/null +++ b/Tests/CompileFeatures/cuda_std_14.cu @@ -0,0 +1,4 @@ +#include "cxx_std.h" +#if defined(CXX_STD) && CXX_STD <= CXX_STD_11 +# error "cuda_std_14 not honored" +#endif diff --git a/Tests/CompileFeatures/cuda_std_17.cu b/Tests/CompileFeatures/cuda_std_17.cu new file mode 100644 index 0000000..502defb --- /dev/null +++ b/Tests/CompileFeatures/cuda_std_17.cu @@ -0,0 +1,4 @@ +#include "cxx_std.h" +#if defined(CXX_STD) && CXX_STD <= CXX_STD_14 +# error "cuda_std_17 not honored" +#endif diff --git a/Tests/CompileFeatures/cuda_std_20.cu b/Tests/CompileFeatures/cuda_std_20.cu new file mode 100644 index 0000000..afdd3ba --- /dev/null +++ b/Tests/CompileFeatures/cuda_std_20.cu @@ -0,0 +1,4 @@ +#include "cxx_std.h" +#if defined(CXX_STD) && CXX_STD <= CXX_STD_17 +# error "cuda_std_20 not honored" +#endif diff --git a/Tests/CompileFeatures/cuda_std_23.cu b/Tests/CompileFeatures/cuda_std_23.cu new file mode 100644 index 0000000..6bdaeb9 --- /dev/null +++ b/Tests/CompileFeatures/cuda_std_23.cu @@ -0,0 +1,4 @@ +#include "cxx_std.h" +#if defined(CXX_STD) && CXX_STD <= CXX_STD_20 +# error "cuda_std_23 not honored" +#endif diff --git a/Tests/CompileFeatures/cuda_std_26.cu b/Tests/CompileFeatures/cuda_std_26.cu new file mode 100644 index 0000000..efeca8d --- /dev/null +++ b/Tests/CompileFeatures/cuda_std_26.cu @@ -0,0 +1,4 @@ +#include "cxx_std.h" +#if defined(CXX_STD) && CXX_STD <= CXX_STD_23 +# error "cuda_std_26 not honored" +#endif -- cgit v0.12