From dbcc8a0dc40ce467f3b11b0bb8029b96a72dc3cf Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 5 May 2017 14:01:38 -0400 Subject: test: librestage: add tests for the (not yet implemented) sourceball feature --- test/librestage-test.sh | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) (limited to 'test/librestage-test.sh') 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 '" + } >$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 '" >> $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) ]] } -- cgit v1.2.3-54-g00ecf