diff options
author | Zack Galbreath <zack.galbreath@kitware.com> | 2021-04-21 18:05:00 (GMT) |
---|---|---|
committer | Zack Galbreath <zack.galbreath@kitware.com> | 2021-04-27 18:06:44 (GMT) |
commit | 63b5ddcce2acff2a6496e6bed737cf6e2788bfce (patch) | |
tree | 02e9c7313695d98e29a87ba3e04fa39a48769bf3 | |
parent | 52eac4573d8e10c124aa92e8f12866c16e556d5b (diff) | |
download | CMake-63b5ddcce2acff2a6496e6bed737cf6e2788bfce.zip CMake-63b5ddcce2acff2a6496e6bed737cf6e2788bfce.tar.gz CMake-63b5ddcce2acff2a6496e6bed737cf6e2788bfce.tar.bz2 |
Tests: Add cases for CTest extra measurements from tests
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_test/RunCMakeTest.cmake | 16 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_test/TestMeasurements-check.cmake | 17 |
3 files changed, 36 insertions, 1 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index db90a81..9bc4131 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -361,7 +361,9 @@ if(COVERAGE_COMMAND) endif() add_RunCMake_test(ctest_start) add_RunCMake_test(ctest_submit) -add_RunCMake_test(ctest_test) +add_RunCMake_test(ctest_test + -DIMAGE_DIR=${CMAKE_SOURCE_DIR}/Utilities/Sphinx/static +) add_RunCMake_test(ctest_disabled_test) add_RunCMake_test(ctest_skipped_test) add_RunCMake_test(ctest_update) diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index 901ac11..b559e89 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -149,3 +149,19 @@ run_environment() # test for OUTPUT_JUNIT run_ctest_test(OutputJUnit OUTPUT_JUNIT junit.xml REPEAT UNTIL_FAIL:2) + +# Verify that extra measurements get reported. +function(run_measurements) + set(CASE_CMAKELISTS_SUFFIX_CODE [[ +add_test( + NAME double_measurement + COMMAND ${CMAKE_COMMAND} -E + echo <DartMeasurement type="numeric/double" name="my_custom_value">1.4847</DartMeasurement>) +add_test( + NAME img_measurement + COMMAND ${CMAKE_COMMAND} -E + echo <DartMeasurementFile name="TestImage" type="image/png">]] ${IMAGE_DIR}/cmake-logo-16.png [[</DartMeasurementFile>) + ]]) + run_ctest(TestMeasurements) +endfunction() +run_measurements() diff --git a/Tests/RunCMake/ctest_test/TestMeasurements-check.cmake b/Tests/RunCMake/ctest_test/TestMeasurements-check.cmake new file mode 100644 index 0000000..9ff9447 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestMeasurements-check.cmake @@ -0,0 +1,17 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/TAG" _tag) +string(REGEX REPLACE "^([^\n]*)\n.*$" "\\1" _date "${_tag}") +file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/${_date}/Test.xml" _test_contents) + +# Check double measurement. +if(NOT _test_contents MATCHES [[NamedMeasurement type="numeric/double" name="my_custom_value"]]) + string(APPEND RunCMake_TEST_FAILED + "Could not find expected <NamedMeasurement> tag for type='numeric/double' in Test.xml") +endif() +if(NOT _test_contents MATCHES "<Value>1.4847</Value>") + string(APPEND RunCMake_TEST_FAILED "Could not find expected measurement value in Test.xml") +endif() +# Check img measurement. +if(NOT _test_contents MATCHES [[NamedMeasurement name="TestImage" type="image/png" encoding="base64"]]) + string(APPEND RunCMake_TEST_FAILED + "Could not find expected <NamedMeasurement> tag for type='image/png' in Test.xml") +endif() |