summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorleha-bot <leha-bot@yandex.ru>2024-01-05 16:12:22 (GMT)
committerleha-bot <leha-bot@yandex.ru>2024-01-16 07:41:31 (GMT)
commit1bb17692359d675eee12996c43446fa9c9fe5175 (patch)
tree4b303b56a54fd9c22bfbfc57d49feaa5f4feac34 /Tests
parent4f160f7906ef8075dad54b9bf2e0ba204a1c41fc (diff)
downloadCMake-1bb17692359d675eee12996c43446fa9c9fe5175.zip
CMake-1bb17692359d675eee12996c43446fa9c9fe5175.tar.gz
CMake-1bb17692359d675eee12996c43446fa9c9fe5175.tar.bz2
cmake_language: Add EXIT subcommand
Add tests to cover these cases: * run as regular CMake module, in NORMAL_MODE (expected to fail); * run as CMake script in SCRIPT_MODE (expected to exit with given code); * run as CMake script that `include()`-s another script with EXIT subcommand; * run as CMake script which EVAL-uates EXIT subcommand via `cmake_language(EVAL CODE "<cmake code>")`. Fixes: #23162
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/cmake_language/RunCMakeTest.cmake7
-rw-r--r--Tests/RunCMake/cmake_language/exit_0-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/exit_0-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_language/exit_0.cmake1
-rw-r--r--Tests/RunCMake/cmake_language/exit_0_script-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/exit_0_script-stderr.txt0
-rw-r--r--Tests/RunCMake/cmake_language/exit_0_script.cmake1
-rw-r--r--Tests/RunCMake/cmake_language/exit_0_script_with_command-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/exit_0_script_with_command-stderr.txt0
-rw-r--r--Tests/RunCMake/cmake_language/exit_0_script_with_command.cmake3
-rw-r--r--Tests/RunCMake/cmake_language/exit_5-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/exit_5-stderr.txt2
-rw-r--r--Tests/RunCMake/cmake_language/exit_5.cmake1
-rw-r--r--Tests/RunCMake/cmake_language/exit_5_script-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/exit_5_script-stderr.txt0
-rw-r--r--Tests/RunCMake/cmake_language/exit_5_script.cmake1
-rw-r--r--Tests/RunCMake/cmake_language/exit_5_script_with_command-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/exit_5_script_with_command-stderr.txt0
-rw-r--r--Tests/RunCMake/cmake_language/exit_5_script_with_command.cmake3
-rw-r--r--Tests/RunCMake/cmake_language/exit_7_script_in_include-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/exit_7_script_in_include-stderr.txt0
-rw-r--r--Tests/RunCMake/cmake_language/exit_7_script_in_include.cmake3
-rw-r--r--Tests/RunCMake/cmake_language/exit_7_script_included_with_exit.cmake3
-rw-r--r--Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language-stderr.txt1
-rw-r--r--Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language.cmake3
26 files changed, 39 insertions, 0 deletions
diff --git a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake
index 38ce10b..ac4aec8 100644
--- a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake
+++ b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake
@@ -84,6 +84,13 @@ run_cmake(defer_get_call_id_var)
run_cmake(defer_missing_arg)
run_cmake(defer_missing_call)
run_cmake(defer_unknown_option)
+run_cmake(exit_0)
+run_cmake(exit_5)
+run_cmake_script(exit_0_script)
+run_cmake_script(exit_5_script)
+run_cmake_script(exit_0_script_with_command)
+run_cmake_script(exit_7_script_in_include)
+run_cmake_script(exit_8_script_in_recursive_cmake_language)
# Default log level
run_cmake_command(
diff --git a/Tests/RunCMake/cmake_language/exit_0-result.txt b/Tests/RunCMake/cmake_language/exit_0-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_0-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_language/exit_0-stderr.txt b/Tests/RunCMake/cmake_language/exit_0-stderr.txt
new file mode 100644
index 0000000..04a586e
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_0-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at exit_0.cmake:1 \(cmake_language\):
+ cmake_language EXIT can be used only in SCRIPT mode
diff --git a/Tests/RunCMake/cmake_language/exit_0.cmake b/Tests/RunCMake/cmake_language/exit_0.cmake
new file mode 100644
index 0000000..53a150e
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_0.cmake
@@ -0,0 +1 @@
+cmake_language(EXIT 0)
diff --git a/Tests/RunCMake/cmake_language/exit_0_script-result.txt b/Tests/RunCMake/cmake_language/exit_0_script-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_0_script-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/cmake_language/exit_0_script-stderr.txt b/Tests/RunCMake/cmake_language/exit_0_script-stderr.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_0_script-stderr.txt
diff --git a/Tests/RunCMake/cmake_language/exit_0_script.cmake b/Tests/RunCMake/cmake_language/exit_0_script.cmake
new file mode 100644
index 0000000..53a150e
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_0_script.cmake
@@ -0,0 +1 @@
+cmake_language(EXIT 0)
diff --git a/Tests/RunCMake/cmake_language/exit_0_script_with_command-result.txt b/Tests/RunCMake/cmake_language/exit_0_script_with_command-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_0_script_with_command-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/cmake_language/exit_0_script_with_command-stderr.txt b/Tests/RunCMake/cmake_language/exit_0_script_with_command-stderr.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_0_script_with_command-stderr.txt
diff --git a/Tests/RunCMake/cmake_language/exit_0_script_with_command.cmake b/Tests/RunCMake/cmake_language/exit_0_script_with_command.cmake
new file mode 100644
index 0000000..ebc4ca7
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_0_script_with_command.cmake
@@ -0,0 +1,3 @@
+cmake_language(EXIT 0)
+
+message(FATAL_ERROR "cmake_language(EXIT 0) doesn't work")
diff --git a/Tests/RunCMake/cmake_language/exit_5-result.txt b/Tests/RunCMake/cmake_language/exit_5-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_5-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_language/exit_5-stderr.txt b/Tests/RunCMake/cmake_language/exit_5-stderr.txt
new file mode 100644
index 0000000..ad232f8
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_5-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at exit_5.cmake:1 \(cmake_language\):
+ cmake_language EXIT can be used only in SCRIPT mode
diff --git a/Tests/RunCMake/cmake_language/exit_5.cmake b/Tests/RunCMake/cmake_language/exit_5.cmake
new file mode 100644
index 0000000..5e5c147
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_5.cmake
@@ -0,0 +1 @@
+cmake_language(EXIT 5)
diff --git a/Tests/RunCMake/cmake_language/exit_5_script-result.txt b/Tests/RunCMake/cmake_language/exit_5_script-result.txt
new file mode 100644
index 0000000..7ed6ff8
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_5_script-result.txt
@@ -0,0 +1 @@
+5
diff --git a/Tests/RunCMake/cmake_language/exit_5_script-stderr.txt b/Tests/RunCMake/cmake_language/exit_5_script-stderr.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_5_script-stderr.txt
diff --git a/Tests/RunCMake/cmake_language/exit_5_script.cmake b/Tests/RunCMake/cmake_language/exit_5_script.cmake
new file mode 100644
index 0000000..5e5c147
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_5_script.cmake
@@ -0,0 +1 @@
+cmake_language(EXIT 5)
diff --git a/Tests/RunCMake/cmake_language/exit_5_script_with_command-result.txt b/Tests/RunCMake/cmake_language/exit_5_script_with_command-result.txt
new file mode 100644
index 0000000..7ed6ff8
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_5_script_with_command-result.txt
@@ -0,0 +1 @@
+5
diff --git a/Tests/RunCMake/cmake_language/exit_5_script_with_command-stderr.txt b/Tests/RunCMake/cmake_language/exit_5_script_with_command-stderr.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_5_script_with_command-stderr.txt
diff --git a/Tests/RunCMake/cmake_language/exit_5_script_with_command.cmake b/Tests/RunCMake/cmake_language/exit_5_script_with_command.cmake
new file mode 100644
index 0000000..4400307
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_5_script_with_command.cmake
@@ -0,0 +1,3 @@
+cmake_language(EXIT 5)
+
+message(FATAL_ERROR "cmake_language(EXIT 5) doesn't work")
diff --git a/Tests/RunCMake/cmake_language/exit_7_script_in_include-result.txt b/Tests/RunCMake/cmake_language/exit_7_script_in_include-result.txt
new file mode 100644
index 0000000..7f8f011
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_7_script_in_include-result.txt
@@ -0,0 +1 @@
+7
diff --git a/Tests/RunCMake/cmake_language/exit_7_script_in_include-stderr.txt b/Tests/RunCMake/cmake_language/exit_7_script_in_include-stderr.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_7_script_in_include-stderr.txt
diff --git a/Tests/RunCMake/cmake_language/exit_7_script_in_include.cmake b/Tests/RunCMake/cmake_language/exit_7_script_in_include.cmake
new file mode 100644
index 0000000..e65fa5c
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_7_script_in_include.cmake
@@ -0,0 +1,3 @@
+include(${CMAKE_CURRENT_LIST_DIR}/exit_7_script_included_with_exit.cmake)
+
+message(FATAL_ERROR "The cmake_language(EXIT 7) from include()-d script doesn't work")
diff --git a/Tests/RunCMake/cmake_language/exit_7_script_included_with_exit.cmake b/Tests/RunCMake/cmake_language/exit_7_script_included_with_exit.cmake
new file mode 100644
index 0000000..ee36ca0
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_7_script_included_with_exit.cmake
@@ -0,0 +1,3 @@
+cmake_language(EXIT 7)
+
+message(FATAL_ERROR "The include()-d script with EXIT 7 doesn't work")
diff --git a/Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language-result.txt b/Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language-result.txt
new file mode 100644
index 0000000..45a4fb7
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language-result.txt
@@ -0,0 +1 @@
+8
diff --git a/Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language-stderr.txt b/Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language-stderr.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language-stderr.txt
@@ -0,0 +1 @@
+
diff --git a/Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language.cmake b/Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language.cmake
new file mode 100644
index 0000000..96daf86
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/exit_8_script_in_recursive_cmake_language.cmake
@@ -0,0 +1,3 @@
+cmake_language(EVAL CODE "cmake_language(EXIT 8)")
+
+message(FATAL_ERROR "The cmake_language EVAL of EXIT 8 test doesn't work")