Commit 63b5ddcc authored by Zack Galbreath's avatar Zack Galbreath
Browse files

Tests: Add cases for CTest extra measurements from tests

parent 52eac457
...@@ -361,7 +361,9 @@ if(COVERAGE_COMMAND) ...@@ -361,7 +361,9 @@ if(COVERAGE_COMMAND)
endif() endif()
add_RunCMake_test(ctest_start) add_RunCMake_test(ctest_start)
add_RunCMake_test(ctest_submit) 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_disabled_test)
add_RunCMake_test(ctest_skipped_test) add_RunCMake_test(ctest_skipped_test)
add_RunCMake_test(ctest_update) add_RunCMake_test(ctest_update)
......
...@@ -149,3 +149,19 @@ run_environment() ...@@ -149,3 +149,19 @@ run_environment()
# test for OUTPUT_JUNIT # test for OUTPUT_JUNIT
run_ctest_test(OutputJUnit OUTPUT_JUNIT junit.xml REPEAT UNTIL_FAIL:2) 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()
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()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment