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.master
parent
4c61dfb1cc
commit
f270220b11
|
@ -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" )" )
|
||||
|
|
|
@ -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 ]]
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue