Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage: shasum command not supported on CentOS #45429

Merged
merged 1 commit into from
May 6, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions hack/make-rules/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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)"
}

Expand Down Expand Up @@ -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}'"
Expand Down