Browse code

hack/test/unit: fix custom TESTFLAGS not working

The `-test.timeout=5m` was glued directly after the current `TESTFLAGS`,
causing them to be non-functional;

Before:

make TESTDEBUG=1 TESTDIRS='github.com/docker/docker/pkg/filenotify' TESTFLAGS='-test.run TestPollerEvent' test-unit
+ mkdir -p bundles
+ gotestsum --format=standard-quiet --jsonfile=bundles/go-test-report.json --junitfile=bundles/junit-report.xml -- -tags 'netgo seccomp libdm_no_deferred_remove' -cover -coverprofile=bundles/profile.out -covermode=atomic -test.run TestPollerEvent-test.timeout=5m github.com/docker/docker/pkg/filenotify
testing: warning: no tests to run
ok github.com/docker/docker/pkg/filenotify 0.003s coverage: 0.0% of statements [no tests to run]

DONE 0 tests in 0.298s

After:

make TESTDEBUG=1 TESTDIRS='github.com/docker/docker/pkg/filenotify' TESTFLAGS='-test.run TestPollerEvent' test-unit
+ mkdir -p bundles
+ gotestsum --format=standard-quiet --jsonfile=bundles/go-test-report.json --junitfile=bundles/junit-report.xml -- -tags 'netgo seccomp libdm_no_deferred_remove' -cover -coverprofile=bundles/profile.out -covermode=atomic -test.run TestPollerEvent -test.timeout=5m github.com/docker/docker/pkg/filenotify
ok github.com/docker/docker/pkg/filenotify 0.608s coverage: 44.7% of statements

DONE 1 tests in 0.922s

This was introduced in 42f0a0db75a921145c7f519f7b550e1392890da2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 0620990307aaf8ada706ffb6c5dc0628c92d84af)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2019/09/13 23:01:54
Showing 1 changed files
... ...
@@ -13,7 +13,7 @@
13 13
 set -eu -o pipefail
14 14
 
15 15
 BUILDFLAGS=( -tags 'netgo seccomp libdm_no_deferred_remove' )
16
-TESTFLAGS+="-test.timeout=${TIMEOUT:-5m}"
16
+TESTFLAGS+=" -test.timeout=${TIMEOUT:-5m}"
17 17
 TESTDIRS="${TESTDIRS:-./...}"
18 18
 exclude_paths='/vendor/|/integration'
19 19
 pkg_list=$(go list $TESTDIRS | grep -vE "($exclude_paths)")