diff options
Diffstat (limited to 'extra/xbs-lukeshu/test/test.d/signed-packages.sh')
-rwxr-xr-x | extra/xbs-lukeshu/test/test.d/signed-packages.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/extra/xbs-lukeshu/test/test.d/signed-packages.sh b/extra/xbs-lukeshu/test/test.d/signed-packages.sh new file mode 100755 index 0000000..03566ef --- /dev/null +++ b/extra/xbs-lukeshu/test/test.d/signed-packages.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +curdir=$(readlink -e $(dirname $0)) +. "${curdir}/../lib/common.inc" + +testAddSignedPackage() { + releasePackage extra 'pkg-simple-a' 'i686' + ../db-update || fail "db-update failed!" +} + +testAddUnsignedPackage() { + releasePackage extra 'pkg-simple-a' 'i686' + rm "${STAGING}"/extra/*.sig + ../db-update >/dev/null 2>&1 && fail "db-update should fail when a signature is missing!" +} + +testAddInvalidSignedPackage() { + local p + releasePackage extra 'pkg-simple-a' 'i686' + for p in "${STAGING}"/extra/*${PKGEXT}; do + unxz $p + xz -0 ${p%%.xz} + done + ../db-update >/dev/null 2>&1 && fail "db-update should fail when a signature is invalid!" +} + +testAddBrokenSignature() { + local s + releasePackage extra 'pkg-simple-a' 'i686' + for s in "${STAGING}"/extra/*.sig; do + echo 0 > $s + done + ../db-update >/dev/null 2>&1 && fail "db-update should fail when a signature is broken!" +} + +. "${curdir}/../lib/shunit2" |