summaryrefslogtreecommitdiff
path: root/test/lib
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/common.inc98
-rwxr-xr-xtest/lib/shunit210
2 files changed, 54 insertions, 54 deletions
diff --git a/test/lib/common.inc b/test/lib/common.inc
index 04bed2b..c549ac9 100644
--- a/test/lib/common.inc
+++ b/test/lib/common.inc
@@ -23,7 +23,7 @@ oneTimeSetUp() {
build=true
for a in ${pkgarch[@]}; do
for p in ${pkgname[@]}; do
- [ ! -f ${p}-${pkgversion}-${a}${PKGEXT} ] && build=false
+ [ ! -f ${p}-${pkgversion}-${a}${package_extension_suffixfile} ] && build=false
done
done
@@ -37,7 +37,7 @@ oneTimeSetUp() {
fi
for a in ${pkgarch[@]}; do
for p in ${pkgname[@]}; do
- cp ${p}-${pkgversion}-${a}${PKGEXT} $(dirname ${BASH_SOURCE[0]})/../packages/$(basename ${d})
+ cp ${p}-${pkgversion}-${a}${package_extension_suffixfile} $(dirname ${BASH_SOURCE[0]})/../packages/$(basename ${d})
done
done
fi
@@ -56,52 +56,52 @@ setUp() {
local a
[ -f "$(dirname ${BASH_SOURCE[0]})/../../config.local" ] && die "$(dirname ${BASH_SOURCE[0]})/../../config.local exists"
- TMP="$(mktemp -d /dev/shm/$(basename $0).XXXXXXXXXX)"
- #msg "Using ${TMP}"
+ temporary_directory="$(mktemp -d /dev/shm/$(basename $0).XXXXXXXXXX)"
+ #msg "Using ${temporary_directory}"
PKGREPOS=('core' 'extra' 'testing')
PKGPOOL='pool/packages'
- mkdir -p "${TMP}/"{ftp,tmp,staging,{package,source}-cleanup,svn-packages-{copy,repo}}
+ mkdir -p "${temporary_directory}/"{ftp,tmp,staging,{package,source}-cleanup,svn-packages-{copy,repo}}
for r in ${PKGREPOS[@]}; do
- mkdir -p "${TMP}/staging/${r}"
+ mkdir -p "${temporary_directory}/staging/${r}"
for a in ${ARCHES[@]} any; do
- mkdir -p "${TMP}/ftp/${r}/os/${a}"
+ mkdir -p "${temporary_directory}/ftp/${r}/os/${a}"
done
done
- mkdir -p "${TMP}/ftp/${PKGPOOL}"
- mkdir -p "${TMP}/ftp/${SRCPOOL}"
+ mkdir -p "${temporary_directory}/ftp/${PKGPOOL}"
+ mkdir -p "${temporary_directory}/ftp/${SRCPOOL}"
msg 'Creating svn repository...'
- svnadmin create "${TMP}/svn-packages-repo"
- svn checkout -q "file://${TMP}/svn-packages-repo" "${TMP}/svn-packages-copy"
+ svnadmin create "${temporary_directory}/svn-packages-repo"
+ svn checkout -q "file://${temporary_directory}/svn-packages-repo" "${temporary_directory}/svn-packages-copy"
for p in "${pkgdir}"/*; do
pkg=$(basename $p)
- mkdir -p "${TMP}/svn-packages-copy/${pkg}"/{trunk,repos}
- cp "${p}"/* "${TMP}/svn-packages-copy"/${pkg}/trunk/
- svn add -q "${TMP}/svn-packages-copy"/${pkg}
- svn commit -q -m"initial commit of ${pkg}" "${TMP}/svn-packages-copy"
+ mkdir -p "${temporary_directory}/svn-packages-copy/${pkg}"/{trunk,repos}
+ cp "${p}"/* "${temporary_directory}/svn-packages-copy"/${pkg}/trunk/
+ svn add -q "${temporary_directory}/svn-packages-copy"/${pkg}
+ svn commit -q -m"initial commit of ${pkg}" "${temporary_directory}/svn-packages-copy"
done
cat <<eot > "$(dirname ${BASH_SOURCE[0]})/../../config.local"
- root_dir="${TMP}/ftp"
- SVNREPO="file://${TMP}/svn-packages-repo"
+ root_dir="${temporary_directory}/ftp"
+ SVN_repository="file://${temporary_directory}/svn-packages-repo"
PKGREPOS=(${PKGREPOS[@]})
PKGPOOL="${PKGPOOL}"
- CLEANUP_DESTDIR="${TMP}/package-cleanup"
- SOURCE_CLEANUP_DESTDIR="${TMP}/source-cleanup"
- STAGING="${TMP}/staging"
- TMPDIR="${TMP}/tmp"
- CLEANUP_DRYRUN=false
- SOURCE_CLEANUP_DRYRUN=false
- REQUIRE_SIGNATURE=true
+ cleanup_destination_directory="${temporary_directory}/package-cleanup"
+ source_cleanup_destination_directory="${temporary_directory}/source-cleanup"
+ staging_directory="${temporary_directory}/staging"
+ temporary_directory="${temporary_directory}/tmp"
+ cleanup_dryrun=false
+ source_cleanup_dryrun=false
+ require_signature=true
eot
. "$(dirname ${BASH_SOURCE[0]})/../../config"
}
tearDown() {
- rm -rf "${TMP}"
+ rm -rf "${temporary_directory}"
rm -f "$(dirname ${BASH_SOURCE[0]})/../../config.local"
echo
}
@@ -111,16 +111,16 @@ releasePackage() {
local pkgbase=$2
local arch=$3
- pushd "${TMP}/svn-packages-copy"/${pkgbase}/trunk/ >/dev/null
+ pushd "${temporary_directory}/svn-packages-copy"/${pkgbase}/trunk/ >/dev/null
archrelease ${repo}-${arch} >/dev/null 2&>1
pkgver=$(. PKGBUILD; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}))
popd >/dev/null
- cp "${pkgdir}/${pkgbase}"/*-${pkgver}-${arch}${PKGEXT} "${STAGING}"/${repo}/
+ cp "${pkgdir}/${pkgbase}"/*-${pkgver}-${arch}${package_extension_suffixfile} "${staging_directory}"/${repo}/
- if ${REQUIRE_SIGNATURE}; then
+ if ${require_signature}; then
# TODO: really sign the packages with a valid key
- find "${STAGING}"/${repo}/ -type f \
- -name "*-${pkgver}-${arch}${PKGEXT}" \
+ find "${staging_directory}"/${repo}/ -type f \
+ -name "*-${pkgver}-${arch}${package_extension_suffixfile}" \
-exec touch {}.sig \;
fi
}
@@ -132,7 +132,7 @@ checkAnyPackageDB() {
local db
[ -r "${root_dir}/${PKGPOOL}/${pkg}" ] || fail "${PKGPOOL}/${pkg} not found"
- if ${REQUIRE_SIGNATURE}; then
+ if ${require_signature}; then
[ -r "${root_dir}/${PKGPOOL}/${pkg}.sig" ] || fail "${PKGPOOL}/${pkg}.sig not found"
fi
@@ -141,16 +141,16 @@ checkAnyPackageDB() {
[ "$(readlink -e "${root_dir}/${repo}/os/${arch}/${pkg}")" == "${root_dir}/${PKGPOOL}/${pkg}" ] \
|| fail "${repo}/os/${arch}/${pkg} does not link to ${PKGPOOL}/${pkg}"
- if ${REQUIRE_SIGNATURE}; then
+ if ${require_signature}; then
[ -L "${root_dir}/${repo}/os/${arch}/${pkg}.sig" ] || fail "${repo}/os/${arch}/${pkg}.sig is not a symlink"
[ "$(readlink -e "${root_dir}/${repo}/os/${arch}/${pkg}.sig")" == "${root_dir}/${PKGPOOL}/${pkg}.sig" ] \
|| fail "${repo}/os/${arch}/${pkg}.sig does not link to ${PKGPOOL}/${pkg}.sig"
fi
done
- [ -r "${STAGING}"/${repo}/${pkg} ] && fail "${repo}/${pkg} found in staging dir"
- [ -r "${STAGING}"/${repo}/${pkg}.sig ] && fail "${repo}/${pkg}.sig found in staging dir"
+ [ -r "${staging_directory}"/${repo}/${pkg} ] && fail "${repo}/${pkg} found in staging directory"
+ [ -r "${staging_directory}"/${repo}/${pkg}.sig ] && fail "${repo}/${pkg}.sig found in staging directory"
- for db in ${DBEXT} ${FILESEXT}; do
+ for db in ${database_extension_suffixfile} ${files_extension_suffixfile}; do
( [ -r "${root_dir}/${repo}/os/${arch}/${repo}${db%.tar.*}" ] \
&& bsdtar -xf "${root_dir}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep -q ${pkg}) \
|| fail "${pkg} not in ${repo}/os/${arch}/${repo}${db%.tar.*}"
@@ -167,8 +167,8 @@ checkAnyPackage() {
checkAnyPackageDB $repo $pkg
local pkgbase=$(getpkgbase "${root_dir}/${PKGPOOL}/${pkg}")
- svn up -q "${TMP}/svn-packages-copy/${pkgbase}"
- [ -d "${TMP}/svn-packages-copy/${pkgbase}/repos/${repo}-any" ] \
+ svn up -q "${temporary_directory}/svn-packages-copy/${pkgbase}"
+ [ -d "${temporary_directory}/svn-packages-copy/${pkgbase}/repos/${repo}-any" ] \
|| fail "svn-packages-copy/${pkgbase}/repos/${repo}-any does not exist"
}
@@ -180,21 +180,21 @@ checkPackageDB() {
[ -r "${root_dir}/${PKGPOOL}/${pkg}" ] || fail "${PKGPOOL}/${pkg} not found"
[ -L "${root_dir}/${repo}/os/${arch}/${pkg}" ] || fail "${repo}/os/${arch}/${pkg} not a symlink"
- [ -r "${STAGING}"/${repo}/${pkg} ] && fail "${repo}/${pkg} found in staging dir"
+ [ -r "${staging_directory}"/${repo}/${pkg} ] && fail "${repo}/${pkg} found in staging directory"
[ "$(readlink -e "${root_dir}/${repo}/os/${arch}/${pkg}")" == "${root_dir}/${PKGPOOL}/${pkg}" ] \
|| fail "${repo}/os/${arch}/${pkg} does not link to ${PKGPOOL}/${pkg}"
- if ${REQUIRE_SIGNATURE}; then
+ if ${require_signature}; then
[ -r "${root_dir}/${PKGPOOL}/${pkg}.sig" ] || fail "${PKGPOOL}/${pkg}.sig not found"
[ -L "${root_dir}/${repo}/os/${arch}/${pkg}.sig" ] || fail "${repo}/os/${arch}/${pkg}.sig is not a symlink"
- [ -r "${STAGING}"/${repo}/${pkg}.sig ] && fail "${repo}/${pkg}.sig found in staging dir"
+ [ -r "${staging_directory}"/${repo}/${pkg}.sig ] && fail "${repo}/${pkg}.sig found in staging directory"
[ "$(readlink -e "${root_dir}/${repo}/os/${arch}/${pkg}.sig")" == "${root_dir}/${PKGPOOL}/${pkg}.sig" ] \
|| fail "${repo}/os/${arch}/${pkg}.sig does not link to ${PKGPOOL}/${pkg}.sig"
fi
- for db in ${DBEXT} ${FILESEXT}; do
+ for db in ${database_extension_suffixfile} ${files_extension_suffixfile}; do
( [ -r "${root_dir}/${repo}/os/${arch}/${repo}${db%.tar.*}" ] \
&& bsdtar -xf "${root_dir}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep -q ${pkg}) \
|| fail "${pkg} not in ${repo}/os/${arch}/${repo}${db%.tar.*}"
@@ -209,8 +209,8 @@ checkPackage() {
checkPackageDB $repo $pkg $arch
local pkgbase=$(getpkgbase "${root_dir}/${PKGPOOL}/${pkg}")
- svn up -q "${TMP}/svn-packages-copy/${pkgbase}"
- [ -d "${TMP}/svn-packages-copy/${pkgbase}/repos/${repo}-${arch}" ] \
+ svn up -q "${temporary_directory}/svn-packages-copy/${pkgbase}"
+ [ -d "${temporary_directory}/svn-packages-copy/${pkgbase}/repos/${repo}-${arch}" ] \
|| fail "svn-packages-copy/${pkgbase}/repos/${repo}-${arch} does not exist"
}
@@ -220,7 +220,7 @@ checkRemovedPackageDB() {
local arch=$3
local db
- for db in ${DBEXT} ${FILESEXT}; do
+ for db in ${database_extension_suffixfile} ${files_extension_suffixfile}; do
( [ -r "${root_dir}/${repo}/os/${arch}/${repo}${db%.tar.*}" ] \
&& bsdtar -xf "${root_dir}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep -q ${pkgbase}) \
&& fail "${pkgbase} should not be in ${repo}/os/${arch}/${repo}${db%.tar.*}"
@@ -234,8 +234,8 @@ checkRemovedPackage() {
checkRemovedPackageDB $repo $pkgbase $arch
- svn up -q "${TMP}/svn-packages-copy/${pkgbase}"
- [ -d "${TMP}/svn-packages-copy/${pkgbase}/repos/${repo}-${arch}" ] \
+ svn up -q "${temporary_directory}/svn-packages-copy/${pkgbase}"
+ [ -d "${temporary_directory}/svn-packages-copy/${pkgbase}/repos/${repo}-${arch}" ] \
&& fail "svn-packages-copy/${pkgbase}/repos/${repo}-${arch} should not exist"
}
@@ -245,7 +245,7 @@ checkRemovedAnyPackageDB() {
local arch
local db
- for db in ${DBEXT} ${FILESEXT}; do
+ for db in ${database_extension_suffixfile} ${files_extension_suffixfile}; do
for arch in i686 x86_64; do
( [ -r "${root_dir}/${repo}/os/${arch}/${repo}${db%.tar.*}" ] \
&& bsdtar -xf "${root_dir}/${repo}/os/${arch}/${repo}${db%.tar.*}" -O | grep -q ${pkgbase}) \
@@ -260,7 +260,7 @@ checkRemovedAnyPackage() {
checkRemovedAnyPackageDB $repo $pkgbase
- svn up -q "${TMP}/svn-packages-copy/${pkgbase}"
- [ -d "${TMP}/svn-packages-copy/${pkgbase}/repos/${repo}-any" ] \
+ svn up -q "${temporary_directory}/svn-packages-copy/${pkgbase}"
+ [ -d "${temporary_directory}/svn-packages-copy/${pkgbase}/repos/${repo}-any" ] \
&& fail "svn-packages-copy/${pkgbase}/repos/${repo}-any should not exist"
}
diff --git a/test/lib/shunit2 b/test/lib/shunit2
index 8862ffd..1462562 100755
--- a/test/lib/shunit2
+++ b/test/lib/shunit2
@@ -698,7 +698,7 @@ _shunit_mktempDir()
_shunit_random_=`expr ${_shunit_date_} / $$`
fi
- _shunit_tmpDir_="${TMPDIR:-/tmp}/shunit.${_shunit_random_}"
+ _shunit_tmpDir_="${temporary_directory:-/tmp}/shunit.${_shunit_random_}"
( umask 077 && mkdir "${_shunit_tmpDir_}" ) || \
_shunit_fatal 'could not create temporary directory! exiting'
@@ -995,8 +995,8 @@ __shunit_tmpDir=`_shunit_mktempDir`
# provide a public temporary directory for unit test scripts
# TODO(kward): document this
-SHUNIT_TMPDIR="${__shunit_tmpDir}/tmp"
-mkdir "${SHUNIT_TMPDIR}"
+SHUNIT_temporary_directory="${__shunit_tmpDir}/tmp"
+mkdir "${SHUNIT_temporary_directory}"
# setup traps to clean up after ourselves
trap '_shunit_cleanup EXIT' 0
@@ -1008,10 +1008,10 @@ _shunit_mktempFunc
PATH="${__shunit_tmpDir}:${PATH}"
# make sure phantom functions are executable. this will bite if /tmp (or the
-# current $TMPDIR) points to a path on a partition that was mounted with the
+# current $temporary_directory) points to a path on a partition that was mounted with the
# 'noexec' option. the noexec command was created with _shunit_mktempFunc().
noexec 2>/dev/null || _shunit_fatal \
- 'please declare TMPDIR with path on partition with exec permission'
+ 'please declare temporary_directory with path on partition with exec permission'
# we must manually source the tests in standalone mode
if [ "${__shunit_mode}" = "${__SHUNIT_MODE_STANDALONE}" ]; then