summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2018-02-16 12:10:25 -0500
committerEli Schwartz <eschwartz@archlinux.org>2018-02-20 00:34:41 -0500
commit8757c459089c0db12e57db66561f640f657e34ac (patch)
tree0aa433d8cf0833d9bcdb9c7edad03755c19f1fc7
parent07e6a91da1331ae61b667d878092c5b03aa49ced (diff)
test: db-update: verify that PKGEXT(S) is treated as a glob
Commit b61a714 introduced a regression that in a db-functions function called by db-update, config:PKGEXT is treated like a fixed string, instead of as a glob. Because of inadequacy of the test-suite, this did not cause a test failure. https://lists.archlinux.org/pipermail/arch-projects/2018-February/004742.html The broken function checks if the repo already contains a package that matches the one being released. This did not trigger a test-suite failure because right after the broken check there is another check that checks for the exact filename of the new package file. In the test-suite, all package files have the same extension, so the latter check always "saved" us. So, modify a relevant test case (a test case that verifies that we can't release the same package twice) such that the second time we release the package, we set PKGEXT to something different (.gz, instead of the normal .xz). This way, we can be sure that when db-update rejects the operation, it's because of the glob check, not the exact-filename check. This is made slightly tricky because the __buildPackage() test helper routine tries to cache builds, to speed up the tests. Without modification, this means that it will just ignore the new PKGEXT. So, modify it to only use the cache if it can successfully copy build artifacts out, in a way that respects PKGEXT.
-rw-r--r--test/cases/db-update.bats2
-rw-r--r--test/lib/common.bash3
2 files changed, 2 insertions, 3 deletions
diff --git a/test/cases/db-update.bats b/test/cases/db-update.bats
index 349b195..e7e4489 100644
--- a/test/cases/db-update.bats
+++ b/test/cases/db-update.bats
@@ -92,7 +92,7 @@ load ../lib/common
db-update
checkPackage extra pkg-any-a
- releasePackage extra pkg-any-a
+ PKGEXT=.pkg.tar.gz releasePackage extra pkg-any-a
run db-update
[ "$status" -ne 0 ]
}
diff --git a/test/lib/common.bash b/test/lib/common.bash
index 24b2378..568a541 100644
--- a/test/lib/common.bash
+++ b/test/lib/common.bash
@@ -23,8 +23,7 @@ __buildPackage() {
if [[ -n ${BUILDDIR} ]]; then
cache=${BUILDDIR}/$(__getCheckSum PKGBUILD)
- if [[ -d ${cache} ]]; then
- cp -Lv ${cache}/*${PKGEXT}{,.sig} ${pkgdest}
+ if cp -Lv ${cache}/*${PKGEXT}{,.sig} ${pkgdest} 2>/dev/null; then
return 0
else
mkdir -p ${cache}