diff options
Diffstat (limited to 'test/cases/libremakepkg.bats')
-rw-r--r-- | test/cases/libremakepkg.bats | 71 |
1 files changed, 42 insertions, 29 deletions
diff --git a/test/cases/libremakepkg.bats b/test/cases/libremakepkg.bats index 2184de2..34db6e3 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,12 +238,23 @@ 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" } +@test "libremakepkg has a flag to make startdir rw" { + require network sudo || skip + cp fixtures/libremakepkg/PKGBUILD-rwstartdir "$tmpdir/PKGBUILD" + cd "$tmpdir" + + not testsudo libremakepkg -l "$BATS_TEST_NAME" + not globfile libretools-rwstartdir-1.0-1-any.pkg.tar?(.!(sig|*.*)) + testsudo libremakepkg -l "$BATS_TEST_NAME" -W + globfile libretools-rwstartdir-1.0-1-any.pkg.tar?(.!(sig|*.*)) +} + @test "libremakepkg can re-use source-packages" { require network sudo || skip @@ -253,16 +266,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 )) |