diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-10-15 18:53:35 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-10-15 23:13:03 -0400 |
commit | 3cdb638d9d88d23182d35a971e13102a661aaffd (patch) | |
tree | ae5c5a08f5ddc71cf54c4c6778b2b8bd28be2ad3 /test | |
parent | 86ee52ddc0cf2d09c1789dd9c1dcbcc98b9b45c0 (diff) |
test: libremakepkg: add a test for bug #442, chcleanup not running
Diffstat (limited to 'test')
-rw-r--r-- | test/libremakepkg-test.sh | 28 | ||||
-rw-r--r-- | test/libremakepkg.d/PKGBUILD-testpkg1 | 19 | ||||
-rw-r--r-- | test/libremakepkg.d/PKGBUILD-testpkg2 | 19 |
3 files changed, 66 insertions, 0 deletions
diff --git a/test/libremakepkg-test.sh b/test/libremakepkg-test.sh index 2fb7f2f..bef1db8 100644 --- a/test/libremakepkg-test.sh +++ b/test/libremakepkg-test.sh @@ -31,6 +31,34 @@ it_builds_a_trivial_package() { [[ -f $(echo libretools-hello-1.0-1-any.pkg.tar.?z) ]] } +it_cleans_the_chroot_before_building() { + require network sudo || return 0 + # 1. First, we build testpkg1 + # 2. Then, we build testpkg2, which depends on testpkg1 + # Therefore, testpkg1 will be installed after testpkg2 is built, we + # check for that. + # 3. Then, we build hello, which depends on neither, so testpkg1 should + # be removed. + + # Also, do funny things with the output of libremakepkg to get a helpful + # fail case. + + mkdir -p "$tmpdir"/{1,2,3} + cp libremakepkg.d/PKGBUILD-testpkg1 "$tmpdir/1/PKGBUILD" + cp libremakepkg.d/PKGBUILD-testpkg2 "$tmpdir/2/PKGBUILD" + cp libremakepkg.d/PKGBUILD-hello "$tmpdir/3/PKGBUILD" + + libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty + cd "$tmpdir/1" + testsudo libremakepkg &> "$tmpdir/out" || { r=$?; tail "$tmpdir/out"|cat -v; return $r; } + cd "$tmpdir/2" + testsudo libremakepkg &> "$tmpdir/out" || { r=$?; tail "$tmpdir/out"|cat -v; return $r; } + testsudo librechroot run libretools-testpkg1 'first time, pass' + cd "$tmpdir/3" + testsudo libremakepkg &> "$tmpdir/out" || { r=$?; tail "$tmpdir/out"|cat -v; return $r; } + ! testsudo librechroot run libretools-testpkg1 'second time, fail' +} + it_handles_PKGDEST_not_existing() { require network sudo || return 0 cp libremakepkg.d/PKGBUILD-hello "$tmpdir/PKGBUILD" diff --git a/test/libremakepkg.d/PKGBUILD-testpkg1 b/test/libremakepkg.d/PKGBUILD-testpkg1 new file mode 100644 index 0000000..b7961bb --- /dev/null +++ b/test/libremakepkg.d/PKGBUILD-testpkg1 @@ -0,0 +1,19 @@ +pkgname='libretools-testpkg1' +pkgver=1.0 +license=('GPL') +url='https://parabolagnulinux.org' + +pkgrel=1 +arch=(any) +depends=(sh) + +build() { + cd "$srcdir" + echo '#!/bin/sh' > testpkg1.sh + echo 'echo testpkg1' >> testpkg1.sh +} + +package() { + cd "$srcdir" + install -Dm755 testpkg1.sh "$pkgdir"/usr/bin/libretools-testpkg1 +} diff --git a/test/libremakepkg.d/PKGBUILD-testpkg2 b/test/libremakepkg.d/PKGBUILD-testpkg2 new file mode 100644 index 0000000..11f7fe8 --- /dev/null +++ b/test/libremakepkg.d/PKGBUILD-testpkg2 @@ -0,0 +1,19 @@ +pkgname='libretools-testpkg2' +pkgver=1.0 +license=('GPL') +url='https://parabolagnulinux.org' + +pkgrel=1 +arch=(any) +depends=(sh libretools-testpkg1) + +build() { + cd "$srcdir" + echo '#!/bin/sh' > testpkg2.sh + echo 'libretools-testpkg1' >> testpkg2.sh +} + +package() { + cd "$srcdir" + install -Dm755 testpkg2.sh "$pkgdir"/usr/bin/libretools-testpkg2 +} |