summaryrefslogtreecommitdiffstats
path: root/test/test.d/signed-packages.sh
blob: 03566eff6a107242ba044e22073386354a535076 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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"