aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/test
diff options
context:
space:
mode:
authorGravatar dmarting <dmarting@google.com>2017-08-07 18:15:33 +0200
committerGravatar Marcel Hlopko <hlopko@google.com>2017-08-08 13:02:17 +0200
commit2f6284268d4f05bb47bdffa106d3d110d5160393 (patch)
tree3c10797c02cd97fb02ff8ccda43c35cf82591114 /tools/test
parentea481738c8e235d95cc2512931b1e588c6a279f3 (diff)
test-setup.sh: don't cat the log file if it does not exists
This should fix flakiness of test_flaky_test PiperOrigin-RevId: 164467764
Diffstat (limited to 'tools/test')
-rwxr-xr-xtools/test/test-setup.sh10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/test/test-setup.sh b/tools/test/test-setup.sh
index 896998f487..18796c3704 100755
--- a/tools/test/test-setup.sh
+++ b/tools/test/test-setup.sh
@@ -141,10 +141,12 @@ if [[ -z "$no_echo" ]]; then
fi
function encode_output_file {
- # Replace invalid XML characters and invalid sequence in CDATA
- # cf. https://stackoverflow.com/a/7774512/4717701
- perl -CSDA -pe's/[^\x9\xA\xD\x20-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]+/?/g;' "$1" \
- | sed 's|]]>|]]>]]<![CDATA[>|g'
+ if [ -f "$1" ]; then
+ # Replace invalid XML characters and invalid sequence in CDATA
+ # cf. https://stackoverflow.com/a/7774512/4717701
+ perl -CSDA -pe's/[^\x9\xA\xD\x20-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]+/?/g;' "$1" \
+ | sed 's|]]>|]]>]]<![CDATA[>|g'
+ fi
}
function write_xml_output_file {