diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2011-11-05 18:37:51 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2011-11-05 18:37:51 +0100 |
commit | 3084db6f3c6678eeb27ba0d532db0007432bfed1 (patch) | |
tree | 26a01771540db4842c66affceb1577a1f3cfcb6c /test | |
parent | 23a508412936b1408e9ce9399e675fc1397c28eb (diff) | |
download | dbscripts-3084db6f3c6678eeb27ba0d532db0007432bfed1.tar.gz dbscripts-3084db6f3c6678eeb27ba0d532db0007432bfed1.tar.xz |
Add simple tests for db-repo-add and db-repo-remove
Diffstat (limited to 'test')
-rwxr-xr-x | test/test.d/db-repo-add.sh | 54 | ||||
-rwxr-xr-x | test/test.d/db-repo-remove.sh | 58 |
2 files changed, 112 insertions, 0 deletions
diff --git a/test/test.d/db-repo-add.sh b/test/test.d/db-repo-add.sh new file mode 100755 index 0000000..8603104 --- /dev/null +++ b/test/test.d/db-repo-add.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +curdir=$(readlink -e $(dirname $0)) +. "${curdir}/../lib/common.inc" + +testAddSimplePackages() { + local arches=('i686' 'x86_64') + local pkgs=('pkg-simple-a' 'pkg-simple-b') + local pkgbase + local arch + + for pkgbase in ${pkgs[@]}; do + for arch in ${arches[@]}; do + cp "${pkgdir}/${pkgbase}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${FTP_BASE}/${PKGPOOL}/" + touch "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" + ln -s "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${FTP_BASE}/extra/os/${arch}/" + ln -s "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" "${FTP_BASE}/extra/os/${arch}/" + ../db-repo-add extra ${arch} ${pkgbase}-1-1-${arch}.pkg.tar.xz + done + done + + for pkgbase in ${pkgs[@]}; do + for arch in ${arches[@]}; do + checkPackageDB extra ${pkgbase}-1-1-${arch}.pkg.tar.xz ${arch} + done + done +} + +testAddMultiplePackages() { + local arches=('i686' 'x86_64') + local pkgs=('pkg-simple-a' 'pkg-simple-b') + local pkgbase + local arch + + for arch in ${arches[@]}; do + add_pkgs=() + for pkgbase in ${pkgs[@]}; do + cp "${pkgdir}/${pkgbase}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${FTP_BASE}/${PKGPOOL}/" + touch "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" + ln -s "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz" "${FTP_BASE}/extra/os/${arch}/" + ln -s "${FTP_BASE}/${PKGPOOL}/${pkgbase}-1-1-${arch}.pkg.tar.xz.sig" "${FTP_BASE}/extra/os/${arch}/" + add_pkgs[${#add_pkgs[*]}]=${pkgbase}-1-1-${arch}.pkg.tar.xz + done + ../db-repo-add extra ${arch} ${add_pkgs[@]} + done + + for pkgbase in ${pkgs[@]}; do + for arch in ${arches[@]}; do + checkPackageDB extra ${pkgbase}-1-1-${arch}.pkg.tar.xz ${arch} + done + done +} + +. "${curdir}/../lib/shunit2" diff --git a/test/test.d/db-repo-remove.sh b/test/test.d/db-repo-remove.sh new file mode 100755 index 0000000..315d63d --- /dev/null +++ b/test/test.d/db-repo-remove.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +curdir=$(readlink -e $(dirname $0)) +. "${curdir}/../lib/common.inc" + +testRemovePackages() { + local arches=('i686' 'x86_64') + local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-simple-epoch') + local pkgbase + local arch + + for pkgbase in ${pkgs[@]}; do + for arch in ${arches[@]}; do + releasePackage extra ${pkgbase} ${arch} + done + done + + ../db-update + + for pkgbase in ${pkgs[@]}; do + for arch in ${arches[@]}; do + ../db-repo-remove extra ${arch} ${pkgbase} + done + done + + for pkgbase in ${pkgs[@]}; do + for arch in ${arches[@]}; do + checkRemovedPackageDB extra ${pkgbase} ${arch} + done + done +} + +testRemoveMultiplePackages() { + local arches=('i686' 'x86_64') + local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-simple-epoch') + local pkgbase + local arch + + for pkgbase in ${pkgs[@]}; do + for arch in ${arches[@]}; do + releasePackage extra ${pkgbase} ${arch} + done + done + + ../db-update + + for arch in ${arches[@]}; do + ../db-repo-remove extra ${arch} ${pkgs[@]} + done + + for pkgbase in ${pkgs[@]}; do + for arch in ${arches[@]}; do + checkRemovedPackageDB extra ${pkgbase} ${arch} + done + done +} + +. "${curdir}/../lib/shunit2" |