Retrieve the exit code from the test suites
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
|
||||
# Run basic go unit tests
|
||||
go test -v ./...
|
||||
result=$?
|
||||
|
||||
# Run example-based toml tests
|
||||
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
|
||||
|
||||
toml_test_wrapper() {
|
||||
ret=0
|
||||
if hash toml-test 2>/dev/null; then # test availability in $PATH
|
||||
toml-test "$@"
|
||||
ret=$?
|
||||
else
|
||||
p="$HOME/gopath/bin/toml-test" # try in Travi's place
|
||||
if [ -f "$p" ]; then
|
||||
"$p" "$@"
|
||||
ret=$?
|
||||
else
|
||||
"$GOPATH/bin/toml-test" "$@"
|
||||
ret=$?
|
||||
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