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.
|
# header line.
|
||||||
##
|
##
|
||||||
|
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
# account for symlinks, since historically this script lives in a different
|
# account for symlinks, since historically this script lives in a different
|
||||||
# directory and has been symlinked for compatibility
|
# directory and has been symlinked for compatibility
|
||||||
declare -r mypath=$( dirname "$( readlink -f "$0" )" )
|
declare -r mypath=$( dirname "$( readlink -f "$0" )" )
|
||||||
|
|
|
@ -258,13 +258,10 @@ header, line'
|
||||||
|
|
||||||
((testsum++))
|
((testsum++))
|
||||||
|
|
||||||
local -r result=$(
|
local result
|
||||||
../csvm2csv 2>&1 <<< "$input" \
|
! result=$( ../csvm2csv 2>&1 <<< "$input" ) || return 1
|
||||||
&& echo '(test failure: expected failure)'
|
|
||||||
)
|
|
||||||
|
|
||||||
grep -q '!DIRECTIVE2' <<< "$result" \
|
[[ "$result" =~ !DIRECTIVE2 ]]
|
||||||
|| return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -272,13 +269,10 @@ test-fail-unknown-var-ref()
|
||||||
{
|
{
|
||||||
((testsum++))
|
((testsum++))
|
||||||
|
|
||||||
local -r result=$(
|
local result
|
||||||
../csvm2csv 2>&1 <<< '$undefined' \
|
! result=$( ../csvm2csv 2>&1 <<< '$undefined' ) || return 1
|
||||||
&& echo '(test failure: expected failure)'
|
|
||||||
)
|
|
||||||
|
|
||||||
grep -q 'unknown.*\$undefined' <<< "$result" \
|
[[ "$result" =~ unknown.*\$undefined ]]
|
||||||
|| return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -286,13 +280,10 @@ test-fail-non-numeric-range()
|
||||||
{
|
{
|
||||||
((testsum++))
|
((testsum++))
|
||||||
|
|
||||||
local -r result=$(
|
local result
|
||||||
../csvm2csv 2>&1 <<< 'A--Z' \
|
! result=$( ../csvm2csv 2>&1 <<< 'A--Z' ) || return 1
|
||||||
&& echo '(test failure: expected failure)'
|
|
||||||
)
|
|
||||||
|
|
||||||
grep -q 'invalid range.*A--Z' <<< "$result" \
|
[[ "$result" =~ invalid\ range.*A--Z ]]
|
||||||
|| return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -300,13 +291,10 @@ test-fail-invalid-var-dfn()
|
||||||
{
|
{
|
||||||
((testsum++))
|
((testsum++))
|
||||||
|
|
||||||
local -r result=$(
|
local result
|
||||||
../csvm2csv 2>&1 <<< ':BAD@#=var' \
|
! result=$( ../csvm2csv 2>&1 <<< ':BAD@#=var' ) || return 1
|
||||||
&& echo '(test failure: expected failure)'
|
|
||||||
)
|
|
||||||
|
|
||||||
grep -q 'invalid variable definition.*:BAD@#=var' <<< "$result" \
|
[[ "$result" =~ invalid\ variable\ definition.*:BAD@#=var ]]
|
||||||
|| return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue