summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-11-01 20:24:36 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-11-01 20:24:54 (GMT)
commite06f186c2048b102ff9f822f3e972b9ca5bfa2c3 (patch)
tree193c87089fe359eb7c4623d710be369f2b898344 /Tests
parentdac334e35c0a47f9de5958554631954257bdb9fb (diff)
parent195d47e2139171cbae18a7164daac1f59be54ebe (diff)
downloadCMake-e06f186c2048b102ff9f822f3e972b9ca5bfa2c3.zip
CMake-e06f186c2048b102ff9f822f3e972b9ca5bfa2c3.tar.gz
CMake-e06f186c2048b102ff9f822f3e972b9ca5bfa2c3.tar.bz2
Merge topic 'vs-instance'
195d47e213 VS: Allow CMAKE_GENERATOR_INSTANCE to specify portable instance ec8d37b3b1 VS: Support version specification in CMAKE_GENERATOR_INSTANCE 8e6d930e8c VS: Parse comma-separated fields from CMAKE_GENERATOR_INSTANCE 5d1f377737 cmVSSetupHelper: Factor out helper to load MSVC toolset version 006fe1e919 cmVSSetupHelper: Convert wide to narrow strings early f5dfc788b8 cmVSSetupHelper: Drop unused InstanceId field 3213e2595d cmVSSetupHelper: Drop unused ullVersion field 152f9978dd Help: De-duplicate VS instance selection documentation Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6651
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-stderr.txt11
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadFieldDuplicate.cmake1
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadFieldNoComma-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadFieldNoComma-stderr.txt11
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadFieldNoComma.cmake1
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadFieldUnknown-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadFieldUnknown-stderr.txt11
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadFieldUnknown.cmake1
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadVersionFormat1-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadVersionFormat1-stderr.txt11
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadVersionFormat1.cmake1
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadVersionFormat2-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadVersionFormat2-stderr.txt11
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadVersionFormat2.cmake1
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadVersionNumber-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadVersionNumber-stderr.txt9
-rw-r--r--Tests/RunCMake/GeneratorInstance/BadVersionNumber.cmake1
-rw-r--r--Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake1
-rw-r--r--Tests/RunCMake/GeneratorInstance/PortableNoVersion-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorInstance/PortableNoVersion-stderr.txt13
-rw-r--r--Tests/RunCMake/GeneratorInstance/PortableNoVersion.cmake1
-rw-r--r--Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake28
-rw-r--r--Tests/RunCMake/GeneratorInstance/WrongVersion-result.txt1
-rw-r--r--Tests/RunCMake/GeneratorInstance/WrongVersion-stderr.txt10
-rw-r--r--Tests/RunCMake/GeneratorInstance/WrongVersion.cmake1
26 files changed, 131 insertions, 1 deletions
diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-result.txt b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-stderr.txt
new file mode 100644
index 0000000..ef71404
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+ Generator
+
+ Visual Studio [^
+]+
+
+ given instance specification
+
+ Test Instance,version=1\.2\.3\.4,version=1\.2\.3\.4
+
+ that contains duplicate field key 'version'\.$
diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate.cmake b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate.cmake
new file mode 100644
index 0000000..2fc38e5
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldNoComma-result.txt b/Tests/RunCMake/GeneratorInstance/BadFieldNoComma-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadFieldNoComma-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldNoComma-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadFieldNoComma-stderr.txt
new file mode 100644
index 0000000..d6c73c8
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadFieldNoComma-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+ Generator
+
+ Visual Studio [^
+]+
+
+ given instance specification
+
+ Test Instance,nocomma
+
+ that contains a field after the first ',' with no '='\.$
diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldNoComma.cmake b/Tests/RunCMake/GeneratorInstance/BadFieldNoComma.cmake
new file mode 100644
index 0000000..2fc38e5
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadFieldNoComma.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldUnknown-result.txt b/Tests/RunCMake/GeneratorInstance/BadFieldUnknown-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadFieldUnknown-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldUnknown-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadFieldUnknown-stderr.txt
new file mode 100644
index 0000000..ecfe229
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadFieldUnknown-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+ Generator
+
+ Visual Studio [^
+]+
+
+ given instance specification
+
+ Test Instance,unknown=
+
+ that contains invalid field 'unknown='\.$
diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldUnknown.cmake b/Tests/RunCMake/GeneratorInstance/BadFieldUnknown.cmake
new file mode 100644
index 0000000..2fc38e5
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadFieldUnknown.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-result.txt b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-stderr.txt
new file mode 100644
index 0000000..a0894b6
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+ Generator
+
+ Visual Studio [^
+]+
+
+ given instance specification
+
+ version=1\.2\.3
+
+ but the version field is not 4 integer components starting in [0-9]+\.$
diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat1.cmake b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1.cmake
new file mode 100644
index 0000000..2fc38e5
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-result.txt b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-stderr.txt
new file mode 100644
index 0000000..2b3a23b
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+ Generator
+
+ Visual Studio [^
+]+
+
+ given instance specification
+
+ version=1\.2\.3\.x
+
+ but the version field is not 4 integer components starting in [0-9]+\.$
diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat2.cmake b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2.cmake
new file mode 100644
index 0000000..2fc38e5
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionNumber-result.txt b/Tests/RunCMake/GeneratorInstance/BadVersionNumber-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadVersionNumber-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionNumber-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadVersionNumber-stderr.txt
new file mode 100644
index 0000000..3a27341
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadVersionNumber-stderr.txt
@@ -0,0 +1,9 @@
+^CMake Error at CMakeLists.txt:[0-9] \(project\):
+ Generator
+
+ Visual Studio [^
+]+
+
+ could not find specified instance of Visual Studio:
+
+ version=[0-9]+\.999\.99999\.999$
diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionNumber.cmake b/Tests/RunCMake/GeneratorInstance/BadVersionNumber.cmake
new file mode 100644
index 0000000..2fc38e5
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/BadVersionNumber.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake b/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake
index 7750c2e..9761f0c 100644
--- a/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake
+++ b/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake
@@ -11,3 +11,4 @@ elseif(NOT IS_DIRECTORY "${CMAKE_GENERATOR_INSTANCE}")
" ${CMAKE_GENERATOR_INSTANCE}\n"
"which is not an existing directory.")
endif()
+file(WRITE "${CMAKE_BINARY_DIR}/instance.txt" "${CMAKE_GENERATOR_INSTANCE}")
diff --git a/Tests/RunCMake/GeneratorInstance/PortableNoVersion-result.txt b/Tests/RunCMake/GeneratorInstance/PortableNoVersion-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/PortableNoVersion-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorInstance/PortableNoVersion-stderr.txt b/Tests/RunCMake/GeneratorInstance/PortableNoVersion-stderr.txt
new file mode 100644
index 0000000..baa17aa
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/PortableNoVersion-stderr.txt
@@ -0,0 +1,13 @@
+^CMake Error at CMakeLists.txt:[0-9]+ \(project\):
+ Generator
+
+ Visual Studio [^
+]+
+
+ could not find specified instance of Visual Studio:
+
+ [^
+]+/Tests/RunCMake/GeneratorInstance
+
+ The directory exists, but the instance is not known to the Visual Studio
+ Installer, and no 'version=' field was given\.$
diff --git a/Tests/RunCMake/GeneratorInstance/PortableNoVersion.cmake b/Tests/RunCMake/GeneratorInstance/PortableNoVersion.cmake
new file mode 100644
index 0000000..2fc38e5
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/PortableNoVersion.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")
diff --git a/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake
index e7f9ccb..dfcdcf8 100644
--- a/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake
@@ -1,14 +1,40 @@
include(RunCMake)
-if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio 1[56789]")
+if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio (1[56789])")
+ set(vs_major "${CMAKE_MATCH_1}")
+
set(RunCMake_GENERATOR_INSTANCE "")
run_cmake(DefaultInstance)
+ set(instance_txt "${RunCMake_BINARY_DIR}/DefaultInstance-build/instance.txt")
+ if(EXISTS "${instance_txt}")
+ file(READ "${instance_txt}" default_instance)
+ endif()
set(RunCMake_GENERATOR_INSTANCE "${RunCMake_SOURCE_DIR}/instance_does_not_exist")
run_cmake(MissingInstance)
set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/MissingInstance-toolchain.cmake)
run_cmake(MissingInstanceToolchain)
unset(RunCMake_TEST_OPTIONS)
+
+ set(RunCMake_GENERATOR_INSTANCE "Test Instance,nocomma")
+ run_cmake(BadFieldNoComma)
+ set(RunCMake_GENERATOR_INSTANCE "Test Instance,unknown=")
+ run_cmake(BadFieldUnknown)
+ set(RunCMake_GENERATOR_INSTANCE "Test Instance,version=1.2.3.4,version=1.2.3.4")
+ run_cmake(BadFieldDuplicate)
+ set(RunCMake_GENERATOR_INSTANCE "version=1.2.3")
+ run_cmake(BadVersionFormat1)
+ set(RunCMake_GENERATOR_INSTANCE "version=1.2.3.x")
+ run_cmake(BadVersionFormat2)
+ set(RunCMake_GENERATOR_INSTANCE "version=${vs_major}.999.99999.999")
+ run_cmake(BadVersionNumber)
+ if(IS_DIRECTORY "${default_instance}")
+ set(RunCMake_GENERATOR_INSTANCE "${default_instance},version=${vs_major}.999.99999.999")
+ run_cmake(WrongVersion)
+ endif()
+
+ set(RunCMake_GENERATOR_INSTANCE "${RunCMake_SOURCE_DIR}")
+ run_cmake(PortableNoVersion)
else()
set(RunCMake_GENERATOR_INSTANCE "")
run_cmake(NoInstance)
diff --git a/Tests/RunCMake/GeneratorInstance/WrongVersion-result.txt b/Tests/RunCMake/GeneratorInstance/WrongVersion-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/WrongVersion-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorInstance/WrongVersion-stderr.txt b/Tests/RunCMake/GeneratorInstance/WrongVersion-stderr.txt
new file mode 100644
index 0000000..156a9ee
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/WrongVersion-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Error at CMakeLists.txt:[0-9] \(project\):
+ Generator
+
+ Visual Studio [^
+]+
+
+ could not find specified instance of Visual Studio:
+
+ [^,
+]+,version=[0-9]+\.999\.99999\.999$
diff --git a/Tests/RunCMake/GeneratorInstance/WrongVersion.cmake b/Tests/RunCMake/GeneratorInstance/WrongVersion.cmake
new file mode 100644
index 0000000..2fc38e5
--- /dev/null
+++ b/Tests/RunCMake/GeneratorInstance/WrongVersion.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This should not be reached!")