diff options
author | Brad King <brad.king@kitware.com> | 2014-02-25 19:23:58 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-03-21 20:32:55 (GMT) |
commit | 3b40cc53502afa476384b2c62ec6fee9f521b1fd (patch) | |
tree | 0517fc5c3d86d86608fc1b417c211d3ff15fe30b /test/run.cmake | |
parent | 5aa9127574095f317a368d09c5a6bfb996ae792f (diff) | |
download | CastXML-3b40cc53502afa476384b2c62ec6fee9f521b1fd.zip CastXML-3b40cc53502afa476384b2c62ec6fee9f521b1fd.tar.gz CastXML-3b40cc53502afa476384b2c62ec6fee9f521b1fd.tar.bz2 |
Extend xml test cases to validate with xmllint if available
Look for xmllint and use it to validate the xml format in test results.
Diffstat (limited to 'test/run.cmake')
-rw-r--r-- | test/run.cmake | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/run.cmake b/test/run.cmake index c66405f..9cf4ad6 100644 --- a/test/run.cmake +++ b/test/run.cmake @@ -72,3 +72,26 @@ if(msg) "${actual-xml}" ) endif() + +if(xmllint AND xml AND EXISTS "${xml}") + execute_process( + COMMAND ${xmllint} --noout --nonet "${xml}" + OUTPUT_VARIABLE xmllint_stdout + ERROR_VARIABLE xmllint_stderr + RESULT_VARIABLE xmllint_result + ) + if(xmllint_result) + foreach(o result stdout stderr) + string(REGEX REPLACE "\n+$" "" xmllint_${o} "${xmllint_${o}}") + string(REGEX REPLACE "\n" "\n xmllint-${o}> " xmllint-${o} " xmllint-${o}> ${xmllint_${o}}") + set(xmllint-${o} "xmllint ${o}:\n${xmllint-${o}}\n") + endforeach() + message(SEND_ERROR + "xmllint check failed:\n" + "${msg}" + "${xmllint-result}" + "${xmllint-stdout}" + "${xmllint-stderr}" + ) + endif() +endif() |