summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-05-01 17:14:16 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2017-05-01 17:24:16 -0400
commit8ab3d92ccf278389721b1ae8ff42dffef0e066ab (patch)
treebd7b07c405e6f43ef8a886f516b4616653d6644c /test
parentcd795c1446b705b2e14cf70655e859571d4f8755 (diff)
bugfix [1/2]: librefetch: Add check for SRCBUILD-to-SRCBUILD operation
Diffstat (limited to 'test')
-rw-r--r--test/librefetch-test.sh33
-rw-r--r--test/librefetch.d/PKGBUILD-mksource (renamed from test/librefetch.d/PKGBUILD)0
-rw-r--r--test/librefetch.d/PKGBUILD-srcbuild10
-rw-r--r--test/librefetch.d/SRCBUILD-srcbuild21
4 files changed, 63 insertions, 1 deletions
diff --git a/test/librefetch-test.sh b/test/librefetch-test.sh
index 6871be1..b4be051 100644
--- a/test/librefetch-test.sh
+++ b/test/librefetch-test.sh
@@ -51,10 +51,41 @@ it_displays_help() {
# This test used to be called "it_cleans_src_libre_first", but let's
# be honest: it checks pretty much everything related to normal
# operation.
-it_runs() {
+it_runs_with_mksource() {
local srcball=testpkg-1.0.tar.gz
cp librefetch.d/* "$tmpdir/"
cd "$tmpdir"
+ mv PKGBUILD{-mksource,}
+
+ # Create garbage, to verifiy that it cleans src-libre first
+ mkdir -p src-libre/foo
+ touch src-libre/foo/file
+
+ # Run librefetch
+ makepkg -g
+
+ # Verify that no temporary files were left around
+ not test -e librefetch.*
+
+ # Verify:
+ # - The srcball was created...
+ # - ... and is in the correct directory
+ # - The srcball does not contain the garbage created earlier
+ # - The files in the srcball are in the correct order (if the
+ # order isn't ensured, then this would only sometimes fail,
+ # 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_runs_with_srcbuild() {
+ local srcball=testpkg-1.0.tar.gz
+ cp librefetch.d/* "$tmpdir/"
+ cd "$tmpdir"
+ mv PKGBUILD{-srcbuild,}
+ mv SRCBUILD{-srcbuild,}
# Create garbage, to verifiy that it cleans src-libre first
mkdir -p src-libre/foo
diff --git a/test/librefetch.d/PKGBUILD b/test/librefetch.d/PKGBUILD-mksource
index 6547e25..6547e25 100644
--- a/test/librefetch.d/PKGBUILD
+++ b/test/librefetch.d/PKGBUILD-mksource
diff --git a/test/librefetch.d/PKGBUILD-srcbuild b/test/librefetch.d/PKGBUILD-srcbuild
new file mode 100644
index 0000000..40c5c79
--- /dev/null
+++ b/test/librefetch.d/PKGBUILD-srcbuild
@@ -0,0 +1,10 @@
+pkgname=testpkg
+pkgver=1.0
+pkgrel=1
+pkgdesc=foo
+arch=(any)
+source=("libre://$pkgname-$pkgver.tar.gz"{,.sig})
+
+package() {
+ :;
+}
diff --git a/test/librefetch.d/SRCBUILD-srcbuild b/test/librefetch.d/SRCBUILD-srcbuild
new file mode 100644
index 0000000..6f172c5
--- /dev/null
+++ b/test/librefetch.d/SRCBUILD-srcbuild
@@ -0,0 +1,21 @@
+pkgname=testpkg
+pkgver=1.0
+pkgrel=1
+pkgdesc=foo
+arch=(any)
+source=()
+
+PKGDEST=$SRCDEST
+PKGEXT=$SRCEXT
+
+build() {
+ mkdir "$srcdir/bar"
+ local file
+ for file in '~foo' '~a' a A; do
+ touch "$srcdir/bar/$file"
+ done
+}
+
+package() {
+ cp -a -t "$pkgdir" "$srcdir"/*
+}