forked from ceph/go-ceph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·79 lines (71 loc) · 1.82 KB
/
entrypoint.sh
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
set -e
TEST_RUN=ALL
PAUSE=no
MICRO_OSD_PATH="/micro-osd.sh"
CLI="$(getopt -o h --long test-run:,pause,micro-osd:,help -n "$0" -- "$@")"
eval set -- "${CLI}"
while true ; do
case "$1" in
--test-run)
TEST_RUN="$2"
shift
shift
;;
--pause)
PAUSE=yes
shift
;;
--micro-osd)
MICRO_OSD_PATH="$2"
shift
shift
;;
-h|--help)
echo "Options:"
echo " --test-run=VALUE Run selected test or ALL, NONE"
echo " ALL is the default"
echo " --pause Sleep forever after tests execute"
echo " --micro-osd Specify path to micro-osd script"
echo " -h|--help Display help text"
echo ""
exit 0
;;
--)
shift
break
;;
*)
echo "unknown option" >&2
exit 2
;;
esac
done
mkdir -p /tmp/ceph
"${MICRO_OSD_PATH}" /tmp/ceph
export CEPH_CONF=/tmp/ceph/ceph.conf
export PATH=/usr/lib/go-1.10/bin:$PATH
if [[ ${TEST_RUN} == NONE ]]; then
echo "skipping test execution"
else
go get -t -v ./...
diff -u <(echo -n) <(gofmt -d -s .)
#go vet ./...
#go list ./...
P=github.com/ceph/go-ceph
testargs=(\
"-covermode=count" \
"-coverprofile=cover.out" \
"-coverpkg=$P/cephfs,$P/rados,$P/rbd")
# disable caching of tests results
testargs+=("-count=1")
if [[ ${TEST_RUN} != ALL ]]; then
testargs+=("-run" "${TEST_RUN}")
fi
go test -v "${testargs[@]}" ./...
mkdir -p /results/coverage
go tool cover -html=cover.out -o /results/coverage/go-ceph.html
fi
if [[ ${PAUSE} = yes ]]; then
sleep infinity
fi