From 320419d272295e0fca26c5ee134609e406e63ddc Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 26 Aug 2018 17:10:13 -0400 Subject: test: librechroot: Check whether chcleanup can install libretools [ci-skip] --- test/librechroot-test.sh | 16 +++++++++++++++- test/librechroot.d/PKGBUILD | 22 ---------------------- test/librechroot.d/PKGBUILD-arches | 22 ++++++++++++++++++++++ test/librechroot.d/PKGBUILD-libretools | 20 ++++++++++++++++++++ 4 files changed, 57 insertions(+), 23 deletions(-) delete mode 100644 test/librechroot.d/PKGBUILD create mode 100644 test/librechroot.d/PKGBUILD-arches create mode 100644 test/librechroot.d/PKGBUILD-libretools diff --git a/test/librechroot-test.sh b/test/librechroot-test.sh index 00ca2ed..93e7833 100644 --- a/test/librechroot-test.sh +++ b/test/librechroot-test.sh @@ -71,7 +71,7 @@ it_obeys_depends_in_PKGBUILD() { not testsudo librechroot -l "$roundup_test_name" run lsof # Make sure it leaves it with the PKGBUILD testsudo librechroot -l "$roundup_test_name" install-name lsof - testsudo librechroot -l "$roundup_test_name" run sh -c 'printf "%s\n" "$1" > /startdir/PKGBUILD' -- "$(cat librechroot.d/PKGBUILD)" + testsudo librechroot -l "$roundup_test_name" run sh -c 'printf "%s\n" "$1" > /startdir/PKGBUILD' -- "$(cat librechroot.d/PKGBUILD-arches)" # uid=99 is 'nobody', but we say '99' because sometimes 'nobody' is uid=65534. # https://bugs.archlinux.org/task/56828 testsudo librechroot -l "$roundup_test_name" run chown -R 99:99 /startdir @@ -79,6 +79,20 @@ it_obeys_depends_in_PKGBUILD() { testsudo librechroot -l "$roundup_test_name" run lsof } +it_can_install_libretools_with_chcleanup() { + require network sudo || return 0 + libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty + + not testsudo librechroot -l "$roundup_test_name" run test -f /usr/bin/chcleanup + testsudo librechroot -l "$roundup_test_name" run mkdir /startdir + testsudo librechroot -l "$roundup_test_name" run sh -c 'printf "%s\n" "$1" > /startdir/PKGBUILD' -- "$(cat librechroot.d/PKGBUILD-libretools)" + # uid=99 is 'nobody', but we say '99' because sometimes 'nobody' is uid=65534. + # https://bugs.archlinux.org/task/56828 + testsudo librechroot -l "$roundup_test_name" run chown -R 99:99 /startdir + testsudo librechroot -l "$roundup_test_name" clean-pkgs + testsudo librechroot -l "$roundup_test_name" run test -f /usr/bin/chcleanup +} + it_displays_help_as_normal_user() { rm -rf "$XDG_CONFIG_HOME" LC_ALL=C librechroot help >$tmpdir/stdout 2>$tmpdir/stderr diff --git a/test/librechroot.d/PKGBUILD b/test/librechroot.d/PKGBUILD deleted file mode 100644 index 6116ad9..0000000 --- a/test/librechroot.d/PKGBUILD +++ /dev/null @@ -1,22 +0,0 @@ -pkgname='libretools-hello' -pkgver=1.0 -license=('GPL') -url='https://parabola.nu' - -pkgrel=1 -arch=(i686 x86_64) -depends=(sh) -depends_i686=('lsof') -depends_x86_64=('lsof') - -build() { - cd "$srcdir" - echo '#!/bin/sh' > hello.sh - echo 'echo Hello, world!' >> hello.sh - echo 'lsof' >> hello.sh -} - -package() { - cd "$srcdir" - install -Dm755 hello.sh "$pkgdir"/usr/bin/libretools-hello -} diff --git a/test/librechroot.d/PKGBUILD-arches b/test/librechroot.d/PKGBUILD-arches new file mode 100644 index 0000000..6116ad9 --- /dev/null +++ b/test/librechroot.d/PKGBUILD-arches @@ -0,0 +1,22 @@ +pkgname='libretools-hello' +pkgver=1.0 +license=('GPL') +url='https://parabola.nu' + +pkgrel=1 +arch=(i686 x86_64) +depends=(sh) +depends_i686=('lsof') +depends_x86_64=('lsof') + +build() { + cd "$srcdir" + echo '#!/bin/sh' > hello.sh + echo 'echo Hello, world!' >> hello.sh + echo 'lsof' >> hello.sh +} + +package() { + cd "$srcdir" + install -Dm755 hello.sh "$pkgdir"/usr/bin/libretools-hello +} diff --git a/test/librechroot.d/PKGBUILD-libretools b/test/librechroot.d/PKGBUILD-libretools new file mode 100644 index 0000000..dcc0f61 --- /dev/null +++ b/test/librechroot.d/PKGBUILD-libretools @@ -0,0 +1,20 @@ +pkgname='libretools-hello' +pkgver=1.0 +license=('GPL') +url='https://parabola.nu' + +pkgrel=1 +arch=(any) +depends=(libretools) + +build() { + cd "$srcdir" + echo '#!/bin/sh' > hello.sh + echo 'echo Hello, world!' >> hello.sh + echo 'lsof' >> hello.sh +} + +package() { + cd "$srcdir" + install -Dm755 hello.sh "$pkgdir"/usr/bin/libretools-hello +} -- cgit v1.2.2