diff options
author | Brad King <brad.king@kitware.com> | 2015-12-03 19:20:51 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-12-03 19:38:26 (GMT) |
commit | e79f75a52e3da64686dcf56a1befcd17b26bbb55 (patch) | |
tree | ad2a2d0bc7161883d920cdd523d6a6a1832f2e10 /test | |
parent | ecb12b7e6f0c1e2674e7bb1c9606927a3167a10f (diff) | |
download | CastXML-e79f75a52e3da64686dcf56a1befcd17b26bbb55.zip CastXML-e79f75a52e3da64686dcf56a1befcd17b26bbb55.tar.gz CastXML-e79f75a52e3da64686dcf56a1befcd17b26bbb55.tar.bz2 |
test: Support absolute paths to expected result files
Teach test/run.cmake to accept absolute paths to files containing
expected results. This will allow tests to compute the expected values
at configuration time.
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 3 | ||||
-rw-r--r-- | test/run.cmake | 11 |
2 files changed, 10 insertions, 4 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 248af67..b9beed9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -23,11 +23,12 @@ find_package(LibXml2 QUIET) macro(castxml_test_cmd test) set(command $<TARGET_FILE:castxml> ${ARGN}) + set(_castxml_expect ${castxml_test_cmd_expect} cmd.${test}) add_test( NAME cmd.${test} COMMAND ${CMAKE_COMMAND} "-Dcommand:STRING=${command}" - "-Dexpect=cmd.${test}" + "-Dexpect=${_castxml_expect}" ${castxml_test_cmd_extra_arguments} -P ${CMAKE_CURRENT_SOURCE_DIR}/run.cmake ) diff --git a/test/run.cmake b/test/run.cmake index d5e61ff..e254b33 100644 --- a/test/run.cmake +++ b/test/run.cmake @@ -57,9 +57,14 @@ foreach(o result stdout stderr ${maybe_xml}) set(expect-${o} "") unset(expect_${o}) foreach(e ${expect}) - if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/expect/${e}.${o}.txt) - file(READ ${CMAKE_CURRENT_LIST_DIR}/expect/${e}.${o}.txt expect_${o}) - set(expect_${o}_file ${CMAKE_CURRENT_LIST_DIR}/expect/${e}.${o}.txt) + if(IS_ABSOLUTE "${e}") + set(f "${e}.${o}.txt") + else() + set(f ${CMAKE_CURRENT_LIST_DIR}/expect/${e}.${o}.txt) + endif() + if(EXISTS "${f}") + file(READ "${f}" expect_${o}) + set(expect_${o}_file "${f}") break() endif() endforeach() |