Retrieve the exit code from the test suites
This commit is contained in:
@@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
# Run basic go unit tests
|
# Run basic go unit tests
|
||||||
go test -v ./...
|
go test -v ./...
|
||||||
|
result=$?
|
||||||
|
|
||||||
# Run example-based toml tests
|
# Run example-based toml tests
|
||||||
cd test_program && ./go-test.sh
|
cd test_program && ./go-test.sh
|
||||||
|
result="$(( result || $? ))"
|
||||||
|
|
||||||
|
exit $result
|
||||||
|
|||||||
@@ -5,16 +5,22 @@ go get github.com/BurntSushi/toml/toml-test-go # install my parser
|
|||||||
go build -o test_program_bin github.com/pelletier/go-toml/test_program
|
go build -o test_program_bin github.com/pelletier/go-toml/test_program
|
||||||
|
|
||||||
toml_test_wrapper() {
|
toml_test_wrapper() {
|
||||||
|
ret=0
|
||||||
if hash toml-test 2>/dev/null; then # test availability in $PATH
|
if hash toml-test 2>/dev/null; then # test availability in $PATH
|
||||||
toml-test "$@"
|
toml-test "$@"
|
||||||
|
ret=$?
|
||||||
else
|
else
|
||||||
p="$HOME/gopath/bin/toml-test" # try in Travi's place
|
p="$HOME/gopath/bin/toml-test" # try in Travi's place
|
||||||
if [ -f "$p" ]; then
|
if [ -f "$p" ]; then
|
||||||
"$p" "$@"
|
"$p" "$@"
|
||||||
|
ret=$?
|
||||||
else
|
else
|
||||||
"$GOPATH/bin/toml-test" "$@"
|
"$GOPATH/bin/toml-test" "$@"
|
||||||
|
ret=$?
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
toml_test_wrapper ./test_program_bin # run tests on my parser
|
toml_test_wrapper ./test_program_bin | tee test_out
|
||||||
|
ret="$([ `tail -n 1 test_out | sed -E 's/^.+([0-9]+) failed$/\1/'` -eq 0 ])"
|
||||||
|
exit $ret
|
||||||
|
|||||||
Reference in New Issue
Block a user