diff options
-rw-r--r-- | test/run.cmake | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/run.cmake b/test/run.cmake index 5e1c55b..a123639 100644 --- a/test/run.cmake +++ b/test/run.cmake @@ -55,6 +55,7 @@ foreach(o result stdout stderr ${maybe_xml}) 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) break() endif() endforeach() @@ -73,6 +74,17 @@ foreach(o result stdout stderr ${maybe_xml}) endforeach() if(msg) + if("$ENV{TEST_UPDATE}" AND expect_xml_file AND EXISTS "${xml}") + set(update_xml "${actual_xml}") + string(REGEX REPLACE "^<\\?xml version=\"1.0\"\\?>" "^<\\\\?xml version=\"1.0\"\\\\?>" update_xml "${update_xml}") + string(REGEX REPLACE "<GCC_XML[^>]*>" "<GCC_XML[^>]*>" update_xml "${update_xml}") + string(REGEX REPLACE "artificial=\"1\"( throws=\"\")?" "artificial=\"1\"( throws=\"\")?" update_xml "${update_xml}") + string(REGEX REPLACE "size=\"[0-9]+\" align=\"[0-9]+\"" "size=\"[0-9]+\" align=\"[0-9]+\"" update_xml "${update_xml}") + string(REGEX REPLACE "<File id=\"(f[0-9]+)\" name=\"[^\"]*/test/input/([^\"]*)\"/>" "<File id=\"\\1\" name=\".*/test/input/\\2\"/>" update_xml "${update_xml}") + string(REGEX REPLACE "</GCC_XML>$" "</GCC_XML>$" update_xml "${update_xml}") + file(WRITE "${expect_xml_file}" "${update_xml}\n") + endif() + string(REPLACE ";" "\" \"" command_string "\"${command}\"") set(msg "${msg}Command was:\n command> ${command_string}\n") message(SEND_ERROR |