public inbox for bzip2-devel@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: bzip2-devel@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [bzip2-tests] Collect all bad tests file names and results to print at the end.
Date: Tue, 01 Jan 2019 00:00:00 -0000	[thread overview]
Message-ID: <1562542635-22148-1-git-send-email-mark@klomp.org> (raw)

I added the bzip2-tests to the buildbot, but noticed that when there are
bad results, it isn't immediately clear what exactly failed. So this patch
improves the output of the run-test.sh a bit.

When there are bad tests run-tests.sh will print:

  Bad results, look for !!! in the logs above

To make it easier to see which files/results were bad, collect them and
print them at the end. A bad run will now print something like:

  Bad results, look for !!! in the logs above
   - lbzip2/32767.bz2 bad decompress result
   - lbzip2/incomp-2 md5sum doesn't match
---
 run-tests.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/run-tests.sh b/run-tests.sh
index c07deea..1ba8c27 100755
--- a/run-tests.sh
+++ b/run-tests.sh
@@ -64,6 +64,8 @@ find ${TESTS_DIR} -type f -name \*\.testfilecopy\.bz2 -exec rm \{\} \;
 echo "Testing decompression and recompression..."
 echo
 
+badtests=()
+
 nogood=0
 while IFS= read -r -d '' bzfile; do
   file="${bzfile%.*}"
@@ -78,11 +80,13 @@ while IFS= read -r -d '' bzfile; do
   rm -f "${file}"
   ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -k -d -q ${bzfile} \
     || { echo "!!! bad decompress result $?";
+         badtests=("${badtests[@]}" $"${bzfile} bad decompress result")
          nogood=$[${nogood}+1]; continue; }
 
   if [[ ${IGNORE_MD5} -ne 1 ]]; then
     md5sum --check --status ${md5file} < ${file} \
       || { echo "!!! md5sum doesn't match decompressed file";
+           badtests=("${badtests[@]}" $"${file} md5sum doesn't match")
            nogood=$[${nogood}+1]; continue; }
   fi
 
@@ -92,15 +96,18 @@ while IFS= read -r -d '' bzfile; do
   echo "  Recompress..."
   ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -z -q -s ${copy} \
     || { echo "!!! bad compress result $?";
+         badtests=("${badtests[@]}" $"${copy} bad result")
          nogood=$[${nogood}+1]; continue; }
   echo "  Redecompress..."
   ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -d -q -s ${bzcopy} \
     || { echo "!!! bad (re)decompress result $?";
+         badtests=("${badtests[@]}" $"${bzcopy} bad result")
          nogood=$[${nogood}+1]; continue; }
 
   if [[ ${IGNORE_MD5} -ne 1 ]]; then
     md5sum --check --status ${md5file} < ${copy} \
       || { echo "!!! md5sum doesn't match (re)decompressed file";
+           badtests=("${badtests[@]}" $"${copy} md5sum doesn't match")
            nogood=$[${nogood}+1]; continue; }
   fi
 
@@ -111,11 +118,13 @@ while IFS= read -r -d '' bzfile; do
   rm -f "${file}"
   ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -k -d -q -s ${bzfile} \
     || { echo "!!! bad decompress result $?";
+         badtests=("${badtests[@]}" $"${bzfile} bad decompress result")
          nogood=$[${nogood}+1]; continue; }
 
   if [[ ${IGNORE_MD5} -ne 1 ]]; then
     md5sum --check --status ${md5file} < ${file} \
       || { echo "!!! md5sum doesn't match decompressed file";
+           badtests=("${badtests[@]}" $"${file} md5sum doesn't match")
            nogood=$[${nogood}+1]; continue; }
   fi
 
@@ -125,15 +134,18 @@ while IFS= read -r -d '' bzfile; do
   echo "  Recompress (small)..."
   ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -z -q -s ${copy} \
     || { echo "!!! bad compress result $?";
+         badtests=("${badtests[@]}" $"${copy} bad result")
          nogood=$[${nogood}+1]; continue; }
   echo "  Redecompress (small)..."
   ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -d -q -s ${bzcopy} \
     || { echo "!!! bad (re)decompress result $?";
+         badtests=("${badtests[@]}" $"${bzcopy} bad result")
          nogood=$[${nogood}+1]; continue; }
 
   if [[ ${IGNORE_MD5} -ne 1 ]]; then
     md5sum --check --status ${md5file} < ${copy} \
       || { echo "!!! md5sum doesn't match (re)decompressed file";
+           badtests=("${badtests[@]}" $"${copy} md5sum doesn't match")
            nogood=$[${nogood}+1]; continue; }
   fi
 
@@ -166,6 +178,7 @@ while IFS= read -r -d '' badfile; do
   if [[ ${ret} -eq 0 ]]; then
     echo "!!! badness not detected"
     nobad=$[${nobad}+1]
+    badtests=("${badtests[@]}" $"${badfile} badness not detected")
     continue
   fi
 
@@ -174,6 +187,7 @@ while IFS= read -r -d '' badfile; do
   if [[ ${ret} != 1 ]] && [[ ${ret} != 2 ]]; then
     echo "!!! baddness caused baddness in ${BZIP2}"
     badbad=$[${badbad}+1]
+    badtests=("${badtests[@]}" $"${badfile} badness caused baddness")
     continue
   fi
 
@@ -184,6 +198,7 @@ while IFS= read -r -d '' badfile; do
   if [[ ${ret} -eq 0 ]]; then
     echo "!!! badness not detected"
     nobad=$[${nobad}+1]
+    badtests=("${badtests[@]}" $"${badfile} badness not detected")
     continue
   fi
 
@@ -192,6 +207,7 @@ while IFS= read -r -d '' badfile; do
   if [[ ${ret} != 1 ]] && [[ ${ret} != 2 ]]; then
     echo "!!! baddness caused baddness in ${BZIP2}"
     badbad=$[${badbad}+1]
+    badtests=("${badtests[@]}" $"${badfile} badness caused baddness")
     continue
   fi
 
@@ -217,5 +233,6 @@ if [[ ${results} -eq 0 ]]; then
   exit 0
 else
   echo "Bad results, look for !!! in the logs above"
+  printf ' - %s\n' "${badtests[@]}"
   exit 1
 fi
-- 
1.8.3.1

                 reply	other threads:[~2019-07-07 23:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1562542635-22148-1-git-send-email-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=bzip2-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).