diff options
author | Brad King <brad.king@kitware.com> | 2014-04-09 20:01:42 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-04-09 20:44:12 (GMT) |
commit | 174356cdb7f27e741f9668883d1c5d558e20bc6b (patch) | |
tree | d2f870ba895030d76745ca7e50d69f8cdc33d9db /test/run.cmake | |
parent | 9216e5fb1fdffd5c0040ee4ea50e6b3ea6129964 (diff) | |
download | CastXML-174356cdb7f27e741f9668883d1c5d558e20bc6b.zip CastXML-174356cdb7f27e741f9668883d1c5d558e20bc6b.tar.gz CastXML-174356cdb7f27e741f9668883d1c5d558e20bc6b.tar.bz2 |
test: Support zero or many alternative expected result file names
Teach test/run.cmake to loop over a list of possible expected result
names. This will allow tests results to be specialized in certain
cases without duplicating common results.
Diffstat (limited to 'test/run.cmake')
-rw-r--r-- | test/run.cmake | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/test/run.cmake b/test/run.cmake index 3699b6c..560327e 100644 --- a/test/run.cmake +++ b/test/run.cmake @@ -45,12 +45,15 @@ foreach(o result stdout stderr ${maybe_xml}) set(actual-${o} "Actual ${o}:\n${actual-${o}}\n") set(expect-${o} "") - if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/expect/${test}-${o}.txt) - file(READ ${CMAKE_CURRENT_LIST_DIR}/expect/${test}-${o}.txt expect_${o}) - elseif(DEFINED default_${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}) + break() + endif() + endforeach() + if(NOT DEFINED expect_${o} AND DEFINED default_${o}) set(expect_${o} "${default_${o}}") - else() - unset(expect_${o}) endif() if(DEFINED expect_${o}) |