summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/librefetch-test.sh28
-rw-r--r--test/librefetch.d/PKGBUILD2
-rw-r--r--test/librefetch.d/PKGBUILD-recurse18
3 files changed, 47 insertions, 1 deletions
diff --git a/test/librefetch-test.sh b/test/librefetch-test.sh
index 8dd957a..f10ee7f 100644
--- a/test/librefetch-test.sh
+++ b/test/librefetch-test.sh
@@ -4,6 +4,9 @@ describe librefetch
. ./test-common.sh
+KEYSERVER=hkp://pool.sks-keyservers.net
+GPG="gpg --quiet --batch --no-tty --no-permission-warning --keyserver ${KEYSERVER}"
+
before() {
_before
@@ -28,6 +31,17 @@ EOF
'MIRRORS=("phony://example.com/dir/")' \
'DOWNLOADER=/usr/bin/false' \
> "$XDG_CONFIG_HOME/libretools/librefetch.conf"
+
+ printf '%s\n' \
+ 'Key-Type: RSA' \
+ 'Key-Length: 1024' \
+ 'Key-Usage: sign' \
+ 'Name-Real: Temporary LibreTools testsuite key' \
+ 'Name-Email: libretools-test@localhost' \
+ 'Expire-Date: 0' \
+ '%no-protection' \
+ '%commit' \
+ | $GPG --gen-key 2>/dev/null
}
after() {
@@ -68,4 +82,18 @@ it_runs() {
# unfortunately).
bsdtar tf "$tmpdir/srcdest/$srcball" > list-pkg.txt
diff -u list.txt list-pkg.txt
+ # Verify that the signature was created and matches
+ gpg --quiet --verify "$tmpdir/srcdest/$srcball"{.sig,} 2>/dev/null
+}
+
+it_recurses() {
+ local srcball=testpkg-1.0.tar.gz
+ cp librefetch.d/* "$tmpdir/"
+ cd "$tmpdir"
+ mv PKGBUILD{-recurse,}
+
+ makepkg -g
+ bsdtar tf "$tmpdir/srcdest/$srcball" > list-pkg.txt
+ diff -u list.txt list-pkg.txt
+ gpg --quiet --verify "$tmpdir/srcdest/$srcball"{.sig,} 2>/dev/null
}
diff --git a/test/librefetch.d/PKGBUILD b/test/librefetch.d/PKGBUILD
index db80db3..6547e25 100644
--- a/test/librefetch.d/PKGBUILD
+++ b/test/librefetch.d/PKGBUILD
@@ -3,7 +3,7 @@ pkgver=1.0
pkgrel=1
pkgdesc=foo
arch=(any)
-source=("libre://$pkgname-$pkgver.tar.gz")
+source=("libre://$pkgname-$pkgver.tar.gz"{,.sig})
mksource() {
mkdir "$srcdir/bar"
diff --git a/test/librefetch.d/PKGBUILD-recurse b/test/librefetch.d/PKGBUILD-recurse
new file mode 100644
index 0000000..fad5976
--- /dev/null
+++ b/test/librefetch.d/PKGBUILD-recurse
@@ -0,0 +1,18 @@
+pkgname=testpkg
+pkgver=1.0
+pkgrel=1
+pkgdesc=foo
+arch=(any)
+source=("libre://$pkgname-$pkgver.tar.gz.sig")
+
+mksource() {
+ mkdir "$srcdir/bar"
+ local file
+ for file in '~foo' '~a' a A; do
+ touch "$srcdir/bar/$file"
+ done
+}
+
+package() {
+ :;
+}