diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2009-04-21 23:05:11 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-04-21 23:05:11 +0200 |
commit | d6e476488b760e5e06d629cdd1e101a03f48c2ba (patch) | |
tree | 2a947e8cb8e528ccc004cd0166e2ae42ecd4d7a7 | |
parent | 5884918d9bf90cceba6c992f46b0437fbbcdbd1e (diff) |
Added tests for GIT_USE_ORIGIN
-rw-r--r-- | test/addremove | 48 | ||||
-rwxr-xr-x | test/main | 77 | ||||
-rw-r--r-- | test/setup | 24 |
3 files changed, 79 insertions, 70 deletions
diff --git a/test/addremove b/test/addremove new file mode 100644 index 0000000..23196e1 --- /dev/null +++ b/test/addremove @@ -0,0 +1,48 @@ +## vim:ft=zsh +file=${repo%-*} +if [[ $repo == *-bare ]] { + echo "## bare repository" + complement=$file +} else { + echo "## non-bare repository" + complement=${repo}-bare +} +echo "# pkg add (ok)" +pkg add $repo +[[ -e $test_pdir/$repo/foo ]] +[[ -d $test_pdir/$repo/.git ]] + +echo "# pkg add (already installed)" +! pkg add $repo + +echo "# populate_collected" +[[ -L $test_home/bin/$file ]] +[[ -x $(readlink $test_home/bin/$file) ]] +[[ -e $test_pdir/.collected/man/man2/$file.2 ]] + +repeat 2 { + echo "# pkg list" + stringcmp "core\n$repo" "$(pkg list local)" + stringcmp "$complement\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list not-installed)" + stringcmp "core\nra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list remote)" + pkg update +} + +echo "# pkg remove (not installed/nonexistent)" +! pkg remove suckage +! pkg remove rb + +echo "# pkg remove (ok)" +pkg remove $repo + +echo "# genocide_collected (~/bin)" +[[ ! -L $test_home/bin/$file ]] +[[ ! -e $test_pdir/.collected/man/man2/$file.2 ]] + +repeat 2 { + echo "# pkg list" + stringcmp "core" "$(pkg list local)" + stringcmp "ra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list not-installed)" + stringcmp "core\nra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list remote)" + pkg update +} @@ -7,6 +7,7 @@ function stringcmp { diff -u <(echo $1) <(echo $2) } +tests=$PWD/test test_pdir=$(mktemp -dt pkgdir.XXXXXX) test_proot=$(mktemp -dt pkgroot.XXXXXX) test_home=$(mktemp -dt pkghome.XXXXXX) @@ -18,29 +19,7 @@ test directories: HOME = $test_home meow -echo "# setting up PKG_ROOT" -cd $test_proot -git clone ${1-git://git.tabularazor.org/~derf/pkg} core -cp core/include/pkglist pkglist -for repo in ra rb rc; ( - mkdir $repo - cd $repo - git init - touch foo - mkdir bin - touch bin/$repo - mkdir -p man/2 - echo "=head1 WASTED SPACE\n\nhuhu" > man/2/$repo - chmod 755 bin/$repo - git add . - git commit -m 'initial commit' - cd .. - mkdir ${repo}-bare - cd ${repo}-bare - git --bare init - cd ../$repo - git push ../${repo}-bare master -) +source $tests/setup echo "# bootstrapping PDIR" cd $test_home @@ -75,53 +54,11 @@ echo "# pkg add (no such repo)" echo "# pkg add (already installed)" ! pkg add core -for repo in ra ra-bare; { - file=${repo%-*} - if [[ $repo == *-bare ]] { - echo "## bare repository" - complement=$file - } else { - echo "## non-bare repository" - complement=${repo}-bare - } - echo "# pkg add (ok)" - pkg add $repo - [[ -e $test_pdir/$repo/foo ]] - [[ -d $test_pdir/$repo/.git ]] - - echo "# pkg add (already installed)" - ! pkg add $repo - - echo "# populate_collected" - [[ -L $test_home/bin/$file ]] - [[ -x $(readlink $test_home/bin/$file) ]] - [[ -e $test_pdir/.collected/man/man2/$file.2 ]] - - repeat 2 { - echo "# pkg list" - stringcmp "core\n$repo" "$(pkg list local)" - stringcmp "$complement\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list not-installed)" - stringcmp "core\nra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list remote)" - pkg update - } - - echo "# pkg remove (not installed/nonexistent)" - ! pkg remove suckage - ! pkg remove rb - - echo "# pkg remove (ok)" - pkg remove $repo - - echo "# genocide_collected (~/bin)" - [[ ! -L $test_home/bin/$file ]] - [[ ! -e $test_pdir/.collected/man/man2/$file.2 ]] - - repeat 2 { - echo "# pkg list" - stringcmp "core" "$(pkg list local)" - stringcmp "ra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list not-installed)" - stringcmp "core\nra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list remote)" - pkg update +for conf_origin in 0 1; { + echo "## GIT_USE_ORIGIN=$conf_origin" + echo "GIT_USE_ORIGIN=$conf_origin" >> $test_home/.pkg.conf + for repo in ra ra-bare; { + source $tests/addremove } } diff --git a/test/setup b/test/setup new file mode 100644 index 0000000..ac82c31 --- /dev/null +++ b/test/setup @@ -0,0 +1,24 @@ +## vim:ft=zsh +echo "# setting up PKG_ROOT" +cd $test_proot +git clone ${1-git://git.tabularazor.org/~derf/pkg} core +cp core/include/pkglist pkglist +for repo in ra rb rc; ( + mkdir $repo + cd $repo + git init + touch foo + mkdir bin + touch bin/$repo + mkdir -p man/2 + echo "=head1 WASTED SPACE\n\nhuhu" > man/2/$repo + chmod 755 bin/$repo + git add . + git commit -m 'initial commit' + cd .. + mkdir ${repo}-bare + cd ${repo}-bare + git --bare init + cd ../$repo + git push ../${repo}-bare master +) |