summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@parabola.nu>2024-02-20 13:57:16 -0700
committerLuke T. Shumaker <lukeshu@parabola.nu>2024-02-20 22:09:26 -0700
commitb4e4d4a9423fed78c97ed7f36da3f1f61d64f836 (patch)
treebd11a5733563ce287f12c0ab55bc100fa014d514
parent1a4a9191147dc613a907851c27c2611c478eb10c (diff)
fix: test: allow arbitrary compressed package files
This mimics d6866e0 (lib: support arbitrary compressed package files, 2019-12-04, Levente Polyak <anthraxx@archlinux.org>) from devtools.git
-rw-r--r--test/cases/libremakepkg.bats60
-rw-r--r--test/cases/librestage.bats10
2 files changed, 37 insertions, 33 deletions
diff --git a/test/cases/libremakepkg.bats b/test/cases/libremakepkg.bats
index 2184de2..fa8aee3 100644
--- a/test/cases/libremakepkg.bats
+++ b/test/cases/libremakepkg.bats
@@ -1,5 +1,7 @@
load ../lib/common
+shopt -s extglob
+
setup() {
common_setup
@@ -25,7 +27,7 @@ teardown() {
testsudo libremakepkg -l "$BATS_TEST_NAME"
- globfile libretools-hello-1.0-1-any.pkg.tar.?z
+ globfile libretools-hello-1.0-1-any.pkg.tar?(.!(sig|*.*))
}
@test "libremakepkg disables networking during prepare" {
@@ -34,9 +36,9 @@ teardown() {
cd "$tmpdir"
not testsudo libremakepkg -l "$BATS_TEST_NAME"
- not globfile libretools-netprepare-1.0-1-any.pkg.tar.?z
+ not globfile libretools-netprepare-1.0-1-any.pkg.tar?(.!(sig|*.*))
testsudo libremakepkg -l "$BATS_TEST_NAME" -N
- globfile libretools-netprepare-1.0-1-any.pkg.tar.?z
+ globfile libretools-netprepare-1.0-1-any.pkg.tar?(.!(sig|*.*))
}
@test "libremakepkg disables networking during build" {
@@ -45,9 +47,9 @@ teardown() {
cd "$tmpdir"
not testsudo libremakepkg -l "$BATS_TEST_NAME"
- not globfile libretools-netbuild-1.0-1-any.pkg.tar.?z
+ not globfile libretools-netbuild-1.0-1-any.pkg.tar?(.!(sig|*.*))
testsudo libremakepkg -l "$BATS_TEST_NAME" -N
- globfile libretools-netbuild-1.0-1-any.pkg.tar.?z
+ globfile libretools-netbuild-1.0-1-any.pkg.tar?(.!(sig|*.*))
}
@test "libremakepkg disables networking during package" {
@@ -56,9 +58,9 @@ teardown() {
cd "$tmpdir"
not testsudo libremakepkg -l "$BATS_TEST_NAME"
- not globfile libretools-netpackage-1.0-1-any.pkg.tar.?z
+ not globfile libretools-netpackage-1.0-1-any.pkg.tar?(.!(sig|*.*))
testsudo libremakepkg -l "$BATS_TEST_NAME" -N
- globfile libretools-netpackage-1.0-1-any.pkg.tar.?z
+ globfile libretools-netpackage-1.0-1-any.pkg.tar?(.!(sig|*.*))
}
@test "libremakepkg cleans the chroot before building" {
@@ -88,7 +90,7 @@ teardown() {
# This next line is actually a separate test, but it fits in well with this test, and chroot tests are slow.
# @test "libremakepkg doesnt cache local packages" {
- not testsudo librechroot -l "$BATS_TEST_NAME" run test -e /var/cache/pacman/pkg/libretools-testpkg1-1.0-1-any.pkg.tar.?z
+ not testsudo librechroot -l "$BATS_TEST_NAME" run bash -O extglob -c 'test -e /var/cache/pacman/pkg/libretools-testpkg1-1.0-1-any.pkg.tar?(.!(sig|*.*))'
cd "$tmpdir/3"
testsudo libremakepkg -l "$BATS_TEST_NAME" &> "$tmpdir/out" || { status=$?; tail "$tmpdir/out"|cat -v; return $status; }
@@ -102,7 +104,7 @@ teardown() {
testsudo env PKGDEST="$tmpdir/dest/pkgdest" libremakepkg -l "$BATS_TEST_NAME"
- globfile dest/pkgdest/libretools-hello-1.0-1-any.pkg.tar.?z
+ globfile dest/pkgdest/libretools-hello-1.0-1-any.pkg.tar?(.!(sig|*.*))
}
@test "libremakepkg displays help as normal user" {
@@ -152,14 +154,14 @@ teardown() {
# first make sure that the engine works
testsudo libremakepkg -l "$BATS_TEST_NAME"
- globfile libretools-hello-1.0-1-any.pkg.tar.?z
- rm -f -- libretools-hello-1.0-1-any.pkg.tar.?z
+ globfile libretools-hello-1.0-1-any.pkg.tar?(.!(sig|*.*))
+ rm -f -- libretools-hello-1.0-1-any.pkg.tar?(.!(sig|*.*))
# now throw a wrench in it
testsudo librechroot -l "$BATS_TEST_NAME" run touch /bin/distcc-tool
# and make sure that the engine broke
testsudo libremakepkg -l "$BATS_TEST_NAME" || status=$?
[[ $status != 0 ]]
- not globfile libretools-hello-1.0-1-any.pkg.tar.?z
+ not globfile libretools-hello-1.0-1-any.pkg.tar?(.!(sig|*.*))
}
@test "libremakepkg forwards distcc ports" {
@@ -185,7 +187,7 @@ teardown() {
cd "$tmpdir"
testsudo librechroot -l "$chrootname" install-name distcc-nozeroconf socat
testsudo libremakepkg -l "$chrootname"
- globfile libretools-distcc-1.0-1-any.pkg.tar.?z
+ globfile libretools-distcc-1.0-1-any.pkg.tar?(.!(sig|*.*))
}
@test "libremakepkg doesnt symlink outputs" {
@@ -198,10 +200,10 @@ teardown() {
testsudo libremakepkg -l "$BATS_TEST_NAME"
- not stat libretools-hello-1.0-1-any.pkg.tar.?z
- not stat libretools-hello-1.0-1-any.src.tar.?z
- globfile "$tmpdir/workdir/pkgdest"/libretools-hello-1.0-1-any.pkg.tar.?z
- globfile "$tmpdir/workdir/srcpkgdest"/libretools-hello-1.0-1-any.src.tar.?z
+ not stat libretools-hello-1.0-1-any.pkg.tar?(.!(sig|*.*))
+ not stat libretools-hello-1.0-1-any.src.tar?(.!(sig|*.*))
+ globfile "$tmpdir/workdir/pkgdest"/libretools-hello-1.0-1-any.pkg.tar?(.!(sig|*.*))
+ globfile "$tmpdir/workdir/srcpkgdest"/libretools-hello-1.0-1-any.src.tar?(.!(sig|*.*))
}
@test "libremakepkg succeeds with good signatures" {
@@ -236,8 +238,8 @@ teardown() {
testsudo libremakepkg -l "$BATS_TEST_NAME"
- globfile libretools-pkgver-1-1-any.pkg.tar.?z
- not globfile libretools-pkgver-2-1-any.pkg.tar.?z
+ globfile libretools-pkgver-1-1-any.pkg.tar?(.!(sig|*.*))
+ not globfile libretools-pkgver-2-1-any.pkg.tar?(.!(sig|*.*))
popd
diff -u fixtures/libremakepkg/PKGBUILD-pkgver "$tmpdir/PKGBUILD"
}
@@ -253,16 +255,16 @@ teardown() {
# timestamps.
testsudo libremakepkg -l "$BATS_TEST_NAME"
- globfile libretools-hello-1.0-1-any.src.tar.?z
- globfile libretools-hello-1.0-1-any.pkg.tar.?z
- a_stime=$(stat -c %Y -- libretools-hello-1.0-1-any.src.tar.?z)
- a_ptime=$(stat -c %Y -- libretools-hello-1.0-1-any.pkg.tar.?z)
-
- testsudo libremakepkg -l "$BATS_TEST_NAME" -S libretools-hello-1.0-1-any.src.tar.?z
- globfile libretools-hello-1.0-1-any.src.tar.?z
- globfile libretools-hello-1.0-1-any.pkg.tar.?z
- b_stime=$(stat -c %Y -- libretools-hello-1.0-1-any.src.tar.?z)
- b_ptime=$(stat -c %Y -- libretools-hello-1.0-1-any.pkg.tar.?z)
+ globfile libretools-hello-1.0-1-any.src.tar?(.!(sig|*.*))
+ globfile libretools-hello-1.0-1-any.pkg.tar?(.!(sig|*.*))
+ a_stime=$(stat -c %Y -- libretools-hello-1.0-1-any.src.tar?(.!(sig|*.*)))
+ a_ptime=$(stat -c %Y -- libretools-hello-1.0-1-any.pkg.tar?(.!(sig|*.*)))
+
+ testsudo libremakepkg -l "$BATS_TEST_NAME" -S libretools-hello-1.0-1-any.src.tar?(.!(sig|*.*))
+ globfile libretools-hello-1.0-1-any.src.tar?(.!(sig|*.*))
+ globfile libretools-hello-1.0-1-any.pkg.tar?(.!(sig|*.*))
+ b_stime=$(stat -c %Y -- libretools-hello-1.0-1-any.src.tar?(.!(sig|*.*)))
+ b_ptime=$(stat -c %Y -- libretools-hello-1.0-1-any.pkg.tar?(.!(sig|*.*)))
(( a_stime == b_stime ))
(( a_ptime < b_ptime ))
diff --git a/test/cases/librestage.bats b/test/cases/librestage.bats
index 1bc5c25..4551d1e 100644
--- a/test/cases/librestage.bats
+++ b/test/cases/librestage.bats
@@ -1,5 +1,7 @@
load ../lib/common
+shopt -s extglob
+
@test "librestage displays usage text" {
rm -rf "$XDG_CONFIG_HOME"
LC_ALL=C librestage -h >$tmpdir/stdout 2>$tmpdir/stderr
@@ -38,8 +40,8 @@ load ../lib/common
librestage
find "$tmpdir" -not -type d -exec ls -ld -- {} +
- globfile $tmpdir/workdir/staging/reponame/libretools-hello-1.0-1-any.pkg.tar.?z
- $nochroot || globfile $tmpdir/workdir/staging/sources/parabola/libretools-hello-1.0-1-any.src.tar.?z
+ globfile $tmpdir/workdir/staging/reponame/libretools-hello-1.0-1-any.pkg.tar?(.!(sig|*.*))
+ $nochroot || globfile $tmpdir/workdir/staging/sources/parabola/libretools-hello-1.0-1-any.src.tar?(.!(sig|*.*))
}
@test "librestage stages packages without PKGDEST" {
@@ -61,6 +63,6 @@ load ../lib/common
librestage repo1
find "$tmpdir" -not -type d -exec ls -ld -- {} +
- globfile $tmpdir/workdir/staging/repo1/libretools-hello-1.0-1-any.pkg.tar.?z
- $nochroot || globfile $tmpdir/workdir/staging/sources/parabola/libretools-hello-1.0-1-any.src.tar.?z
+ globfile $tmpdir/workdir/staging/repo1/libretools-hello-1.0-1-any.pkg.tar?(.!(sig|*.*))
+ $nochroot || globfile $tmpdir/workdir/staging/sources/parabola/libretools-hello-1.0-1-any.src.tar?(.!(sig|*.*))
}