From a333a2970f88b58d0fcbf2d5f4e8b35de5619da8 Mon Sep 17 00:00:00 2001 From: Marcel Martin Date: Mon, 4 Mar 2024 11:04:07 +0100 Subject: [PATCH] Make tests scripts less verbose --- tests/compare-baseline.sh | 4 ++-- tests/run.sh | 15 ++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/compare-baseline.sh b/tests/compare-baseline.sh index 4bc2223b..f84e60ca 100755 --- a/tests/compare-baseline.sh +++ b/tests/compare-baseline.sh @@ -52,7 +52,7 @@ if ! test -f ${baseline_bam}; then git clone . ${srcdir} ( cd ${srcdir} && git checkout -d ${baseline_commit} ) cmake ${srcdir} -B ${srcdir}/build ${cmake_options} - if ! make -j 4 -C ${srcdir}/build strobealign; then + if ! make -s -j 4 -C ${srcdir}/build strobealign; then exit 1 fi mv ${srcdir}/build/strobealign ${baseline_binary} @@ -65,7 +65,7 @@ fi # compiler options. builddir=$(mktemp -p . -d build.XXXXXXX) cmake . -B ${builddir} ${cmake_options} -make -j 4 -C ${builddir} strobealign +make -s -j 4 -C ${builddir} strobealign set -x ${builddir}/strobealign ${strobealign_options} ${ref} ${reads[@]} | samtools view -o head.bam rm -rf ${builddir} diff --git a/tests/run.sh b/tests/run.sh index d7d6f064..32efab69 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -xeuo pipefail +set -euo pipefail if [[ $OSTYPE = linux-gnu ]]; then color="--color=always" @@ -8,15 +8,18 @@ else fi function strobealign() { - build/strobealign "${@}" + echo "Testing '${@}'" >&2 + build/strobealign "${@}" 2> testlog.txt } function diff() { - env diff -u ${color} "$1" "$2" + if ! env diff -u ${color} "$1" "$2"; then + echo "Failure running 'diff $1 $2'" + exit 1 + fi } -# Unit tests -build/test-strobealign +build/test-strobealign --no-intro # should fail when unknown command-line option used if strobealign -G > /dev/null 2> /dev/null; then false; fi @@ -106,3 +109,5 @@ rm no-secondary.sam with-secondary.sam with-secondary-only-primary.sam repeated- strobealign -C --no-PG --rg-id=1 --rg=SM:sample --rg=LB:library tests/phix.fasta tests/phix.tags.fastq > with-tags.sam diff tests/phix.tags.sam with-tags.sam rm with-tags.sam + +echo "Success"