Dont use gotestsum in hack/test/unit
authorArnaud Rebillout <arnaud.rebillout@collabora.com>
Mon, 16 Sep 2019 06:27:36 +0000 (13:27 +0700)
committerDmitry Smirnov <onlyjob@debian.org>
Tue, 8 Oct 2019 03:37:25 +0000 (04:37 +0100)
gotestsum is not yet in Debian, let's just stick to 'go test' for now.

As soon as gotestsum is packaged for Debian (see #940225), we can drop
this patch, and add gotestsum as a build dependency.

This is a partial revert of the commit:
https://github.com/docker/docker-ce/commit/bef34d1

Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
Origin: vendor, Debian
Forwarded: not-needed, Debian-specific

Gbp-Pq: Name debian-dont-use-gotestsum-in-hack-test-unit.patch

engine/hack/test/unit

index 1aea06c54b55ea48ec4d67ccfbfd2bc4b12a40ff..4d67969277c90759eda4146928ead25efe188ddc 100755 (executable)
 set -eu -o pipefail
 
 BUILDFLAGS=( -tags 'netgo seccomp libdm_no_deferred_remove' )
-TESTFLAGS+="-test.timeout=${TIMEOUT:-5m}"
+TESTFLAGS+=" -test.timeout=${TIMEOUT:-5m}"
 TESTDIRS="${TESTDIRS:-./...}"
 exclude_paths='/vendor/|/integration'
 pkg_list=$(go list $TESTDIRS | grep -vE "($exclude_paths)")
 
-mkdir -p bundles
-gotestsum --format=standard-quiet --jsonfile=bundles/go-test-report.json --junitfile=bundles/junit-report.xml -- \
-       "${BUILDFLAGS[@]}" \
-       -cover \
-       -coverprofile=bundles/profile.out \
-       -covermode=atomic \
-       ${TESTFLAGS} \
-       ${pkg_list}
+for pkg in $pkg_list; do
+    go test "${BUILDFLAGS[@]}" \
+        -cover \
+        -coverprofile=profile.out \
+        -covermode=atomic \
+        ${TESTFLAGS} \
+        "${pkg}"
+
+    if test -f profile.out; then
+        cat profile.out >> coverage.txt
+        rm profile.out
+    fi
+done