diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2010-08-07 21:21:08 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2010-08-07 21:21:08 +0200 |
commit | bccf84211be4abda3c96ded43f03b597081fecb1 (patch) | |
tree | adc9bb33a544d0b9fb49c616e907777a191468b1 /test/runTest | |
parent | 66ae94cafb62da09da77712269f411f095dd81fc (diff) |
add test for db-remove
Diffstat (limited to 'test/runTest')
-rwxr-xr-x | test/runTest | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/test/runTest b/test/runTest index 1d54ea4..258a181 100755 --- a/test/runTest +++ b/test/runTest @@ -3,6 +3,23 @@ curdir=$(readlink -e $(dirname $0)) . "${curdir}/lib/common.inc" +# +# self test +# + +testPackages() { + local p + for p in "${pkgdir}"/*; do + pushd $p >/dev/null + namcap *.pkg.tar.* || fail 'namcap failed' + popd >/dev/null + done +} + + +# +# db-update +# testAddSimplePackages() { local arches=('i686' 'x86_64') @@ -63,4 +80,65 @@ testAddSplitPackages() { } +# +# db-remove +# + +testRemovePackages() { + local arches=('i686' 'x86_64') + local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-split-a' 'pkg-split-b') + local pkgbase + + for pkgbase in ${pkgs[@]}; do + for arch in ${arches[@]}; do + releasePackage extra ${pkgbase} ${arch} + done + done + + ../db-update extra + + for pkgbase in ${pkgs[@]}; do + for arch in ${arches[@]}; do + ../db-remove ${pkgbase} extra ${arch} + done + done + + for arch in ${arches[@]}; do + [ -z "$(bsdtar -tf "${FTP_BASE}/extra/os/${arch}/extra.db.tar.gz" -O)" ] || fail "extra/os/${arch}/${repo}.db.tar.gz should be empty" + done + + for pkgbase in ${pkgs[@]}; do + for arch in ${arches[@]}; do + svn up -q "${TMP}/svn-packages-copy/${pkgbase}" + [ -d "${TMP}/svn-packages-copy/${pkgbase}/repos/extra-${arch}" ] && fail "svn-packages-copy/${pkgbase}/repos/extra-${arch} should not exist" + done + done +} + +testRemoveAnyPackages() { + local arches=('i686' 'x86_64') + local pkgs=('pkg-any-a' 'pkg-any-b') + local pkgbase + + for pkgbase in ${pkgs[@]}; do + releasePackage extra ${pkgbase} any + done + + ../db-update extra + + for pkgbase in ${pkgs[@]}; do + ../db-remove ${pkgbase} extra any + done + + for arch in ${arches[@]}; do + [ -z "$(bsdtar -tf "${FTP_BASE}/extra/os/${arch}/extra.db.tar.gz" -O)" ] || fail "extra/os/${arch}/${repo}.db.tar.gz should be empty" + done + + for pkgbase in ${pkgs[@]}; do + svn up -q "${TMP}/svn-packages-copy/${pkgbase}" + [ -d "${TMP}/svn-packages-copy/${pkgbase}/repos/extra-any" ] && fail "svn-packages-copy/${pkgbase}/repos/extra-any should not exist" + done +} + + . "${curdir}/lib/shunit2" |