summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-01-17 14:26:40 +0000
committerKitware Robot <kwrobot@kitware.com>2023-01-17 09:26:50 -0500
commit45f86b9990e3ac7e9ec5909253275dbf2728bccc (patch)
treed6efcff17db9cd192d0b38442a0e7e0f5bb9d358 /Tests
parentdd18be5ebf6486486a272f47df3318d1db3a03cc (diff)
parent48292c8624b901a842b6d4f8a88ca00f898e5639 (diff)
downloadcmake-45f86b9990e3ac7e9ec5909253275dbf2728bccc.tar.gz
Merge topic 'configure-log'
48292c8624 try_compile: Record stack of in-progess checks in configure log d4bf7d80c6 try_compile: Add a NO_LOG option to skip recording in the configure log 9d9e8450a8 try_compile: Add optional LOG_DESCRIPTION to record in configure log 65ed5c2ca8 try_compile: Report underlying error when COPY_FILE fails 0418efb7ad Tests: Add explicit ConfigureLog case to RunCMake.try_compile 189557bd74 cmake: Make entire in-progress check stack available internally 96ce3581ab Help: Clarify backtrace order in cmake-configure-log(7) Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8072
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/try_compile/ConfigureLog-bad.c1
-rw-r--r--Tests/RunCMake/try_compile/ConfigureLog-config.txt52
-rw-r--r--Tests/RunCMake/try_compile/ConfigureLog-stdout.txt4
-rw-r--r--Tests/RunCMake/try_compile/ConfigureLog-test.c4
-rw-r--r--Tests/RunCMake/try_compile/ConfigureLog.cmake25
-rw-r--r--Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt8
-rw-r--r--Tests/RunCMake/try_compile/EmptyValueArgs.cmake3
-rw-r--r--Tests/RunCMake/try_compile/Inspect-config.txt4
-rw-r--r--Tests/RunCMake/try_compile/NoLogDescription-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/NoLogDescription-stderr.txt7
-rw-r--r--Tests/RunCMake/try_compile/NoLogDescription.cmake4
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake1
-rw-r--r--Tests/RunCMake/try_run/ConfigureLog-config.txt9
-rw-r--r--Tests/RunCMake/try_run/ConfigureLog-stdout.txt4
-rw-r--r--Tests/RunCMake/try_run/ConfigureLog.cmake16
16 files changed, 144 insertions, 0 deletions
diff --git a/Tests/RunCMake/try_compile/ConfigureLog-bad.c b/Tests/RunCMake/try_compile/ConfigureLog-bad.c
new file mode 100644
index 0000000000..6508eadd1d
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ConfigureLog-bad.c
@@ -0,0 +1 @@
+#error "This does not compile!"
diff --git a/Tests/RunCMake/try_compile/ConfigureLog-config.txt b/Tests/RunCMake/try_compile/ConfigureLog-config.txt
new file mode 100644
index 0000000000..262ed3c3d2
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ConfigureLog-config.txt
@@ -0,0 +1,52 @@
+^
+---
+events:
+ -
+ kind: "try_compile-v1"
+ backtrace:
+ - "[^"]*/Modules/CMakeDetermineCompilerABI.cmake:[0-9]+ \(try_compile\)"
+ - "[^"]*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)"
+ - "ConfigureLog.cmake:[0-9]+ \(enable_language\)"
+ - "CMakeLists.txt:[0-9]+ \(include\)"
+ checks:
+ - "Detecting C compiler ABI info"
+ directories:
+ source: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
+ binary: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
+ buildResult:
+ variable: "CMAKE_C_ABI_COMPILED"
+ cached: true
+ stdout: \|.*
+ exitCode: 0
+ -
+ kind: "try_compile-v1"
+ backtrace:
+ - "ConfigureLog.cmake:[0-9]+ \(try_compile\)"
+ - "CMakeLists.txt:[0-9]+ \(include\)"
+ description: "Source that should not compile\."
+ directories:
+ source: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
+ binary: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
+ buildResult:
+ variable: "COMPILE_RESULT"
+ cached: true
+ stdout: \|.*
+ exitCode: [1-9][0-9]*
+ -
+ kind: "try_compile-v1"
+ backtrace:
+ - "ConfigureLog.cmake:[0-9]+ \(try_compile\)"
+ - "CMakeLists.txt:[0-9]+ \(include\)"
+ checks:
+ - "Check 2"
+ - "Check 1"
+ description: "Source that should compile\."
+ directories:
+ source: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
+ binary: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
+ buildResult:
+ variable: "COMPILE_RESULT"
+ cached: true
+ stdout: \|.*
+ exitCode: 0
+\.\.\.$
diff --git a/Tests/RunCMake/try_compile/ConfigureLog-stdout.txt b/Tests/RunCMake/try_compile/ConfigureLog-stdout.txt
new file mode 100644
index 0000000000..ba326428c5
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ConfigureLog-stdout.txt
@@ -0,0 +1,4 @@
+-- Check 1
+-- Check 2
+-- Check 2 - passed
+-- Check 1 - passed
diff --git a/Tests/RunCMake/try_compile/ConfigureLog-test.c b/Tests/RunCMake/try_compile/ConfigureLog-test.c
new file mode 100644
index 0000000000..8488f4e58f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ConfigureLog-test.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/try_compile/ConfigureLog.cmake b/Tests/RunCMake/try_compile/ConfigureLog.cmake
new file mode 100644
index 0000000000..294e0f9cf8
--- /dev/null
+++ b/Tests/RunCMake/try_compile/ConfigureLog.cmake
@@ -0,0 +1,25 @@
+enable_language(C)
+
+try_compile(COMPILE_RESULT
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-bad.c
+ LOG_DESCRIPTION "Source that should not compile."
+ )
+
+try_compile(COMPILE_RESULT
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c
+ NO_LOG
+ )
+
+message(CHECK_START "Check 1")
+message(CHECK_START "Check 2")
+try_compile(COMPILE_RESULT
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c
+ LOG_DESCRIPTION "Source that should compile."
+ )
+if (COMPILE_RESULT)
+ message(CHECK_PASS "passed")
+ message(CHECK_PASS "passed")
+else()
+ message(CHECK_FAIL "failed")
+ message(CHECK_FAIL "failed")
+endif()
diff --git a/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt b/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt
index b1344bd43d..b03e0b3568 100644
--- a/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt
+++ b/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt
@@ -7,3 +7,11 @@ CMake Error at EmptyValueArgs.cmake:[0-9]+ \(try_compile\):
COPY_FILE_ERROR must be followed by a variable name
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at EmptyValueArgs.cmake:[0-9]+ \(try_compile\):
+ Error after keyword "LOG_DESCRIPTION":
+
+ empty string not allowed
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/try_compile/EmptyValueArgs.cmake b/Tests/RunCMake/try_compile/EmptyValueArgs.cmake
index fda4f10232..f0052c5333 100644
--- a/Tests/RunCMake/try_compile/EmptyValueArgs.cmake
+++ b/Tests/RunCMake/try_compile/EmptyValueArgs.cmake
@@ -5,3 +5,6 @@ try_compile(RESULT ${try_compile_bindir_or_SOURCES}
try_compile(RESULT ${try_compile_bindir_or_SOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/src.c
COPY_FILE "x" COPY_FILE_ERROR "")
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ LOG_DESCRIPTION "")
diff --git a/Tests/RunCMake/try_compile/Inspect-config.txt b/Tests/RunCMake/try_compile/Inspect-config.txt
index 47169cfb80..e09fe55c3b 100644
--- a/Tests/RunCMake/try_compile/Inspect-config.txt
+++ b/Tests/RunCMake/try_compile/Inspect-config.txt
@@ -8,6 +8,8 @@ events:
- "[^"]*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)"
- "Inspect.cmake:[0-9]+ \(enable_language\)"
- "CMakeLists.txt:[0-9]+ \(include\)"
+ checks:
+ - "Detecting C compiler ABI info"
directories:
source: "[^"]*/Tests/RunCMake/try_compile/Inspect-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
binary: "[^"]*/Tests/RunCMake/try_compile/Inspect-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
@@ -23,6 +25,8 @@ events:
- "[^"]*/Modules/CMakeTestCXXCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)"
- "Inspect.cmake:[0-9]+ \(enable_language\)"
- "CMakeLists.txt:[0-9]+ \(include\)"
+ checks:
+ - "Detecting CXX compiler ABI info"
directories:
source: "[^"]*/Tests/RunCMake/try_compile/Inspect-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
binary: "[^"]*/Tests/RunCMake/try_compile/Inspect-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
diff --git a/Tests/RunCMake/try_compile/NoLogDescription-result.txt b/Tests/RunCMake/try_compile/NoLogDescription-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoLogDescription-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/NoLogDescription-stderr.txt b/Tests/RunCMake/try_compile/NoLogDescription-stderr.txt
new file mode 100644
index 0000000000..9005bcd877
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoLogDescription-stderr.txt
@@ -0,0 +1,7 @@
+CMake Error at NoLogDescription.cmake:[0-9]+ \(try_compile\):
+ Error after keyword "LOG_DESCRIPTION":
+
+ missing required value
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NoLogDescription.cmake b/Tests/RunCMake/try_compile/NoLogDescription.cmake
new file mode 100644
index 0000000000..904763f6a8
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoLogDescription.cmake
@@ -0,0 +1,4 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ LOG_DESCRIPTION)
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index ad1cc2903d..51ccac8c5e 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -15,6 +15,7 @@ run_cmake_with_options(Inspect
)
include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake")
+run_cmake(ConfigureLog)
run_cmake(NoArgs)
run_cmake(OneArg)
run_cmake(TwoArgs)
diff --git a/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake
index 3158e327fb..0e4cc20192 100644
--- a/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake
+++ b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake
@@ -12,6 +12,7 @@ run_cmake(NoCopyFile)
run_cmake(NoCopyFile2)
run_cmake(NoCopyFileError)
run_cmake(NoCStandard)
+run_cmake(NoLogDescription)
run_cmake(NoOutputVariable)
run_cmake(NoOutputVariable2)
run_cmake(BadLinkLibraries)
diff --git a/Tests/RunCMake/try_run/ConfigureLog-config.txt b/Tests/RunCMake/try_run/ConfigureLog-config.txt
index 602437e264..ba396e03f7 100644
--- a/Tests/RunCMake/try_run/ConfigureLog-config.txt
+++ b/Tests/RunCMake/try_run/ConfigureLog-config.txt
@@ -7,6 +7,8 @@ events:
- "[^"]*/Modules/CMakeDetermineCompilerABI.cmake:[0-9]+ \(try_compile\)"
- "[^"]*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)"
- "CMakeLists.txt:[0-9]+ \(project\)"
+ checks:
+ - "Detecting C compiler ABI info"
directories:
source: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
binary: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
@@ -20,6 +22,7 @@ events:
backtrace:
- "ConfigureLog.cmake:[0-9]+ \(try_run\)"
- "CMakeLists.txt:[0-9]+ \(include\)"
+ description: "Source that should not compile\."
directories:
source: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
binary: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
@@ -36,6 +39,9 @@ events:
backtrace:
- "ConfigureLog.cmake:[0-9]+ \(try_run\)"
- "CMakeLists.txt:[0-9]+ \(include\)"
+ checks:
+ - "Check 1"
+ description: "Source that should compile\."
directories:
source: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
binary: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
@@ -57,6 +63,9 @@ events:
backtrace:
- "ConfigureLog.cmake:[0-9]+ \(try_run\)"
- "CMakeLists.txt:[0-9]+ \(include\)"
+ checks:
+ - "Check 2"
+ - "Check 1"
directories:
source: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
binary: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+"
diff --git a/Tests/RunCMake/try_run/ConfigureLog-stdout.txt b/Tests/RunCMake/try_run/ConfigureLog-stdout.txt
new file mode 100644
index 0000000000..ba326428c5
--- /dev/null
+++ b/Tests/RunCMake/try_run/ConfigureLog-stdout.txt
@@ -0,0 +1,4 @@
+-- Check 1
+-- Check 2
+-- Check 2 - passed
+-- Check 1 - passed
diff --git a/Tests/RunCMake/try_run/ConfigureLog.cmake b/Tests/RunCMake/try_run/ConfigureLog.cmake
index 4b5c7cb734..6635d73128 100644
--- a/Tests/RunCMake/try_run/ConfigureLog.cmake
+++ b/Tests/RunCMake/try_run/ConfigureLog.cmake
@@ -1,15 +1,31 @@
try_run(RUN_RESULT COMPILE_RESULT
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-bad.c
+ LOG_DESCRIPTION "Source that should not compile."
)
try_run(RUN_RESULT COMPILE_RESULT
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c
+ NO_LOG
)
+message(CHECK_START "Check 1")
+try_run(RUN_RESULT COMPILE_RESULT
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c
+ LOG_DESCRIPTION "Source that should compile."
+ )
+
+message(CHECK_START "Check 2")
try_run(RUN_RESULT COMPILE_RESULT
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c
RUN_OUTPUT_VARIABLE RUN_OUTPUT
)
+if (RUN_RESULT)
+ message(CHECK_PASS "passed")
+ message(CHECK_PASS "passed")
+else()
+ message(CHECK_FAIL "failed")
+ message(CHECK_FAIL "failed")
+endif()
try_run(RUN_RESULT COMPILE_RESULT
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c