diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-05 14:01:38 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-05 17:36:24 -0400 |
commit | dbcc8a0dc40ce467f3b11b0bb8029b96a72dc3cf (patch) | |
tree | bf38e61e12f4d18d990b0ec35f65cdbc96399556 /test | |
parent | d2a46974927d32843a5241b8f0a82dc9763fb051 (diff) |
test: librestage: add tests for the (not yet implemented) sourceball feature
Diffstat (limited to 'test')
-rw-r--r-- | test/librestage-test.sh | 41 | ||||
-rw-r--r-- | test/test-common.sh | 7 |
2 files changed, 36 insertions, 12 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) ]] } diff --git a/test/test-common.sh b/test/test-common.sh index e704b5a..5c238e1 100644 --- a/test/test-common.sh +++ b/test/test-common.sh @@ -5,6 +5,10 @@ if [[ $HOME == "$(eval echo ~$USER)" ]]; then exit 1 fi +_common_before() { + : +} + common_before() { : } @@ -25,6 +29,7 @@ before() { stat=0 + _common_before common_before } @@ -43,7 +48,7 @@ setup_chrootdir() { export chrootdir="$(mktemp -d --tmpdir "test-chrootdir.XXXXXXXXXXXX")" trap "$(printf '_cleanup_chrootdir %q' "$chrootdir")" EXIT fi - common_before() { + _common_before() { mkdir -p "$XDG_CONFIG_HOME"/libretools echo "BLACKLIST=https://git.parabola.nu/blacklist.git/plain/blacklist.txt" >"$XDG_CONFIG_HOME"/libretools/libretools.conf |