Commit e552f40f authored by Bernhard Link's avatar Bernhard Link

switch test-suite from bash to dash

parent 96f3218a
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
# different tests to check the error messages when accessing
# architectures components or packagetypes...
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
mkdir conf
mkdir package-1.0
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
dodo test ! -d db
mkdir -p conf db pool
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
dodo test ! -e dists
mkdir conf db logs lists
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
# testing with Sources, as they are easier to generate...
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
mkdir conf
cat > conf/distributions <<EOF
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
dodo test ! -d db
mkdir -p conf
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
mkdir test-1
mkdir test-1/debian
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
# first create a fake package with logs and byhand files:
mkdir documentation-9876AD
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
dodo test ! -d db
mkdir -p conf dists
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
dodo test ! -d db
mkdir -p conf dists
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
mkdir conf
cat > conf/options <<EOF
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
mkdir conf
cat >conf/distributions <<EOF
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
mkdir -p conf dists/{c,d}/{main,component}/{source,binary-abacus}
mkdir -p dists/{c,d}/main/{source,binary-abacus}
mkdir -p pool/{main,component}/a/aa pool/{main,component}/b/bb
mkdir -p conf dists/c/main/source
mkdir -p conf dists/d/main/source
mkdir -p conf dists/c/main/binary-abacus
mkdir -p conf dists/d/main/binary-abacus
mkdir -p conf dists/c/component/source
mkdir -p conf dists/d/component/source
mkdir -p conf dists/c/component/binary-abacus
mkdir -p conf dists/d/component/binary-abacus
mkdir -p dists/c/main/source
mkdir -p dists/d/main/source
mkdir -p dists/c/main/binary-abacus
mkdir -p dists/d/main/binary-abacus
mkdir -p pool/main/a/aa pool/component/b/bb
mkdir -p pool/component/a/aa pool/main/b/bb
cat > conf/distributions <<EOF
Codename: c
Components: main component
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
mkdir conf db pool fakes old
mkdir -p dists/sourcedistribution/main/binary-coal
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
if ! which gpg 2>/dev/null ; then
echo "SKIPPED: gpg not found!"
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
mkdir -p gpgtestdir
export GNUPGHOME="`pwd`/gpgtestdir"
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
mkdir -p conf
cat > conf/distributions <<CONFEND
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
dodo test ! -d db
testrun - -b . _versioncompare 0 1 3<<EOF
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
testsuccess
......@@ -65,10 +65,10 @@ if ! [ -x "$REPREPRO" ] ; then
exit 1
fi
function checknolog() {
checknolog() {
dodo test ! -f logs/"$1"
}
function checklog() {
checklog() {
cat > results.log.expected
LOGDATE="$(date +'%Y-%m-%d %H:')"
echo normalizing "$1": DATESTR is "$LOGDATE??:??"
......@@ -76,16 +76,16 @@ function checklog() {
dodiff results.log.expected logs/"$1"
rm logs/"$1"
}
function md5() {
md5() {
md5sum "$1" | cut -d' ' -f1
}
function sha1() {
sha1() {
sha1sum "$1" | cut -d' ' -f1
}
function sha256() {
sha256() {
sha256sum "$1" | cut -d' ' -f1
}
function printindexpart() {
printindexpart() {
FILENAME="$1"
dpkg-deb -I "$FILENAME" control >"$FILENAME".control
ed -s "$FILENAME".control << EOF
......@@ -109,49 +109,49 @@ EOF
cat "$FILENAME".control
rm "$FILENAME".control
}
function withoutchecksums() {
withoutchecksums() {
awk 'BEGIN{inheader=0} /^Checksums-.*: / || (inheader && /^ /) {inheader = 1; next} {inheader = 0 ; print}' "$@"
}
function mdandsize() {
mdandsize() {
cat <<EOF
$(md5sum "$1" | cut -d' ' -f1) $(stat -c "%s" "$1")
EOF
}
function sha() {
sha() {
echo -n ":1:"
sha1sum "$1" | cut -d' ' -f1
}
function sha1andsize() {
sha1andsize() {
cat <<EOF
$(sha1sum "$1" | cut -d' ' -f1) $(stat -c "%s" "$1")
EOF
}
function sha1and7size() {
sha1and7size() {
cat <<EOF
$(sha1sum "$1" | cut -d' ' -f1) $(stat -c "%7s" "$1")
EOF
}
function sha2() {
sha2() {
echo -n ":2:"
sha256sum "$1" | cut -d' ' -f1
}
function sha2andsize() {
sha2andsize() {
cat <<EOF
$(sha256sum "$1" | cut -d' ' -f1) $(stat -c "%s" "$1")
EOF
}
function fullchecksum() {
fullchecksum() {
cat <<EOF
$(sha "$1") $(sha2 "$1") $(md5sum "$1" | cut -d' ' -f1) $(stat -c "%s" "$1")
EOF
}
function md5releaseline() {
md5releaseline() {
echo "$(mdandsize dists/"$1"/"$2") $2"
}
function sha1releaseline() {
sha1releaseline() {
echo "$(sha1andsize dists/"$1"/"$2") $2"
}
function sha2releaseline() {
sha2releaseline() {
echo "$(sha2andsize dists/"$1"/"$2") $2"
}
......@@ -167,7 +167,7 @@ EMPTYSHA2="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0"
EMPTYGZSHA2="59869db34853933b239f1e2219cf7d431da006aa919635478511fabbfc8849d2 20"
EMPTYBZ2SHA2="d3dda84eb03b9738d118eb2be78e246106900493c0ae07819ad60815134a8058 14"
function testsuccess() {
testsuccess() {
echo "Test$TESTNAME completed successfully"
}
......
#!/bin/bash
#!/bin/dash
# This needs installed:
# apt, dpkg-dev, ed, python-apt, lzma
......@@ -149,7 +149,7 @@ number_success=0
number_skipped=0
number_failed=0
function runtest() {
runtest() {
if ! test -f "$SRCDIR/tests/$1.test" ; then
echo "Cannot find $SRCDIR/tests/$1.test!" >&2
number_missing="$(( $number_missing + 1 ))"
......@@ -165,7 +165,7 @@ function runtest() {
export SRCDIR TESTSDIR
export TESTTOOL RREDTOOL REPREPRO
export TRACKINGTESTOPTIONS TESTOPTIONS REPREPROOPTIONS verbosity
WORKDIR="$WORKDIR/dir_$1" CALLEDFROMTESTSUITE=true bash "$SRCDIR/tests/$1.test"
WORKDIR="$WORKDIR/dir_$1" CALLEDFROMTESTSUITE=true dash "$SRCDIR/tests/$1.test"
) > "log_$1" 2>&1 || rc=$?
if test "$rc" -ne 0 ; then
number_failed="$(( $number_failed + 1 ))"
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
dodo test ! -d db
mkdir -p conf
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
# First test if finding the binaries works properly...
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
# test some corner cases in updating:
# IgnoreRelease, force, errors, resuming...
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
mkdir -p conf
cat > conf/distributions <<EOF
......@@ -14,20 +14,20 @@ Architectures: source coal
Uploaders: uploaders2
EOF
function checknonetakes() {
checknonetakes() {
testrun - -b . __checkuploaders test1 test2 < "$1" 3<<EOF
stdout
*='testpackage' would NOT have been accepted by any of the distributions selected.
EOF
}
function check1takes() {
check1takes() {
testrun - -b . __checkuploaders test1 test2 < "$1" 3<<EOF
stdout
*='testpackage' would have been accepted by 'test1'
EOF
}
function check2takes() {
check2takes() {
testrun - -b . __checkuploaders test1 test2 < "$1" 3<<EOF
stdout
*='testpackage' would have been accepted by 'test2'
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
mkdir -p conf
cat > conf/distributions <<EOF
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
echo "Running various other old test..."
mkdir -p conf logs
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
dodo test ! -e dists
mkdir conf db logs lists
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
mkdir gpgtestdir
chmod go-rwx gpgtestdir
......
set -u
source $TESTSDIR/test.inc
. "$TESTSDIR"/test.inc
mkdir conf
cat > conf/distributions <<EOF
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment