summaryrefslogtreecommitdiff
path: root/test/librestage-test.sh
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-05-05 14:01:38 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2017-05-05 17:36:24 -0400
commitdbcc8a0dc40ce467f3b11b0bb8029b96a72dc3cf (patch)
treebf38e61e12f4d18d990b0ec35f65cdbc96399556 /test/librestage-test.sh
parentd2a46974927d32843a5241b8f0a82dc9763fb051 (diff)
test: librestage: add tests for the (not yet implemented) sourceball feature
Diffstat (limited to 'test/librestage-test.sh')
-rw-r--r--test/librestage-test.sh41
1 files changed, 30 insertions, 11 deletions
diff --git a/test/librestage-test.sh b/test/librestage-test.sh
index 9ecbf38..153e1a4 100644
--- a/test/librestage-test.sh
+++ b/test/librestage-test.sh
@@ -3,18 +3,21 @@
describe librestage
. ./test-common.sh
+setup_chrootdir
+
common_before() {
mkdir -p $XDG_CONFIG_HOME/libretools
echo "WORKDIR='$tmpdir/workdir'" > $XDG_CONFIG_HOME/libretools/libretools.conf
- echo "ARCHES=('x86_64' 'i686' 'misp64el')" >> $XDG_CONFIG_HOME/libretools/libretools.conf
- mkdir -p $XDG_CONFIG_HOME/xbs
- echo "BUILDSYSTEM=abslibre" > $XDG_CONFIG_HOME/xbs/xbs.conf
+ mkdir -p $XDG_CONFIG_HOME/pacman
+ {
+ printf 'PKGDEST=%q\n' "$tmpdir/workdir/pkgdest"
+ printf 'SRCPKGDEST=%q\n' "$tmpdir/workdir/srcpkgdest"
+ echo "PACKAGER='Test Suite <test@localhost>'"
+ } >$XDG_CONFIG_HOME/pacman/makepkg.conf
- echo 'PKGEXT=.pkg.tar.gz' > $HOME/.makepkg.conf
- echo "PKGDEST='$tmpdir/workdir/pkgdest'" >> $HOME/.makepkg.conf
- echo "PACKAGER='Test Suite <test@localhost>'" >> $HOME/.makepkg.conf
mkdir -p "$tmpdir/workdir/pkgdest"
+ mkdir -p "$tmpdir/workdir/srcpkgdest"
}
it_displays_usage_text() {
@@ -42,24 +45,40 @@ it_fails_with_invalid_args() {
}
it_guesses_the_repo() {
+ nochroot=false; require network sudo || nochroot=true
mkdir -p -- "$tmpdir/reponame/libretools-hello"
cp librestage.d/PKGBUILD-hello "$tmpdir/reponame/libretools-hello/PKGBUILD"
cd "$tmpdir/reponame/libretools-hello"
- makepkg
+ if $nochroot; then
+ makepkg
+ else
+ testsudo libremakepkg -l "$roundup_test_name"
+ fi
librestage
- [[ -f $tmpdir/workdir/staging/reponame/libretools-hello-1.0-1-any.pkg.tar.gz ]]
+ find "$tmpdir" -not -type d -exec ls -ld -- {} +
+ [[ -f $(echo $tmpdir/workdir/staging/reponame/libretools-hello-1.0-1-any.pkg.tar.?z) ]]
+ $nochroot || [[ -f $(echo $tmpdir/workdir/staging/sources/parabola/libretools-hello-1.0-1-any.src.tar.?z) ]]
}
it_stages_packages_without_PKGDEST() {
- echo "PKGDEST=''" >> $HOME/.makepkg.conf
+ nochroot=false; require network sudo || nochroot=true
+
+ echo "PKGDEST=''" >> $XDG_CONFIG_HOME/pacman/makepkg.conf
+ echo "SRCPKGDEST=''" >> $XDG_CONFIG_HOME/pacman/makepkg.conf
cp librestage.d/PKGBUILD-hello "$tmpdir/PKGBUILD"
cd "$tmpdir"
- makepkg
+ if $nochroot; then
+ makepkg
+ else
+ testsudo libremakepkg -l "$roundup_test_name"
+ fi
librestage repo1
- [[ -f $tmpdir/workdir/staging/repo1/libretools-hello-1.0-1-any.pkg.tar.gz ]]
+ find "$tmpdir" -not -type d -exec ls -ld -- {} +
+ [[ -f $(echo $tmpdir/workdir/staging/repo1/libretools-hello-1.0-1-any.pkg.tar.?z) ]]
+ $nochroot || [[ -f $(echo $tmpdir/workdir/staging/sources/parabola/libretools-hello-1.0-1-any.src.tar.?z) ]]
}