File: unit

package info (click to toggle)
docker.io 18.09.5+dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 65,324 kB
  • sloc: sh: 9,757; makefile: 833; ansic: 239; python: 162; asm: 10
file content (34 lines) | stat: -rwxr-xr-x 780 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/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