entrypoint: get api implementation coverage when possible

When castxml is available, run the implements tool to generate
text and json implements output that can be later examined to
see what go-ceph does and does not cover in the ceph apis.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2020-05-20 13:16:58 -04:00 committed by John Mulligan
parent a4785fceb6
commit 792f8cf02b

View File

@ -149,6 +149,7 @@ pre_all_tests() {
# Prepare Go code
go get -t -v ${BUILD_TAGS} ./...
diff -u <(echo -n) <(gofmt -d -s .)
make implements
# Reset whole-module coverage file
echo "mode: count" > "cover.out"
@ -159,6 +160,15 @@ post_all_tests() {
mkdir -p "${RESULTS_DIR}/coverage"
show go tool cover -html=cover.out -o "${RESULTS_DIR}/coverage/go-ceph.html"
fi
if [[ ${COVERAGE} = yes ]] && command -v castxml ; then
mkdir -p "${RESULTS_DIR}/coverage"
show ./implements --list \
--report-json "${RESULTS_DIR}/implements.json" \
--report-text "${RESULTS_DIR}/implements.txt" \
cephfs rados rbd
# output the brief summary info onto stdout
grep '^[A-Z]' "${RESULTS_DIR}/implements.txt"
fi
}
test_go_ceph() {