Skip to content

Commit

Permalink
Make tests scripts less verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelm committed Mar 4, 2024
1 parent bd183f5 commit a333a29
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions tests/compare-baseline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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}
Expand Down
15 changes: 10 additions & 5 deletions tests/run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -xeuo pipefail
set -euo pipefail

if [[ $OSTYPE = linux-gnu ]]; then
color="--color=always"
Expand All @@ -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
Expand Down Expand Up @@ -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"

0 comments on commit a333a29

Please sign in to comment.