Coverage: shasum command not supported on CentOS
Centos has sha1sum, instead of "shasum -a1". Modified script to check for existence fo shasum, and if not present, use sha1sum for coverage test processing. If neither are available, an error will be reported and processing stopped.
This commit is contained in:
parent
20457ee68d
commit
5bcd21c9f1
@ -27,6 +27,16 @@ kube::golang::setup_env
|
||||
KUBE_CACHE_MUTATION_DETECTOR="${KUBE_CACHE_MUTATION_DETECTOR:-true}"
|
||||
export KUBE_CACHE_MUTATION_DETECTOR
|
||||
|
||||
# Handle case where OS has sha#sum commands, instead of shasum.
|
||||
if which shasum >/dev/null 2>&1; then
|
||||
SHA1SUM="shasum -a1"
|
||||
elif which sha1sum >/dev/null 2>&1; then
|
||||
SHA1SUM="sha1sum"
|
||||
else
|
||||
echo "Failed to find shasum or sha1sum utility." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
kube::test::find_dirs() {
|
||||
(
|
||||
cd ${KUBE_ROOT}
|
||||
@ -189,7 +199,7 @@ junitFilenamePrefix() {
|
||||
# barely fits there and in coverage mode test names are
|
||||
# appended to generated file names, easily exceeding
|
||||
# 255 chars in length. So let's just use a sha1 hash of it.
|
||||
local KUBE_TEST_API_HASH="$(echo -n "${KUBE_TEST_API//\//-}"|shasum -a 1|awk '{print $1}')"
|
||||
local KUBE_TEST_API_HASH="$(echo -n "${KUBE_TEST_API//\//-}"| ${SHA1SUM} |awk '{print $1}')"
|
||||
echo "${KUBE_JUNIT_REPORT_DIR}/junit_${KUBE_TEST_API_HASH}_$(kube::util::sortable_date)"
|
||||
}
|
||||
|
||||
@ -239,7 +249,7 @@ runTests() {
|
||||
fi
|
||||
|
||||
# Create coverage report directories.
|
||||
KUBE_TEST_API_HASH="$(echo -n "${KUBE_TEST_API//\//-}"|shasum -a 1|awk '{print $1}')"
|
||||
KUBE_TEST_API_HASH="$(echo -n "${KUBE_TEST_API//\//-}"| ${SHA1SUM} |awk '{print $1}')"
|
||||
cover_report_dir="/tmp/k8s_coverage/${KUBE_TEST_API_HASH}/$(kube::util::sortable_date)"
|
||||
cover_profile="coverage.out" # Name for each individual coverage profile
|
||||
kube::log::status "Saving coverage output in '${cover_report_dir}'"
|
||||
|
Loading…
Reference in New Issue
Block a user