From 3cdb638d9d88d23182d35a971e13102a661aaffd Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 15 Oct 2013 18:53:35 -0400 Subject: test: libremakepkg: add a test for bug #442, chcleanup not running --- test/libremakepkg-test.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'test/libremakepkg-test.sh') 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" -- cgit v1.2.3-54-g00ecf