Skip to content

Instantly share code, notes, and snippets.

@rickb777
Created July 8, 2015 19:24
Show Gist options
  • Save rickb777/717239d1699e69b0724f to your computer and use it in GitHub Desktop.
Save rickb777/717239d1699e69b0724f to your computer and use it in GitHub Desktop.
go-gorp test_all.sh is buggy and inflexible #274
diff --git a/test_all.sh b/test_all.sh
index 20cf15a..0a6dc99 100755
--- a/test_all.sh
+++ b/test_all.sh
@@ -1,12 +1,10 @@
-#!/bin/bash
+#!/bin/bash -e
# on macs, you may need to:
# export GOBUILDFLAG=-ldflags -linkmode=external
coveralls_testflags="-v -covermode=count -coverprofile=coverage.out"
-set -e
-
echo "Testing against mysql"
export GORP_TEST_DSN=gorptest/gorptest/gorptest
export GORP_TEST_DIALECT=mysql
@@ -26,8 +24,15 @@ echo "Testing against sqlite"
export GORP_TEST_DSN=/tmp/gorptest.bin
export GORP_TEST_DIALECT=sqlite
go test $coveralls_testflags $GOBUILDFLAG $@ .
-
-if [[ `go version` == *"1.4"* ]]
-then
- $HOME/gopath/bin/goveralls -covermode=count -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN
-fi
+rm -f /tmp/gorptest.bin
+
+case $(go version) in
+ *go1.4*)
+ if [ "$(type -p goveralls)" != "" ]; then
+ goveralls -covermode=count -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN
+ elif [ -x $HOME/gopath/bin/goveralls ]; then
+ $HOME/gopath/bin/goveralls -covermode=count -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN
+ fi
+ ;;
+ *) ;;
+esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment