mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
297b30df5f
These scripts explicitly use Bash, so we should be able to use `[[` instead of `[` (which seems to be recommended). Also added curly brackets to some bare variables, and quoted some paths. This makes my IDE a bit more silent :-) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
34 lines
782 B
Bash
Executable file
34 lines
782 B
Bash
Executable file
#!/usr/bin/env bash
|
|
#
|
|
# Run unit tests
|
|
#
|
|
# TESTFLAGS - add additional test flags. Ex:
|
|
#
|
|
# TESTFLAGS="-v -run TestBuild" hack/test/unit
|
|
#
|
|
# TESTDIRS - run tests for specified packages. Ex:
|
|
#
|
|
# TESTDIRS="./pkg/term" hack/test/unit
|
|
#
|
|
set -eu -o pipefail
|
|
|
|
TESTFLAGS+=" -test.timeout=${TIMEOUT:-5m}"
|
|
BUILDFLAGS=( -tags "netgo seccomp libdm_no_deferred_remove" )
|
|
TESTDIRS="${TESTDIRS:-"./..."}"
|
|
|
|
exclude_paths="/vendor/|/integration"
|
|
pkg_list=$(go list $TESTDIRS | grep -vE "($exclude_paths)")
|
|
|
|
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
|