From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id C1C6B386F83F for ; Sun, 17 May 2020 14:41:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C1C6B386F83F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mark@klomp.org Received: from librem (deer0x15.wildebeest.org [172.31.17.151]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 5E4763000A21; Sun, 17 May 2020 16:41:56 +0200 (CEST) Received: by librem (Postfix, from userid 1000) id E258AC2150; Sun, 17 May 2020 16:41:29 +0200 (CEST) Date: Sun, 17 May 2020 16:41:29 +0200 From: Mark Wielaard To: Rahul Kumar Cc: bzip2-devel@sourceware.org Subject: Re: [PATCH] bzip2: modify run-tests script Message-ID: <20200517144129.GN13278@wildebeest.org> References: <1587406389-28634-1-git-send-email-rahulk@mvista.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="A6N2fC+uXW/VQSAv" Content-Disposition: inline In-Reply-To: <1587406389-28634-1-git-send-email-rahulk@mvista.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: bzip2-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Bzip2-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 May 2020 14:42:00 -0000 --A6N2fC+uXW/VQSAv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Rahul, On Mon, Apr 20, 2020 at 11:43:09PM +0530, Rahul Kumar wrote: > 1) modify run-tests script to write PASS/FAIL as expected by the > ptest infrastructure > > 2) Since the discrete md5sum does not have a short form of > --status.And minimal base images does not support commands with > long form arguments so dropping this argument I really like your changes. The PASS/FAIL output is much nicer and more standard. I tweaked the script a bit more to remove most other output by deleting the echos that have now been replaced by PASS/FAIL messages and redirecting the output of md5sum to /dev/null (the standard one would now output "OK" all the time). Patch as pushed attached. Thanks, Mark --A6N2fC+uXW/VQSAv Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-bzip2-modify-run-tests-script-to-PASS-FAIL.patch" >From f9061c030a25de5b6829e1abf373057309c734c0 Mon Sep 17 00:00:00 2001 From: Rahul Kumar Date: Mon, 20 Apr 2020 23:43:09 +0530 Subject: [PATCH] bzip2: modify run-tests script to PASS/FAIL 1) modify run-tests script to write PASS/FAIL as expected by the ptest infrastructure 2) Since the discrete md5sum does not have a short form of --status.And minimal base images does not support commands with long form arguments so dropping this argument Signed-off-by: Rahul Kumar --- run-tests.sh | 78 +++++++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/run-tests.sh b/run-tests.sh index 1ba8c27..3b80fdd 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -40,21 +40,21 @@ case $i in esac done -if ! type "valgrind" > /dev/null; then +if ! type "valgrind" > /dev/null 2>&1; then VALGRIND="" VALGRIND_ARGS="" fi echo "Testing ${BZIP2} in directory ${TESTS_DIR}" if [ "$VALGRIND" != "" ]; then - echo " using valgrind" + echo "Using valgrind: Yes" else - echo " NOT using valgrind" + echo "Using valgrind: No" fi if [[ ${IGNORE_MD5} -eq 0 ]]; then - echo " checking md5 sums" + echo "Checking md5 sums: Yes" else - echo " NOT checking md5 sums" + echo "Checking md5 sums: No" fi # Remove any left over tesfilecopies from previous runs first. @@ -73,19 +73,18 @@ while IFS= read -r -d '' bzfile; do bzcopy="${copy}.bz2" md5file="${file}.md5" - echo "Processing ${bzfile}" - # Decompress it. - echo " Decompress..." rm -f "${file}" ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -k -d -q ${bzfile} \ - || { echo "!!! bad decompress result $?"; + && { echo "PASS: ${bzfile} Decompress"; } \ + || { echo "FAIL: ${bzfile} Decompress"; 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"; + md5sum -c ${md5file} < ${file} > /dev/null \ + && { echo "PASS: ${bzfile} md5sum Matched"; } \ + || { echo "FAIL: ${bzfile} md5sum Matched"; badtests=("${badtests[@]}" $"${file} md5sum doesn't match") nogood=$[${nogood}+1]; continue; } fi @@ -93,20 +92,21 @@ while IFS= read -r -d '' bzfile; do # Compress and decompress a copy mv "${file}" "${copy}" rm -f "${bzcopy}" - echo " Recompress..." ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -z -q -s ${copy} \ - || { echo "!!! bad compress result $?"; + && { echo "PASS: ${bzfile} Recompress "; } \ + || { echo "FAIL: ${bzfile} Recompress"; badtests=("${badtests[@]}" $"${copy} bad result") nogood=$[${nogood}+1]; continue; } - echo " Redecompress..." ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -d -q -s ${bzcopy} \ - || { echo "!!! bad (re)decompress result $?"; + && { echo "PASS: ${bzfile} Redecompress"; } \ + || { echo "FAIL: ${bzfile} Redecompress"; 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"; + md5sum -c ${md5file} < ${copy} > /dev/null \ + && { echo "PASS: ${bzfile} md5sum ReMatched"; } \ + || { echo "FAIL: ${bzfile} md5sum ReMatched"; badtests=("${badtests[@]}" $"${copy} md5sum doesn't match") nogood=$[${nogood}+1]; continue; } fi @@ -114,16 +114,17 @@ while IFS= read -r -d '' bzfile; do rm "${copy}" # Now do it all again in "small" mode. - echo " Decompress (small)..." rm -f "${file}" ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -k -d -q -s ${bzfile} \ - || { echo "!!! bad decompress result $?"; + && { echo "PASS: ${bzfile} Decompress (small)"; } \ + || { echo "FAIL: ${bzfile} Decompress (small)"; 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"; + md5sum -c ${md5file} < ${file} > /dev/null \ + && { echo "PASS: ${bzfile} Md5sum Matched (small)"; } \ + || { echo "FAIL: ${bzfile} Md5sum Matched (small)"; badtests=("${badtests[@]}" $"${file} md5sum doesn't match") nogood=$[${nogood}+1]; continue; } fi @@ -131,20 +132,21 @@ while IFS= read -r -d '' bzfile; do # Compress and decompress a copy mv "${file}" "${copy}" rm -f "${bzcopy}" - echo " Recompress (small)..." ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -z -q -s ${copy} \ - || { echo "!!! bad compress result $?"; + && { echo "PASS: ${bzfile} Recompress (small)"; } \ + || { echo "FAIL: ${bzfile} Recompress (small)"; 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 $?"; + && { echo "PASS: ${bzfile} Redecompress (small)"; } \ + || { echo "FAIL: ${bzfile} Redecompress (small)"; 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"; + md5sum -c ${md5file} < ${copy} > /dev/null \ + && { echo "PASS: ${bzfile} md5sum ReMatched (small)"; } \ + || { echo "FAIL: ${bzfile} md5sum ReMatched (small)"; badtests=("${badtests[@]}" $"${copy} md5sum doesn't match") nogood=$[${nogood}+1]; continue; } fi @@ -169,14 +171,11 @@ nobad=0 badbad=0 while IFS= read -r -d '' badfile; do - echo "Processing ${badfile}" - - echo " Trying to decompress..." - ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -k -d -q ${badfile} + ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -k -d -q ${badfile} > /dev/null 2>&1 ret=$? if [[ ${ret} -eq 0 ]]; then - echo "!!! badness not detected" + echo "FAIL: badness not detected in ${badfile}" nobad=$[${nobad}+1] badtests=("${badtests[@]}" $"${badfile} badness not detected") continue @@ -185,18 +184,19 @@ while IFS= read -r -d '' badfile; do # Assumes "normal" badness is detected by exit code 1 or 2. # A crash or valgrind issue will be reported with something else. if [[ ${ret} != 1 ]] && [[ ${ret} != 2 ]]; then - echo "!!! baddness caused baddness in ${BZIP2}" + echo "FAIL: baddness caused baddness in ${BZIP2} for ${badfile}" badbad=$[${badbad}+1] badtests=("${badtests[@]}" $"${badfile} badness caused baddness") continue + else + echo "PASS: Correctly found data integrity errors in ${badfile}" fi - echo " Trying to decompress (small)..." - ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -k -d -q -s ${badfile} + ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -k -d -q -s ${badfile} > /dev/null 2>&1 ret=$? if [[ ${ret} -eq 0 ]]; then - echo "!!! badness not detected" + echo "FAIL: badness not detected in ${badfile} (small)" nobad=$[${nobad}+1] badtests=("${badtests[@]}" $"${badfile} badness not detected") continue @@ -205,10 +205,12 @@ while IFS= read -r -d '' badfile; do # Assumes "normal" badness is detected by exit code 1 or 2. # A crash or valgrind issue will be reported with something else. if [[ ${ret} != 1 ]] && [[ ${ret} != 2 ]]; then - echo "!!! baddness caused baddness in ${BZIP2}" + echo "FAIL: baddness caused baddness in ${BZIP2} for ${badfile} (small)" badbad=$[${badbad}+1] badtests=("${badtests[@]}" $"${badfile} badness caused baddness") continue + else + echo "PASS: Correctly found data integrity errors in ${badfile} (small)" fi done < <(find ${TESTS_DIR} -type f -name \*\.bz2.bad -print0) @@ -232,7 +234,7 @@ if [[ ${results} -eq 0 ]]; then echo "All tests passed" exit 0 else - echo "Bad results, look for !!! in the logs above" + echo "Bad results, look for FAIL and !!! in the logs above" printf ' - %s\n' "${badtests[@]}" exit 1 fi -- 2.20.1 --A6N2fC+uXW/VQSAv--