summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorZack Galbreath <zack.galbreath@kitware.com>2021-07-01 16:40:41 (GMT)
committerZack Galbreath <zack.galbreath@kitware.com>2021-07-01 19:16:23 (GMT)
commit5489ce74b349ed31d6abb6ee5a0aaa17b10b474d (patch)
tree29ae508b56f972899af0c6ec482b6ef66d1f7f29 /Tests
parent7817aa6fa4097a2c642ff1333be72f93a6e32ed1 (diff)
downloadCMake-5489ce74b349ed31d6abb6ee5a0aaa17b10b474d.zip
CMake-5489ce74b349ed31d6abb6ee5a0aaa17b10b474d.tar.gz
CMake-5489ce74b349ed31d6abb6ee5a0aaa17b10b474d.tar.bz2
ctest: support <CTestMeasurement> for runtime measurements
Teach CTest to parse output for <CTestMeasurement> in addition to <DartMeasurement> for measurements defined at runtime. Use a new class (cmCTestTestMeasurementXMLParser) derived from cmXMLParser to parse the data and attributes these XML elements. This is an improvement over our previous approach of using a series of regular expressions. As part of this commit we also rename some member variables and methods to make their purpose more clear. DartStuff -> AllTestMeasurementsRegex DartStuff1 -> SingleTestMeasurementRegex DartString -> TestMeasurementsOutput GenerateDartOutput() -> GenerateCTestXML() GenerateRegressionImages() -> RecordCustomTestMeasurements() cmCTestRunTest::DartProcessing() -> ParseOutputForMeasurements()
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/ctest_test/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/ctest_test/TestMeasurements-check.cmake18
2 files changed, 30 insertions, 0 deletions
diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
index 31bc075..a211c66 100644
--- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
@@ -158,13 +158,25 @@ add_test(
COMMAND ${CMAKE_COMMAND} -E
echo <DartMeasurement type="numeric/double" name="my_custom_value">1.4847</DartMeasurement>)
add_test(
+ NAME double_measurement2
+ COMMAND ${CMAKE_COMMAND} -E
+ echo <CTestMeasurement type="numeric/double" name="another_custom_value">1.8474</CTestMeasurement>)
+add_test(
NAME img_measurement
COMMAND ${CMAKE_COMMAND} -E
echo <DartMeasurementFile name="TestImage" type="image/png">]] ${IMAGE_DIR}/cmake-logo-16.png [[</DartMeasurementFile>)
add_test(
+ NAME img_measurement2
+ COMMAND ${CMAKE_COMMAND} -E
+ echo <CTestMeasurementFile name="TestImage2" type="image/png">]] ${IMAGE_DIR}/cmake-logo-16.png [[</CTestMeasurementFile>)
+add_test(
NAME file_measurement
COMMAND ${CMAKE_COMMAND} -E
echo <DartMeasurementFile name="my_test_input_data" type="file">]] ${IMAGE_DIR}/cmake-logo-16.png [[</DartMeasurementFile>)
+add_test(
+ NAME file_measurement2
+ COMMAND ${CMAKE_COMMAND} -E
+ echo <CTestMeasurementFile name="another_test_input_data" type="file">]] ${IMAGE_DIR}/cmake-logo-16.png [[</CTestMeasurementFile>)
]])
run_ctest(TestMeasurements)
endfunction()
diff --git a/Tests/RunCMake/ctest_test/TestMeasurements-check.cmake b/Tests/RunCMake/ctest_test/TestMeasurements-check.cmake
index 0095db0..7e0928d 100644
--- a/Tests/RunCMake/ctest_test/TestMeasurements-check.cmake
+++ b/Tests/RunCMake/ctest_test/TestMeasurements-check.cmake
@@ -10,13 +10,31 @@ 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 the other double measurement.
+if(NOT _test_contents MATCHES [[NamedMeasurement type="numeric/double" name="another_custom_value"]])
+ string(APPEND RunCMake_TEST_FAILED
+ "Could not find expected <NamedMeasurement> tag(2) for type='numeric/double' in Test.xml")
+endif()
+if(NOT _test_contents MATCHES "<Value>1.8474</Value>")
+ string(APPEND RunCMake_TEST_FAILED "Could not find expected measurement value(2) 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()
+# Check img measurement 2.
+if(NOT _test_contents MATCHES [[NamedMeasurement name="TestImage2" type="image/png" encoding="base64"]])
+ string(APPEND RunCMake_TEST_FAILED
+ "Could not find expected <NamedMeasurement> tag(2) for type='image/png' in Test.xml")
+endif()
# Check file measurement.
if(NOT _test_contents MATCHES [[NamedMeasurement name="my_test_input_data" encoding="base64" compression="tar/gzip" filename="cmake-logo-16.png" type="file"]])
string(APPEND RunCMake_TEST_FAILED
"Could not find expected <NamedMeasurement> tag for type='file' in Test.xml")
endif()
+# Check file measurement 2.
+if(NOT _test_contents MATCHES [[NamedMeasurement name="another_test_input_data" encoding="base64" compression="tar/gzip" filename="cmake-logo-16.png" type="file"]])
+ string(APPEND RunCMake_TEST_FAILED
+ "Could not find expected <NamedMeasurement> tag(2) for type='file' in Test.xml")
+endif()