entrypoint: wrap main code in a function

As preparation for upcoming changes, move the main code of entrypoint.sh
into functions. Best viewed by ignore whitespace.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2020-02-03 13:47:12 -05:00 committed by Niels de Vos
parent 176e6cc198
commit 25bd9f0bed
1 changed files with 47 additions and 40 deletions

View File

@ -51,46 +51,53 @@ while true ; do
esac esac
done done
mkdir -p /tmp/ceph test_go_ceph() {
"${MICRO_OSD_PATH}" /tmp/ceph mkdir -p /tmp/ceph
export CEPH_CONF=/tmp/ceph/ceph.conf "${MICRO_OSD_PATH}" /tmp/ceph
export CEPH_CONF=/tmp/ceph/ceph.conf
if [[ ${TEST_RUN} == NONE ]]; then if [[ ${TEST_RUN} == NONE ]]; then
echo "skipping test execution" echo "skipping test execution"
else else
go get -t -v ./... go get -t -v ./...
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" echo "mode: count" > "cover.out"
P=github.com/ceph/go-ceph P=github.com/ceph/go-ceph
pkgs=(\ pkgs=(\
"cephfs" \ "cephfs" \
"errutil" \ "errutil" \
"rados" \ "rados" \
"rbd" \ "rbd" \
) )
for pkg in "${pkgs[@]}"; do for pkg in "${pkgs[@]}"; do
if [[ "$TEST_PKG" && "$TEST_PKG" != "$pkg" ]]; then if [[ "$TEST_PKG" && "$TEST_PKG" != "$pkg" ]]; then
continue continue
fi fi
testargs=(\ testargs=(\
"-covermode=count" \ "-covermode=count" \
"-coverprofile=$pkg.cover.out" \ "-coverprofile=$pkg.cover.out" \
"-coverpkg=$P/$pkg") "-coverpkg=$P/$pkg")
# disable caching of tests results # disable caching of tests results
testargs+=("-count=1") testargs+=("-count=1")
if [[ ${TEST_RUN} != ALL ]]; then if [[ ${TEST_RUN} != ALL ]]; then
testargs+=("-run" "${TEST_RUN}") testargs+=("-run" "${TEST_RUN}")
fi fi
go test -v "${testargs[@]}" "./$pkg" go test -v "${testargs[@]}" "./$pkg"
grep -v "^mode: count" "$pkg.cover.out" >> "cover.out" grep -v "^mode: count" "$pkg.cover.out" >> "cover.out"
done 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
}
if [[ ${PAUSE} = yes ]]; then pause_if_needed() {
sleep infinity if [[ ${PAUSE} = yes ]]; then
fi sleep infinity
fi
}
test_go_ceph
pause_if_needed