Browse Source

travis/tests: gofmt first, then test with sudo

Stefan Junker 9 years ago
parent
commit
47f488a341
2 changed files with 13 additions and 8 deletions
  1. 5 0
      .travis.yml
  2. 8 8
      test

+ 5 - 0
.travis.yml

@@ -8,6 +8,11 @@ go:
   - 1.6
   - tip
 
+env:
+  global:
+    - TOOLS_CMD=golang.org/x/tools/cmd
+    - PATH=$GOROOT/bin:$PATH
+
 matrix:
   allow_failures:
     - go: tip

+ 8 - 8
test

@@ -32,14 +32,6 @@ else
 	FMT="$TEST"
 fi
 
-# split TEST into an array and prepend REPO_PATH to each local package
-split=(${TEST// / })
-TEST=${split[@]/#/${REPO_PATH}/}
-
-echo "Running tests..."
-go test -i ${TEST}
-go test ${COVER} $@ ${TEST}
-
 echo "Checking gofmt..."
 fmtRes=$(gofmt -l $FMT)
 if [ -n "${fmtRes}" ]; then
@@ -47,4 +39,12 @@ if [ -n "${fmtRes}" ]; then
 	exit 255
 fi
 
+# split TEST into an array and prepend REPO_PATH to each local package
+split=(${TEST// / })
+TEST=${split[@]/#/${REPO_PATH}/}
+
+echo "Running tests..."
+go test -i ${TEST}
+sudo -E bash -c "umask 0; PATH=\$GOROOT/bin:\$PATH go test ${COVER} $@ ${TEST}"
+
 echo "Success"