Skip to content

Commit

Permalink
Set pipefail in setup scripts
Browse files Browse the repository at this point in the history
This was added in places where it's been necessary. Setting it in shared
setup scripts simplifies tests and allows future tests to use pipes
without the need to set pipefail explicitly.

A couple calls with non-zero exit codes have been exposed. These still
fall under expected behavior.
  • Loading branch information
victorlin committed Oct 2, 2024
1 parent 5c746dd commit 8cac61c
Show file tree
Hide file tree
Showing 15 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/functional/_setup.sh
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export AUGUR="${AUGUR:-$TESTDIR/../../bin/augur}"
set -o pipefail
1 change: 1 addition & 0 deletions tests/functional/ancestral/cram/_setup.sh
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export AUGUR="${AUGUR:-$TESTDIR/../../../../bin/augur}"
set -o pipefail
1 change: 1 addition & 0 deletions tests/functional/curate/cram/_setup.sh
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export AUGUR="${AUGUR:-$TESTDIR/../../../../bin/augur}"
set -o pipefail
1 change: 0 additions & 1 deletion tests/functional/curate/cram/validate-records.t
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ error when it encounters the record with mismatched fields.
Passing the records through multiple augur curate commands should raise the
same error when it encounters the record with mismatched fields.

$ set -o pipefail
$ cat records.ndjson \
> | ${AUGUR} curate passthru \
> | ${AUGUR} curate passthru \
Expand Down
1 change: 1 addition & 0 deletions tests/functional/export_v2/cram/_setup.sh
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export AUGUR="${AUGUR:-$TESTDIR/../../../../bin/augur}"
set -o pipefail
1 change: 1 addition & 0 deletions tests/functional/filter/cram/_setup.sh
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export AUGUR="${AUGUR:-$TESTDIR/../../../../bin/augur}"
set -o pipefail
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Repeat with sequence and strain outputs. We should get the same results.
\s*0 .* (re)
$ grep "^>" filtered.fasta | wc -l
\s*0 (re)
[1]

Repeat without any sequence-based filters.
Since we expect metadata to be filtered by presence of strains in input sequences, this should produce no results because the intersection of metadata and sequences is empty.
Expand Down
1 change: 1 addition & 0 deletions tests/functional/frequencies/cram/_setup.sh
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export AUGUR="${AUGUR:-$TESTDIR/../../../../bin/augur}"
set -o pipefail
1 change: 1 addition & 0 deletions tests/functional/merge/cram/_setup.sh
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export AUGUR="${AUGUR:-$TESTDIR/../../../../bin/augur}"
set -o pipefail
1 change: 0 additions & 1 deletion tests/functional/merge/cram/merge.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
SETUP

$ source "$TESTDIR"/_setup.sh
$ set -o pipefail


BASIC USAGE
Expand Down
1 change: 1 addition & 0 deletions tests/functional/parse.t
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ This should use the first field as the id field and the metadata should not have
- strain\tvirus\taccession\tdate\tregion\tcountry\tdivision\tcity\tdb\tsegment\tauthors\turl\ttitle\tjournal\tpaper_url (esc)
---
+ col1\tvirus\tcol3\tdate\tregion\tcountry\tdivision\tcity\tdb\tsegment\tauthors\turl\ttitle\tjournal\tpaper_url (esc)
[1]
$ rm -f "$TMP/sequences.fasta" "$TMP/metadata.tsv"

Parse compressed Zika sequences into sequences and metadata.
Expand Down
1 change: 1 addition & 0 deletions tests/functional/refine/cram/_setup.sh
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export AUGUR="${AUGUR:-$TESTDIR/../../../../bin/augur}"
set -o pipefail
1 change: 1 addition & 0 deletions tests/functional/titers/cram/_setup.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pushd "$TESTDIR" > /dev/null
export AUGUR="${AUGUR:-../../../../bin/augur}"
set -o pipefail
1 change: 1 addition & 0 deletions tests/functional/translate/cram/_setup.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export AUGUR="${AUGUR:-$TESTDIR/../../../../bin/augur}"
export SCRIPTS="$TESTDIR/../../../../scripts"
set -o pipefail
1 change: 1 addition & 0 deletions tests/functional/tree/cram/_setup.sh
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export AUGUR="${AUGUR:-$TESTDIR/../../../../bin/augur}"
set -o pipefail

0 comments on commit 8cac61c

Please sign in to comment.