diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2021-07-28 13:59:23 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2021-07-28 13:59:23 (GMT) |
commit | d2515f77e19959e2b8d92f9e313fb0b517a13916 (patch) | |
tree | fa1a1dbbd0817e072cd9f8fbfdb48826d99fd158 /Tests/RunCMake/ctest_test | |
parent | 26170ea3069238bfb287d6304cd2f65e1c3a7387 (diff) | |
parent | 6efdd7e81480bf48fa2daeb292a12c77e23d3a17 (diff) | |
download | CMake-d2515f77e19959e2b8d92f9e313fb0b517a13916.zip CMake-d2515f77e19959e2b8d92f9e313fb0b517a13916.tar.gz CMake-d2515f77e19959e2b8d92f9e313fb0b517a13916.tar.bz2 |
Merge branch 'master' into ctest-test-changing-labels
Diffstat (limited to 'Tests/RunCMake/ctest_test')
-rw-r--r-- | Tests/RunCMake/ctest_test/RunCMakeTest.cmake | 25 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_test/TestExtraLabels-check.cmake | 25 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_test/TestMeasurements-check.cmake | 18 |
3 files changed, 68 insertions, 0 deletions
diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index 5f9b32d..de81049 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() @@ -194,3 +206,16 @@ set_property(TEST b PROPERTY LABELS b) run_ctest(TestChangingLabels) endfunction() run_changing_labels() + +# Verify that test output can add additional labels +function(run_extra_labels) + set(CASE_CMAKELISTS_SUFFIX_CODE [[ +add_test( + NAME custom_labels + COMMAND ${CMAKE_COMMAND} -E + echo before\n<CTestLabel>label2</CTestLabel>\n<CTestLabel>label1</CTestLabel>\n<CTestLabel>label3</CTestLabel>\n<CTestLabel>label2</CTestLabel>\nafter) +set_tests_properties(custom_labels PROPERTIES LABELS "label1") + ]]) + run_ctest(TestExtraLabels) +endfunction() +run_extra_labels() diff --git a/Tests/RunCMake/ctest_test/TestExtraLabels-check.cmake b/Tests/RunCMake/ctest_test/TestExtraLabels-check.cmake new file mode 100644 index 0000000..eaa50d1 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestExtraLabels-check.cmake @@ -0,0 +1,25 @@ +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 labels. +STRING(REGEX MATCHALL [[<Label>label1</Label>]] matches "${_test_contents}") +list(LENGTH matches n_matches) +if(NOT n_matches EQUAL 1) + string(APPEND RunCMake_TEST_FAILED "expected 1 match for label1, found ${n_matches}") +endif() +STRING(REGEX MATCHALL [[<Label>label2</Label>]] matches "${_test_contents}") +list(LENGTH matches n_matches) +if(NOT n_matches EQUAL 1) + string(APPEND RunCMake_TEST_FAILED "expected 1 match for label2, found ${n_matches}") +endif() +STRING(REGEX MATCHALL [[<Label>label3</Label>]] matches "${_test_contents}") +list(LENGTH matches n_matches) +if(NOT n_matches EQUAL 1) + string(APPEND RunCMake_TEST_FAILED "expected 1 match for label3, found ${n_matches}") +endif() + +# Check test output. +if(NOT _test_contents MATCHES "<Value>before\nafter\n</Value>") + string(APPEND RunCMake_TEST_FAILED "Could not find expected output in Test.xml") +endif() 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() |