diff options
author | Mike Gerwitz <mike.gerwitz@rtspecialty.com> | 2019-04-09 10:57:59 -0400 |
---|---|---|
committer | Mike Gerwitz <mike.gerwitz@rtspecialty.com> | 2019-04-09 10:57:59 -0400 |
commit | f270220b11ad293ff6793211d1dda769b4a5062d (patch) | |
tree | e4584024f9e8345fac5c92ac74cbfaa68b44a38d /build-aux | |
parent | 4c61dfb1cc85eeaa232ec810b260d3b0169e0829 (diff) | |
download | tame-f270220b11ad293ff6793211d1dda769b4a5062d.tar.gz tame-f270220b11ad293ff6793211d1dda769b4a5062d.tar.bz2 tame-f270220b11ad293ff6793211d1dda769b4a5062d.zip |
build-aux/csvm2csv: Propagate csvm-expand exit status
csvm2csv was not failing when csvm-expand exited with a non-zero
status. Further, the tests were written incorrectly to account for this.
* build-aux/csvm2csv: Set `pipefail' option.
* build-aux/test/test-csvm2csv: Fix tests.
Diffstat (limited to 'build-aux')
-rwxr-xr-x | build-aux/csvm2csv | 2 | ||||
-rwxr-xr-x | build-aux/test/test-csvm2csv | 36 |
2 files changed, 14 insertions, 24 deletions
diff --git a/build-aux/csvm2csv b/build-aux/csvm2csv index 8a58913..c787fb2 100755 --- a/build-aux/csvm2csv +++ b/build-aux/csvm2csv @@ -22,6 +22,8 @@ # header line. ## +set -o pipefail + # account for symlinks, since historically this script lives in a different # directory and has been symlinked for compatibility declare -r mypath=$( dirname "$( readlink -f "$0" )" ) diff --git a/build-aux/test/test-csvm2csv b/build-aux/test/test-csvm2csv index 3e9bded..3d44e88 100755 --- a/build-aux/test/test-csvm2csv +++ b/build-aux/test/test-csvm2csv @@ -258,13 +258,10 @@ header, line' ((testsum++)) - local -r result=$( - ../csvm2csv 2>&1 <<< "$input" \ - && echo '(test failure: expected failure)' - ) + local result + ! result=$( ../csvm2csv 2>&1 <<< "$input" ) || return 1 - grep -q '!DIRECTIVE2' <<< "$result" \ - || return 1 + [[ "$result" =~ !DIRECTIVE2 ]] } @@ -272,13 +269,10 @@ test-fail-unknown-var-ref() { ((testsum++)) - local -r result=$( - ../csvm2csv 2>&1 <<< '$undefined' \ - && echo '(test failure: expected failure)' - ) + local result + ! result=$( ../csvm2csv 2>&1 <<< '$undefined' ) || return 1 - grep -q 'unknown.*\$undefined' <<< "$result" \ - || return 1 + [[ "$result" =~ unknown.*\$undefined ]] } @@ -286,13 +280,10 @@ test-fail-non-numeric-range() { ((testsum++)) - local -r result=$( - ../csvm2csv 2>&1 <<< 'A--Z' \ - && echo '(test failure: expected failure)' - ) + local result + ! result=$( ../csvm2csv 2>&1 <<< 'A--Z' ) || return 1 - grep -q 'invalid range.*A--Z' <<< "$result" \ - || return 1 + [[ "$result" =~ invalid\ range.*A--Z ]] } @@ -300,13 +291,10 @@ test-fail-invalid-var-dfn() { ((testsum++)) - local -r result=$( - ../csvm2csv 2>&1 <<< ':BAD@#=var' \ - && echo '(test failure: expected failure)' - ) + local result + ! result=$( ../csvm2csv 2>&1 <<< ':BAD@#=var' ) || return 1 - grep -q 'invalid variable definition.*:BAD@#=var' <<< "$result" \ - || return 1 + [[ "$result" =~ invalid\ variable\ definition.*:BAD@#=var ]] } |