Skip to content

Commit

Permalink
Cat the jvm.log if present
Browse files Browse the repository at this point in the history
Issue like bazelbuild#2939 are impossible to debug due to missing
jvm.log, make the test framework print it before dying if
the error log output the jvm.log

Fixes bazelbuild#2939 (at least the part we can act on).

PiperOrigin-RevId: 155192458
  • Loading branch information
damienmg committed May 5, 2017
1 parent d74bf36 commit 0e8997c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/test/shell/unittest.bash
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ function disable_errexit() {
# Enable errexit with pretty stack traces.
enable_errexit

cat_jvm_log () {
if [[ "$log_content" =~ "(error code:".*", error message: '".*"', log file: '"(.*)"')" ]]; then
echo >&2
echo "Content of ${BASH_REMATCH[1]}:" >&2
cat "${BASH_REMATCH[1]}" >&2
fi
}

# Print message in "$1" then exit with status "$2"
die () {
# second argument is optional, defaulting to 1
Expand All @@ -116,6 +124,7 @@ die () {
fi
if [ "$CAPTURED_STD_ERR" -ne 0 ]; then
cat "${TEST_TMPDIR}/captured.err" 1>&2
cat_jvm_log "$(cat "${TEST_TMPDIR}/captured.err")"
CAPTURED_STD_ERR=0
fi
fi
Expand Down

0 comments on commit 0e8997c

Please sign in to comment.