summaryrefslogtreecommitdiff
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorArtin Alavi <1361714+Arastais@users.noreply.github.com>2023-02-06 23:30:21 -0800
committerBrad King <brad.king@kitware.com>2023-03-30 09:18:53 -0400
commit8e579b0228ae410aa83a4c45f1fbb790c4a6cf12 (patch)
tree8ce47bf63d0ff0a515b10593c5e3cdf75df9260e /Tests/RunCMake
parent4901fdb201bc6264e976e105780a490d9c0eba19 (diff)
downloadcmake-8e579b0228ae410aa83a4c45f1fbb790c4a6cf12.tar.gz
presets: Add trace options to configure presets
Add JSON schema version 7 to support them. Fixes: #22543
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CMakePresets/ExplicitNoTrace.cmake0
-rw-r--r--Tests/RunCMake/CMakePresets/NoTrace.cmake0
-rw-r--r--Tests/RunCMake/CMakePresets/RunCMakeTest.cmake13
-rw-r--r--Tests/RunCMake/CMakePresets/Trace-stderr.txt4
-rw-r--r--Tests/RunCMake/CMakePresets/Trace.cmake0
-rw-r--r--Tests/RunCMake/CMakePresets/Trace.json.in69
-rw-r--r--Tests/RunCMake/CMakePresets/TraceAll.cmake4
-rw-r--r--Tests/RunCMake/CMakePresets/TraceExpand-stderr.txt4
-rw-r--r--Tests/RunCMake/CMakePresets/TraceExpand.cmake0
-rw-r--r--Tests/RunCMake/CMakePresets/TraceFormatHuman-stderr.txt4
-rw-r--r--Tests/RunCMake/CMakePresets/TraceFormatHuman.cmake0
-rw-r--r--Tests/RunCMake/CMakePresets/TraceFormatJSON-stderr.txt3
-rw-r--r--Tests/RunCMake/CMakePresets/TraceFormatJSON.cmake0
-rw-r--r--Tests/RunCMake/CMakePresets/TraceNotSupported-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresets/TraceNotSupported-stderr.txt3
-rw-r--r--Tests/RunCMake/CMakePresets/TraceNotSupported.json.in13
-rw-r--r--Tests/RunCMake/CMakePresets/TraceRedirect.cmake0
-rw-r--r--Tests/RunCMake/CMakePresets/TraceSource.cmake0
18 files changed, 118 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakePresets/ExplicitNoTrace.cmake b/Tests/RunCMake/CMakePresets/ExplicitNoTrace.cmake
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/ExplicitNoTrace.cmake
diff --git a/Tests/RunCMake/CMakePresets/NoTrace.cmake b/Tests/RunCMake/CMakePresets/NoTrace.cmake
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/NoTrace.cmake
diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
index efa838e822..d67e8b14ee 100644
--- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
@@ -150,6 +150,7 @@ run_cmake_presets(InvalidRegex)
set(CMakePresets_SCHEMA_EXPECTED_RESULT 1)
run_cmake_presets(ConditionFuture)
run_cmake_presets(SubConditionNull)
+run_cmake_presets(TraceNotSupported)
# Test cmakeMinimumRequired field
run_cmake_presets(MinimumRequiredInvalid)
@@ -326,6 +327,18 @@ set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/Debug.json.in")
run_cmake_presets(NoDebug)
run_cmake_presets(Debug)
+# Test trace
+set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/Trace.json.in")
+run_cmake_presets(NoTrace)
+run_cmake_presets(ExplicitNoTrace)
+run_cmake_presets(Trace)
+run_cmake_presets(TraceExpand)
+run_cmake_presets(TraceFormatJSON)
+run_cmake_presets(TraceFormatHuman)
+run_cmake_presets(TraceSource)
+run_cmake_presets(TraceRedirect)
+run_cmake_presets(TraceAll)
+
# Test ${hostSystemName} macro
set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/HostSystemName.json.in")
run_cmake_presets(HostSystemName)
diff --git a/Tests/RunCMake/CMakePresets/Trace-stderr.txt b/Tests/RunCMake/CMakePresets/Trace-stderr.txt
new file mode 100644
index 0000000000..5ed769cf55
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/Trace-stderr.txt
@@ -0,0 +1,4 @@
+^[^
+]*/Tests/RunCMake/CMakePresets/Trace/CMakeLists.txt\(1\): cmake_minimum_required\(VERSION 3.18 \)
+[^
+]*/Tests/RunCMake/CMakePresets/Trace/CMakeLists.txt\(2\): project\(\${RunCMake_TEST} NONE \)
diff --git a/Tests/RunCMake/CMakePresets/Trace.cmake b/Tests/RunCMake/CMakePresets/Trace.cmake
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/Trace.cmake
diff --git a/Tests/RunCMake/CMakePresets/Trace.json.in b/Tests/RunCMake/CMakePresets/Trace.json.in
new file mode 100644
index 0000000000..f50a6f25b3
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/Trace.json.in
@@ -0,0 +1,69 @@
+{
+ "version": 7,
+ "configurePresets": [
+ {
+ "name": "NoTrace",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build"
+ },
+ {
+ "name": "ExplicitNoTrace",
+ "inherits": "NoTrace",
+ "trace": {
+ "mode": "off"
+ }
+ },
+ {
+ "name": "Trace",
+ "inherits": "NoTrace",
+ "trace": {
+ "mode": "on"
+ }
+ },
+ {
+ "name": "TraceExpand",
+ "inherits": "NoTrace",
+ "trace": {
+ "mode": "expand"
+ }
+ },
+ {
+ "name": "TraceFormatJSON",
+ "inherits": "NoTrace",
+ "trace": {
+ "format": "json-v1"
+ }
+ },
+ {
+ "name": "TraceFormatHuman",
+ "inherits": "NoTrace",
+ "trace": {
+ "format": "human"
+ }
+ },
+ {
+ "name": "TraceSource",
+ "inherits": "NoTrace",
+ "trace": {
+ "source": "TraceSourceFile.txt"
+ }
+ },
+ {
+ "name": "TraceRedirect",
+ "inherits": "NoTrace",
+ "trace": {
+ "redirect": "TraceRedirectFile.txt"
+ }
+ },
+ {
+ "name": "TraceAll",
+ "inherits": "NoTrace",
+ "trace": {
+ "mode": "expand",
+ "format": "json-v1",
+ "source": "TraceSourceFile.txt",
+ "redirect": "TraceRedirectFile.json"
+ }
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresets/TraceAll.cmake b/Tests/RunCMake/CMakePresets/TraceAll.cmake
new file mode 100644
index 0000000000..9896ec0b29
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/TraceAll.cmake
@@ -0,0 +1,4 @@
+include(${CMAKE_CURRENT_LIST_DIR}/TraceExpand.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/TraceFormatJSON.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/TraceSource.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/TraceRedirect.cmake)
diff --git a/Tests/RunCMake/CMakePresets/TraceExpand-stderr.txt b/Tests/RunCMake/CMakePresets/TraceExpand-stderr.txt
new file mode 100644
index 0000000000..7ee4fea2b8
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/TraceExpand-stderr.txt
@@ -0,0 +1,4 @@
+^[^
+]*/Tests/RunCMake/CMakePresets/TraceExpand/CMakeLists.txt\(1\): cmake_minimum_required\(VERSION 3.18 \)
+[^
+]*/Tests/RunCMake/CMakePresets/TraceExpand/CMakeLists.txt\(2\): project\(TraceExpand NONE \)
diff --git a/Tests/RunCMake/CMakePresets/TraceExpand.cmake b/Tests/RunCMake/CMakePresets/TraceExpand.cmake
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/TraceExpand.cmake
diff --git a/Tests/RunCMake/CMakePresets/TraceFormatHuman-stderr.txt b/Tests/RunCMake/CMakePresets/TraceFormatHuman-stderr.txt
new file mode 100644
index 0000000000..1d3450daea
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/TraceFormatHuman-stderr.txt
@@ -0,0 +1,4 @@
+^[^
+]*/Tests/RunCMake/CMakePresets/TraceFormatHuman/CMakeLists.txt\(1\): cmake_minimum_required\(VERSION 3.18 \)
+[^
+]*/Tests/RunCMake/CMakePresets/TraceFormatHuman/CMakeLists.txt\(2\): project\(\${RunCMake_TEST} NONE \)
diff --git a/Tests/RunCMake/CMakePresets/TraceFormatHuman.cmake b/Tests/RunCMake/CMakePresets/TraceFormatHuman.cmake
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/TraceFormatHuman.cmake
diff --git a/Tests/RunCMake/CMakePresets/TraceFormatJSON-stderr.txt b/Tests/RunCMake/CMakePresets/TraceFormatJSON-stderr.txt
new file mode 100644
index 0000000000..edf044c655
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/TraceFormatJSON-stderr.txt
@@ -0,0 +1,3 @@
+^{"version":{"major":1,"minor":2}}
+{"args":\["VERSION","3\.18"\],"cmd":"cmake_minimum_required","file":"[^"]*/Tests/RunCMake/CMakePresets/TraceFormatJSON/CMakeLists\.txt","frame":1,"global_frame":1,"line":1,"time":[0-9.]+}
+{"args":\["\${RunCMake_TEST}","NONE"\],"cmd":"project","file":"[^"]*/Tests/RunCMake/CMakePresets/TraceFormatJSON/CMakeLists\.txt","frame":1,"global_frame":1,"line":2,"time":[0-9.]+}
diff --git a/Tests/RunCMake/CMakePresets/TraceFormatJSON.cmake b/Tests/RunCMake/CMakePresets/TraceFormatJSON.cmake
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/TraceFormatJSON.cmake
diff --git a/Tests/RunCMake/CMakePresets/TraceNotSupported-result.txt b/Tests/RunCMake/CMakePresets/TraceNotSupported-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/TraceNotSupported-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresets/TraceNotSupported-stderr.txt b/Tests/RunCMake/CMakePresets/TraceNotSupported-stderr.txt
new file mode 100644
index 0000000000..de19a8c36f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/TraceNotSupported-stderr.txt
@@ -0,0 +1,3 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresets/TraceNotSupported:
+File version must be 7 or higher for trace preset support$
diff --git a/Tests/RunCMake/CMakePresets/TraceNotSupported.json.in b/Tests/RunCMake/CMakePresets/TraceNotSupported.json.in
new file mode 100644
index 0000000000..f3d3fbdb3a
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/TraceNotSupported.json.in
@@ -0,0 +1,13 @@
+{
+ "version": 6,
+ "configurePresets": [
+ {
+ "name": "TraceNotSupported",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build",
+ "trace": {
+ "mode": "expand"
+ }
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresets/TraceRedirect.cmake b/Tests/RunCMake/CMakePresets/TraceRedirect.cmake
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/TraceRedirect.cmake
diff --git a/Tests/RunCMake/CMakePresets/TraceSource.cmake b/Tests/RunCMake/CMakePresets/TraceSource.cmake
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/TraceSource.cmake