Skip to content

Commit

Permalink
fix(test): Specify availability of zip/tarball in each version
Browse files Browse the repository at this point in the history
  • Loading branch information
ribose-jeffreylau committed May 14, 2024
1 parent bb5b906 commit 93eb129
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
6 changes: 4 additions & 2 deletions scripts/run_tests
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ test_package_signature() {
local version="${1}"; shift
local fpr="${1:?Missing fingerprint}"
local archive_name="${2}"
local zip_tar="${3}"
run_test \
"Expected signature for version \e[1m${version}\e[22m is signed by '\e[1m${fpr}\e[22m'" \
signature_fingerprint_is "${fpr}" "${version}" "${archive_name}"
signature_fingerprint_is "${fpr}" "${version}" "${archive_name}" "${zip_tar}"
}

warn() {
Expand Down Expand Up @@ -59,7 +60,6 @@ signature_fingerprint_is() {
-r rnpgp/rnp
-v "${version}"
--gpg
--explicit-archive
verify-remote
)

Expand All @@ -79,6 +79,8 @@ signature_fingerprint_is() {
check_gpg_fpr_eq() {
local fpr="${1}"; shift

# Grep using C locale to standardize output
export LANG=C
"$@" 2>&1 >/dev/null | \
command sed '/using.*key/!d; s/^.* //' | \
command uniq | \
Expand Down
26 changes: 25 additions & 1 deletion spec/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ expected-archive-name-for-version() {
0.17.*)
echo "rnp-v${version}"
;;
*)
echo "v${version}"
;;
esac
}

Expand All @@ -49,7 +52,28 @@ expected-signature-for-version() {
esac
}

expected-zip-and-or-tar-for-version() {
local version="${1:?Missing version}"
case "${version}" in
0.9.*|0.1[012345].[012]|0.16.[0123]|0.17.0)
echo "zt"
;;
0.17.1)
echo "t"
;;
*)
warn "Version (${version}) not matched. Checking tarball only."
echo "t"

;;
esac
}

for version in "${all_tags[@]}"
do
test_package_signature "${version}" "$(expected-signature-for-version "${version}")" "$(expected-archive-name-for-version "${version}")"
test_package_signature \
"${version}" \
"$(expected-signature-for-version "${version}")" \
"$(expected-archive-name-for-version "${version}")" \
"$(expected-zip-and-or-tar-for-version "${version}")"
done

0 comments on commit 93eb129

Please sign in to comment.