From d71dbf8ee17fa8def38ed027fe8cd851fee701f1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 19 Feb 2017 03:06:16 -0500 Subject: libremakepkg: correctly exit if a hook fails --- test/libremakepkg-test.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/libremakepkg-test.sh') diff --git a/test/libremakepkg-test.sh b/test/libremakepkg-test.sh index ddccab0..50d43f6 100644 --- a/test/libremakepkg-test.sh +++ b/test/libremakepkg-test.sh @@ -125,6 +125,7 @@ it_otherwise_fails_as_normal_user() { # I do this to give it a chance of passing cp libremakepkg.d/PKGBUILD-hello "$tmpdir/PKGBUILD" cd "$tmpdir" + local stat=0 libremakepkg >$tmpdir/stdout 2>$tmpdir/stderr || stat=$? @@ -132,3 +133,19 @@ it_otherwise_fails_as_normal_user() { empty $tmpdir/stdout not empty $tmpdir/stderr } + +it_fails_if_a_hook_fails() { + require network sudo || return 0 + cp libremakepkg.d/PKGBUILD-hello "$tmpdir/PKGBUILD" + cd "$tmpdir" + local stat=0 + + sed -i 's/^BLACKLIST=.*/&-bogus/' "$XDG_CONFIG_HOME"/libretools/libretools.conf + trap 'sed -i s/-bogus// "$XDG_CONFIG_HOME"/libretools/libretools.conf' RETURN + + libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty + testsudo libremakepkg -l "$roundup_test_name" >$tmpdir/stdout 2>$tmpdir/stderr || stat=$? + + [[ $stat != 0 ]] + tail -n1 $tmpdir/stderr | grep -qF '==> ERROR: Failure(s) in check_pkgbuild: check_pkgbuild_nonfree' +} -- cgit v1.2.3