From 25f29b974182ae7da36ace86e846b4c0b2807a68 Mon Sep 17 00:00:00 2001
From: Benjamin Wozniak <benjamin.wozniak@intenta.de>
Date: Fri, 23 Aug 2019 08:32:28 +0200
Subject: cuda: Adapted tests to work with modified cuda toolset

- cuda version is only recognized if it contains no other characters
  than "0123456789."
- cuda path is only tested with dummy value . Otherwise a cuda toolkit
  must be copied to the integration test machine
---
 Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake           | 12 +++++++-----
 .../RunCMake/GeneratorToolset/TestToolsetCudaBoth-stdout.txt |  2 +-
 .../RunCMake/GeneratorToolset/TestToolsetCudaOnly-stdout.txt |  2 --
 Tests/RunCMake/GeneratorToolset/TestToolsetCudaOnly.cmake    |  2 --
 .../GeneratorToolset/TestToolsetCudaPathOnly-result.txt      |  1 +
 .../GeneratorToolset/TestToolsetCudaPathOnly-stderr.txt      | 12 ++++++++++++
 .../RunCMake/GeneratorToolset/TestToolsetCudaPathOnly.cmake  |  1 +
 .../GeneratorToolset/TestToolsetCudaVersionOnly-stdout.txt   |  2 ++
 .../GeneratorToolset/TestToolsetCudaVersionOnly.cmake        |  2 ++
 9 files changed, 26 insertions(+), 10 deletions(-)
 delete mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetCudaOnly-stdout.txt
 delete mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetCudaOnly.cmake
 create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-result.txt
 create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-stderr.txt
 create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly.cmake
 create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetCudaVersionOnly-stdout.txt
 create mode 100644 Tests/RunCMake/GeneratorToolset/TestToolsetCudaVersionOnly.cmake

diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake
index ef8fd25..ae75561 100644
--- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake
@@ -6,12 +6,14 @@ run_cmake(NoToolset)
 if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012456]")
   set(RunCMake_GENERATOR_TOOLSET "Test Toolset")
   run_cmake(TestToolset)
-  set(RunCMake_GENERATOR_TOOLSET "Test Toolset,cuda=Test Cuda")
+  set(RunCMake_GENERATOR_TOOLSET "Test Toolset,cuda=0.0")
   run_cmake(TestToolsetCudaBoth)
-  set(RunCMake_GENERATOR_TOOLSET ",cuda=Test Cuda")
-  run_cmake(TestToolsetCudaOnly)
-  set(RunCMake_GENERATOR_TOOLSET "cuda=Test Cuda")
-  run_cmake(TestToolsetCudaOnly)
+  set(RunCMake_GENERATOR_TOOLSET ",cuda=0.0")
+  run_cmake(TestToolsetCudaVersionOnly)
+  set(RunCMake_GENERATOR_TOOLSET "cuda=0.0")
+  run_cmake(TestToolsetCudaVersionOnly)
+  set(RunCMake_GENERATOR_TOOLSET "cuda=C:\\dummy\\cuda")
+  run_cmake(TestToolsetCudaPathOnly)
   if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[2456]")
     set(RunCMake_GENERATOR_TOOLSET "Test Toolset,host=x64")
     run_cmake(TestToolsetHostArchBoth)
diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaBoth-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaBoth-stdout.txt
index 90503e2..f12c123 100644
--- a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaBoth-stdout.txt
+++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaBoth-stdout.txt
@@ -1,2 +1,2 @@
 -- CMAKE_VS_PLATFORM_TOOLSET='Test Toolset'
--- CMAKE_VS_PLATFORM_TOOLSET_CUDA='Test Cuda'
+-- CMAKE_VS_PLATFORM_TOOLSET_CUDA='0.0'
diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaOnly-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaOnly-stdout.txt
deleted file mode 100644
index 94e1e43..0000000
--- a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaOnly-stdout.txt
+++ /dev/null
@@ -1,2 +0,0 @@
--- CMAKE_VS_PLATFORM_TOOLSET='(v[0-9]+|Windows7.1SDK)'
--- CMAKE_VS_PLATFORM_TOOLSET_CUDA='Test Cuda'
diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaOnly.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaOnly.cmake
deleted file mode 100644
index befa0af..0000000
--- a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaOnly.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-message(STATUS "CMAKE_VS_PLATFORM_TOOLSET='${CMAKE_VS_PLATFORM_TOOLSET}'")
-message(STATUS "CMAKE_VS_PLATFORM_TOOLSET_CUDA='${CMAKE_VS_PLATFORM_TOOLSET_CUDA}'")
diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-result.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-stderr.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-stderr.txt
new file mode 100644
index 0000000..b17745f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly-stderr.txt
@@ -0,0 +1,12 @@
+CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+  Generator
+
+    Visual Studio .*
+
+  given toolset
+
+    cuda=C:\\dummy\\cuda\\
+
+  cannot detect Visual Studio integration files in path
+
+    C:/dummy/cuda/CUDAVisualStudioIntegration/extras/visual_studio_integration/MSBuildExtensions
diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly.cmake
new file mode 100644
index 0000000..2fc38e5
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaPathOnly.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaVersionOnly-stdout.txt b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaVersionOnly-stdout.txt
new file mode 100644
index 0000000..1717ff8
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaVersionOnly-stdout.txt
@@ -0,0 +1,2 @@
+-- CMAKE_VS_PLATFORM_TOOLSET='(v[0-9]+|Windows7.1SDK)'
+-- CMAKE_VS_PLATFORM_TOOLSET_CUDA='0.0'
diff --git a/Tests/RunCMake/GeneratorToolset/TestToolsetCudaVersionOnly.cmake b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaVersionOnly.cmake
new file mode 100644
index 0000000..befa0af
--- /dev/null
+++ b/Tests/RunCMake/GeneratorToolset/TestToolsetCudaVersionOnly.cmake
@@ -0,0 +1,2 @@
+message(STATUS "CMAKE_VS_PLATFORM_TOOLSET='${CMAKE_VS_PLATFORM_TOOLSET}'")
+message(STATUS "CMAKE_VS_PLATFORM_TOOLSET_CUDA='${CMAKE_VS_PLATFORM_TOOLSET_CUDA}'")
-- 
cgit v0.12

