mirror of https://github.com/ceph/go-ceph
entrypoint: handle the sub-packages separately
Run the tests for each sub-package as a separate invocation. Make the package selectable. This has a few small advantages: * When iterating on a single package the other packages do not run * Better coverage summary line printed after each test * Slightly better output with verbose test output Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
b177121473
commit
280b9b01d4
|
@ -1,2 +1,3 @@
|
||||||
.build-docker
|
.build-docker
|
||||||
*.swp
|
*.swp
|
||||||
|
*.out
|
||||||
|
|
|
@ -6,10 +6,15 @@ TEST_RUN=ALL
|
||||||
PAUSE=no
|
PAUSE=no
|
||||||
MICRO_OSD_PATH="/micro-osd.sh"
|
MICRO_OSD_PATH="/micro-osd.sh"
|
||||||
|
|
||||||
CLI="$(getopt -o h --long test-run:,pause,micro-osd:,help -n "$0" -- "$@")"
|
CLI="$(getopt -o h --long test-run:,test-pkg:,pause,micro-osd:,help -n "$0" -- "$@")"
|
||||||
eval set -- "${CLI}"
|
eval set -- "${CLI}"
|
||||||
while true ; do
|
while true ; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
--test-pkg)
|
||||||
|
TEST_PKG="$2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
--test-run)
|
--test-run)
|
||||||
TEST_RUN="$2"
|
TEST_RUN="$2"
|
||||||
shift
|
shift
|
||||||
|
@ -28,6 +33,7 @@ while true ; do
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " --test-run=VALUE Run selected test or ALL, NONE"
|
echo " --test-run=VALUE Run selected test or ALL, NONE"
|
||||||
echo " ALL is the default"
|
echo " ALL is the default"
|
||||||
|
echo " --test-pkg=PKG Run only tests from PKG"
|
||||||
echo " --pause Sleep forever after tests execute"
|
echo " --pause Sleep forever after tests execute"
|
||||||
echo " --micro-osd Specify path to micro-osd script"
|
echo " --micro-osd Specify path to micro-osd script"
|
||||||
echo " -h|--help Display help text"
|
echo " -h|--help Display help text"
|
||||||
|
@ -58,18 +64,31 @@ else
|
||||||
diff -u <(echo -n) <(gofmt -d -s .)
|
diff -u <(echo -n) <(gofmt -d -s .)
|
||||||
#go vet ./...
|
#go vet ./...
|
||||||
#go list ./...
|
#go list ./...
|
||||||
|
echo "mode: count" > "cover.out"
|
||||||
P=github.com/ceph/go-ceph
|
P=github.com/ceph/go-ceph
|
||||||
testargs=(\
|
pkgs=(\
|
||||||
"-covermode=count" \
|
"cephfs" \
|
||||||
"-coverprofile=cover.out" \
|
"errutil" \
|
||||||
"-coverpkg=$P/cephfs,$P/rados,$P/rbd,$P/errutil")
|
"rados" \
|
||||||
# disable caching of tests results
|
"rbd" \
|
||||||
testargs+=("-count=1")
|
)
|
||||||
if [[ ${TEST_RUN} != ALL ]]; then
|
for pkg in "${pkgs[@]}"; do
|
||||||
testargs+=("-run" "${TEST_RUN}")
|
if [[ "$TEST_PKG" && "$TEST_PKG" != "$pkg" ]]; then
|
||||||
fi
|
continue
|
||||||
|
fi
|
||||||
|
testargs=(\
|
||||||
|
"-covermode=count" \
|
||||||
|
"-coverprofile=$pkg.cover.out" \
|
||||||
|
"-coverpkg=$P/$pkg")
|
||||||
|
# disable caching of tests results
|
||||||
|
testargs+=("-count=1")
|
||||||
|
if [[ ${TEST_RUN} != ALL ]]; then
|
||||||
|
testargs+=("-run" "${TEST_RUN}")
|
||||||
|
fi
|
||||||
|
|
||||||
go test -v "${testargs[@]}" ./...
|
go test -v "${testargs[@]}" "./$pkg"
|
||||||
|
grep -v "^mode: count" "$pkg.cover.out" >> "cover.out"
|
||||||
|
done
|
||||||
mkdir -p /results/coverage
|
mkdir -p /results/coverage
|
||||||
go tool cover -html=cover.out -o /results/coverage/go-ceph.html
|
go tool cover -html=cover.out -o /results/coverage/go-ceph.html
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue