Repository: kudu
Updated Branches:
  refs/heads/master 0ddb860d0 -> 5df9c9e0f


run-test.sh: treat empty gzipped output files as text files

I saw a test run where pstack_watcher-test timed out and gzip didn't produce
any output. Thus, we ended up with an empty pstack_watcher-test.txt.gz file
which is corrupt by definition; there should at least be a gzip header.

If this happens, let's treat the empty file as an empty text file so that
subsequent output file post-processing (which uses commands like zcat/zgrep)
doesn't fail.

Importantly, the pstack_watcher-test timeout does NOT benefit from this fix.
That's because pstack_watcher-test was being traced by gdb, so it couldn't
deliver itself a SIGABRT to timeout after 900 seconds. Instead, ctest killed
it after 930 seconds by sending a SIGKILL to run-test.sh itself, thus
preventing this cleanup code from running.

Change-Id: I0fbe13982412f9113b27afbc40635f8945c45f09
Reviewed-on: http://gerrit.cloudera.org:8080/10062
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <t...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/3aa1070e
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/3aa1070e
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/3aa1070e

Branch: refs/heads/master
Commit: 3aa1070eef3bf981b87084c2a9ea91ca881829f6
Parents: 0ddb860
Author: Adar Dembo <a...@cloudera.com>
Authored: Thu Apr 12 10:12:07 2018 -0700
Committer: Todd Lipcon <t...@apache.org>
Committed: Fri Apr 13 19:53:59 2018 +0000

----------------------------------------------------------------------
 build-support/run-test.sh | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/3aa1070e/build-support/run-test.sh
----------------------------------------------------------------------
diff --git a/build-support/run-test.sh b/build-support/run-test.sh
index dd91c1e..bd33b6b 100755
--- a/build-support/run-test.sh
+++ b/build-support/run-test.sh
@@ -184,6 +184,15 @@ for ATTEMPT_NUMBER in $(seq 1 $TEST_EXECUTION_ATTEMPTS) ; 
do
     | $pipe_cmd > $LOGFILE
   STATUS=$?
 
+  # An empty gzipped file is corrupt because even a logically empty gzipped 
file
+  # should contain at least the gzip header. If we detect this, treat the test
+  # log output as a plain text file.
+  if [[ -f $LOGFILE && ! -s $LOGFILE && $LOGFILE =~ .gz$ ]]; then
+    RENAMED_LOGFILE=${LOGFILE%%.gz}
+    mv $LOGFILE $RENAMED_LOGFILE
+    LOGFILE=$RENAMED_LOGFILE
+  fi
+
   # TSAN doesn't always exit with a non-zero exit code due to a bug:
   # mutex errors don't get reported through the normal error reporting 
infrastructure.
   # So we make sure to detect this and exit 1.

Reply via email to