diff options
author | Brad King <brad.king@kitware.com> | 2022-10-19 14:04:18 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-10-19 14:04:29 (GMT) |
commit | 6fa189f71618ceecb5366edd247676ffb77c6a26 (patch) | |
tree | a7a84cf8fabad58b47a34f5ed32dd7f8cb34290e /Tests/RunCMake | |
parent | 86ed35cf63c0ad2592185607805be793091dc882 (diff) | |
parent | bea4ed543058ef36503503cda2adf669c09671f5 (diff) | |
download | CMake-6fa189f71618ceecb5366edd247676ffb77c6a26.zip CMake-6fa189f71618ceecb5366edd247676ffb77c6a26.tar.gz CMake-6fa189f71618ceecb5366edd247676ffb77c6a26.tar.bz2 |
Merge topic 'cmake-presets-output-junit' into release-3.25
bea4ed5430 CTest: Add support for outputJUnitFile in presets
9270a02003 CMakePresets.json: Add outputJUnitFile to test presets schema
757786bb73 Tests: Add test for outputLogFile in CMakePresets.json
b68c3596e7 CMakePresets.json: Disallow extra properties in test output schema
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !7806
Diffstat (limited to 'Tests/RunCMake')
10 files changed, 66 insertions, 2 deletions
diff --git a/Tests/RunCMake/CMakePresetsTest/Good-test-outputJUnit-check.cmake b/Tests/RunCMake/CMakePresetsTest/Good-test-outputJUnit-check.cmake new file mode 100644 index 0000000..e1788cb --- /dev/null +++ b/Tests/RunCMake/CMakePresetsTest/Good-test-outputJUnit-check.cmake @@ -0,0 +1,4 @@ +include("${CMAKE_CURRENT_LIST_DIR}/check.cmake") +if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/default/output.xml") + string(APPEND RunCMake_TEST_FAILED "Expected ${RunCMake_TEST_BINARY_DIR}/default/output.xml to exist but it does not\n") +endif() diff --git a/Tests/RunCMake/CMakePresetsTest/Good-test-outputLog-check.cmake b/Tests/RunCMake/CMakePresetsTest/Good-test-outputLog-check.cmake new file mode 100644 index 0000000..e860d42 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsTest/Good-test-outputLog-check.cmake @@ -0,0 +1,4 @@ +include("${CMAKE_CURRENT_LIST_DIR}/check.cmake") +if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/default/output.log") + string(APPEND RunCMake_TEST_FAILED "Expected ${RunCMake_TEST_BINARY_DIR}/default/output.log to exist but it does not\n") +endif() diff --git a/Tests/RunCMake/CMakePresetsTest/Good.json.in b/Tests/RunCMake/CMakePresetsTest/Good.json.in index d484a19..a4b875a 100644 --- a/Tests/RunCMake/CMakePresetsTest/Good.json.in +++ b/Tests/RunCMake/CMakePresetsTest/Good.json.in @@ -1,5 +1,5 @@ { - "version": 5, + "version": 6, "configurePresets": [ { "name": "default", @@ -171,6 +171,20 @@ "execution": { "showOnly": "human" } + }, + { + "name": "outputLog", + "inherits": "minimal", + "output": { + "outputLogFile": "${sourceDir}/build/default/output.log" + } + }, + { + "name": "outputJUnit", + "inherits": "minimal", + "output": { + "outputJUnitFile": "${sourceDir}/build/default/output.xml" + } } ] } diff --git a/Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported-test-x-result.txt b/Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported-test-x-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported-test-x-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported-test-x-stderr.txt b/Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported-test-x-stderr.txt new file mode 100644 index 0000000..acd5785 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported-test-x-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported: File version must be 6 or higher for CTest JUnit output support$ diff --git a/Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported.json.in b/Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported.json.in new file mode 100644 index 0000000..93f6b0c --- /dev/null +++ b/Tests/RunCMake/CMakePresetsTest/OutputJUnitUnsupported.json.in @@ -0,0 +1,17 @@ +{ + "version": 5, + "configurePresets": [ + { + "name": "default" + } + ], + "testPresets": [ + { + "name": "unsupported", + "configurePreset": "default", + "output": { + "outputJUnitFile": "junit.xml" + } + } + ] +} diff --git a/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake index bec0dd94..1c7b836 100644 --- a/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake @@ -78,7 +78,7 @@ set(CMakePresetsTest_ASSETS "Good-indexFile.txt") set(GoodTestPresets "minimal;defaults;noEnvironment;withEnvironment" "config-debug;config-release" - "exclude;index;indexFile;showOnly") + "exclude;index;indexFile;showOnly;outputLog;outputJUnit") run_cmake_test_presets(Good "default" "" @@ -105,6 +105,8 @@ run_cmake_test_presets(Invalid "" "" "hidden;vendorMacro") set(CMakePresets_SCHEMA_EXPECTED_RESULT 1) run_cmake_test_presets(PresetsUnsupported "" "" "x") run_cmake_test_presets(ConditionFuture "" "" "x") +run_cmake_test_presets(TestOutputTruncationUnsupported "" "" "x") +run_cmake_test_presets(OutputJUnitUnsupported "" "" "x") set(CMakePresets_SCHEMA_EXPECTED_RESULT 0) run_cmake_test_presets(ConfigurePresetUnreachable "" "" "x") set(CMakePresetsTest_NO_CONFIGURE 0) diff --git a/Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported-test-x-result.txt b/Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported-test-x-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported-test-x-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported-test-x-stderr.txt b/Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported-test-x-stderr.txt new file mode 100644 index 0000000..90ea7c3 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported-test-x-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported: File version must be 5 or higher for testOutputTruncation preset support\.$ diff --git a/Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported.json.in b/Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported.json.in new file mode 100644 index 0000000..c116039 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsTest/TestOutputTruncationUnsupported.json.in @@ -0,0 +1,17 @@ +{ + "version": 4, + "configurePresets": [ + { + "name": "default" + } + ], + "testPresets": [ + { + "name": "default", + "configurePreset": "default", + "output": { + "testOutputTruncation": "tail" + } + } + ] +} |