blob: 8a4fa63e6dcc078a51e397c31eea444745d940f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#!/usr/bin/env roundup
describe libremakepkg
. ./test-common.sh
before() {
_before libremakepkg
mkdir -p "$XDG_CONFIG_HOME"/libretools
echo "CHROOTDIR='$tmpdir/chrootdir'" > "$XDG_CONFIG_HOME"/libretools/chroot.conf
echo "CHROOT='default'" >> "$XDG_CONFIG_HOME"/libretools/chroot.conf
echo "CHROOTEXTRAPKG=()" >> "$XDG_CONFIG_HOME"/libretools/chroot.conf
}
after() {
_after
}
it_builds_a_trivial_package() {
require network sudo || return 0
cp libremakepkg.d/PKGBUILD-hello "$tmpdir/PKGBUILD"
cd "$tmpdir"
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
sudo -EH libremakepkg
[[ -f $(echo libretools-hello-1.0-1-any.pkg.tar.?z) ]]
}
it_displays_help_as_normal_user() {
rm -rf "$XDG_CONFIG_HOME"
libremakepkg -h >$tmpdir/stdout 2>$tmpdir/stderr
[[ "$(sed 1q $tmpdir/stdout)" =~ Usage:.* ]]
[[ -z "$(cat $tmpdir/stderr)" ]]
}
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"
libremakepkg >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?
[[ $stat != 0 ]]
[[ -z "$(cat $tmpdir/stdout)" ]]
[[ -n "$(cat $tmpdir/stderr)" ]]
}
|