diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2022-10-18 18:16:10 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2022-10-18 20:52:23 (GMT) |
commit | bea4ed543058ef36503503cda2adf669c09671f5 (patch) | |
tree | 68ec063132ed1c9eaf06d8e85035204700860583 /Tests/RunCMake/CMakePresetsTest | |
parent | 9270a02003a86cdb5025252f61a8baf4a40e2ddc (diff) | |
download | CMake-bea4ed543058ef36503503cda2adf669c09671f5.zip CMake-bea4ed543058ef36503503cda2adf669c09671f5.tar.gz CMake-bea4ed543058ef36503503cda2adf669c09671f5.tar.bz2 |
CTest: Add support for outputJUnitFile in presets
Fixes: #22400
Diffstat (limited to 'Tests/RunCMake/CMakePresetsTest')
6 files changed, 34 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.json.in b/Tests/RunCMake/CMakePresetsTest/Good.json.in index 15d68bf..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", @@ -178,6 +178,13 @@ "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 3bbb2a8..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;outputLog") + "exclude;index;indexFile;showOnly;outputLog;outputJUnit") run_cmake_test_presets(Good "default" "" @@ -106,6 +106,7 @@ 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) |