summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CommandLine
diff options
context:
space:
mode:
authorRobert Maynard <rmaynard@nvidia.com>2021-05-12 13:44:39 (GMT)
committerRobert Maynard <rmaynard@nvidia.com>2021-05-13 13:28:42 (GMT)
commit5aa0dec6b011c74225f4af895922edd10db09607 (patch)
treef62e76730298284c05247c0ab985a90cf1eaf14f /Tests/RunCMake/CommandLine
parent928cdb17c53f2fc5e57d658f297ec735ab8cb81d (diff)
downloadCMake-5aa0dec6b011c74225f4af895922edd10db09607.zip
CMake-5aa0dec6b011c74225f4af895922edd10db09607.tar.gz
CMake-5aa0dec6b011c74225f4af895922edd10db09607.tar.bz2
cmake: `--build` and `--install` error out when encountering bad flags
Fixes #22186
Diffstat (limited to 'Tests/RunCMake/CommandLine')
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/CommandLine/build-invalid-target-syntax-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/build-invalid-target-syntax-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/build-unknown-command-long-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/build-unknown-command-long-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/build-unknown-command-partial-match-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/build-unknown-command-partial-match-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/build-unknown-command-short-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/build-unknown-command-short-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/install-unknown-command-long-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/install-unknown-command-long-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/install-unknown-command-short-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/install-unknown-command-short-stderr.txt2
13 files changed, 30 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 8072a2c..caf3c88 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -54,6 +54,14 @@ run_cmake_command(build-no-dir
${CMAKE_COMMAND} --build)
run_cmake_command(build-no-cache
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR})
+run_cmake_command(build-unknown-command-short
+ ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR} -invalid-command)
+run_cmake_command(build-unknown-command-long
+ ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR} --invalid-command)
+run_cmake_command(build-unknown-command-partial-match
+ ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR} --targetinvalid)
+run_cmake_command(build-invalid-target-syntax
+ ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR} --target=invalid)
run_cmake_command(build-no-generator
${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-no-generator)
run_cmake_command(build-bad-dir
@@ -65,6 +73,10 @@ run_cmake_command(install-no-dir
${CMAKE_COMMAND} --install)
run_cmake_command(install-bad-dir
${CMAKE_COMMAND} --install dir-does-not-exist)
+run_cmake_command(install-unknown-command-short
+ ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR} -invalid-command)
+run_cmake_command(install-unknown-command-long
+ ${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR} --invalid-command)
run_cmake_command(install-options-to-vars
${CMAKE_COMMAND} --install ${RunCMake_SOURCE_DIR}/dir-install-options-to-vars
--strip --prefix /var/test --config sample --component pack)
diff --git a/Tests/RunCMake/CommandLine/build-invalid-target-syntax-result.txt b/Tests/RunCMake/CommandLine/build-invalid-target-syntax-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-invalid-target-syntax-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/build-invalid-target-syntax-stderr.txt b/Tests/RunCMake/CommandLine/build-invalid-target-syntax-stderr.txt
new file mode 100644
index 0000000..ce1c92d
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-invalid-target-syntax-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Invalid syntax used with --target
+Usage: cmake --build \[<dir> \| --preset <preset>\] \[options\] \[-- \[native-options\]\]
diff --git a/Tests/RunCMake/CommandLine/build-unknown-command-long-result.txt b/Tests/RunCMake/CommandLine/build-unknown-command-long-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-unknown-command-long-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/build-unknown-command-long-stderr.txt b/Tests/RunCMake/CommandLine/build-unknown-command-long-stderr.txt
new file mode 100644
index 0000000..c8f1a03
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-unknown-command-long-stderr.txt
@@ -0,0 +1,2 @@
+^Unknown argument --invalid-command
+Usage: cmake --build \[<dir> \| --preset <preset>\] \[options\] \[-- \[native-options\]\]
diff --git a/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-result.txt b/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-stderr.txt b/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-stderr.txt
new file mode 100644
index 0000000..ce1c92d
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-unknown-command-partial-match-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Invalid syntax used with --target
+Usage: cmake --build \[<dir> \| --preset <preset>\] \[options\] \[-- \[native-options\]\]
diff --git a/Tests/RunCMake/CommandLine/build-unknown-command-short-result.txt b/Tests/RunCMake/CommandLine/build-unknown-command-short-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-unknown-command-short-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/build-unknown-command-short-stderr.txt b/Tests/RunCMake/CommandLine/build-unknown-command-short-stderr.txt
new file mode 100644
index 0000000..a6cfece
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/build-unknown-command-short-stderr.txt
@@ -0,0 +1,2 @@
+^Unknown argument -invalid-command
+Usage: cmake --build \[<dir> \| --preset <preset>\] \[options\] \[-- \[native-options\]\]
diff --git a/Tests/RunCMake/CommandLine/install-unknown-command-long-result.txt b/Tests/RunCMake/CommandLine/install-unknown-command-long-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/install-unknown-command-long-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/install-unknown-command-long-stderr.txt b/Tests/RunCMake/CommandLine/install-unknown-command-long-stderr.txt
new file mode 100644
index 0000000..e6cee6b
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/install-unknown-command-long-stderr.txt
@@ -0,0 +1,2 @@
+^Unknown argument --invalid-command
+Usage: cmake --install <dir> \[options\]
diff --git a/Tests/RunCMake/CommandLine/install-unknown-command-short-result.txt b/Tests/RunCMake/CommandLine/install-unknown-command-short-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/install-unknown-command-short-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/install-unknown-command-short-stderr.txt b/Tests/RunCMake/CommandLine/install-unknown-command-short-stderr.txt
new file mode 100644
index 0000000..f690ec4
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/install-unknown-command-short-stderr.txt
@@ -0,0 +1,2 @@
+^Unknown argument -invalid-command
+Usage: cmake --install <dir> \[options\]