diff options
author | 2017-08-04 14:51:04 +0200 | |
---|---|---|
committer | 2017-08-04 17:19:10 +0200 | |
commit | dba4916861074760d120dcc0f15cc916f8d8520e (patch) | |
tree | 073a314bc5198f1648d2c47879ed90759a6cd971 /src/java_tools/junitrunner/javatests/com/google | |
parent | 025a7b0a33680c53d872d241fdb49f3ab578afd6 (diff) |
sed: fall back to -r if -E does not work
PiperOrigin-RevId: 164252615
Diffstat (limited to 'src/java_tools/junitrunner/javatests/com/google')
-rwxr-xr-x | src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/antxmlresultwriter_integration_test.sh | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/antxmlresultwriter_integration_test.sh b/src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/antxmlresultwriter_integration_test.sh index 609518a6bf..dc3260e18c 100755 --- a/src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/antxmlresultwriter_integration_test.sh +++ b/src/java_tools/junitrunner/javatests/com/google/testing/junit/runner/antxmlresultwriter_integration_test.sh @@ -31,16 +31,19 @@ source ${DIR}/testenv.sh || { echo "testenv.sh not found!" >&2; exit 1; } function test_XmlOutputExercises() { cd $TEST_TMPDIR + EXT_REGEX_FLAG="-E" + # This test sometimes runs with an old version of sed that has -r but not -E. + sed "$EXT_REGEX_FLAG" "" /dev/null 2> /dev/null || EXT_REGEX_FLAG="-r" $TESTBED --jvm_flag=${SUITE_FLAG} || true # Test failures # Remove timestamps and test runtime from the XML files as they will always differ and cause a # mismatch. - sed -i.bak -E "s/(time[^=]*)='[^']*/\1='/g" $XML_OUTPUT_FILE \ + sed -i.bak "$EXT_REGEX_FLAG" "s/(time[^=]*)='[^']*/\1='/g" $XML_OUTPUT_FILE \ || fail "sed to remove timestamps failed" # Removes the stacktrace from the XML files, it can vary between JDK versions. - sed -i.bak -E '/\w*at [a-zA-Z0-9\$\.]+\([a-zA-Z0-9 \.]*(:[0-9]+)?\)$/d' \ + sed -i.bak "$EXT_REGEX_FLAG" '/\w*at [a-zA-Z0-9\$\.]+\([a-zA-Z0-9 \.]*(:[0-9]+)?\)$/d' \ "${XML_OUTPUT_FILE}" || fail "sed to remove stacktraces failed" diff -wu $XML_GOLDEN_OUTPUT_FILE $XML_OUTPUT_FILE \ |