summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-08-14 00:25:57 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-08-14 00:25:57 +0200
commit7d0627b62aa24b970f18d52be8576c314556b680 (patch)
treed6ec1ad792025b3e8971ab9ade510e9c01c842a4
parentf824d95cacb53fc24a775a6a13feb2f8c7ae2ace (diff)
add a small script to automate the task of creating Packages and status
files for tests with "real" problems
-rwxr-xr-xtest/integration/create-test-data33
-rw-r--r--test/integration/framework6
2 files changed, 38 insertions, 1 deletions
diff --git a/test/integration/create-test-data b/test/integration/create-test-data
new file mode 100755
index 000000000..ff9405502
--- /dev/null
+++ b/test/integration/create-test-data
@@ -0,0 +1,33 @@
+#!/bin/sh
+set +e # its okay to fail in these script, most of the time the apt* stuff will generate errors
+
+local TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+BUILDDIRECTORY="${TESTDIR}/../../build/bin"
+
+GENERATE=$1
+CODENAME=$2
+shift 2
+
+WORKDIR=$(mktemp -d)
+trap "rm -rf $WORKDIR" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+touch $WORKDIR/status
+TMPGEN=$WORKDIR/Packages
+export LANG=C
+
+LISTOFPKGS=$(aptget install $* -t $CODENAME -so Dir::state::status=$WORKDIR/status -o Dir::Cache::archives=$WORKDIR -o pkgCacheGen::Essential=none -o APT::Immediate-Configure=0 2> /dev/null | awk '/^Inst/ {print $2}' | sed -e "s#\$#/$CODENAME#")
+aptcache show $LISTOFPKGS --no-all-versions 2> /dev/null > $TMPGEN
+sed -i $TMPGEN \
+ -e '/^ / d' \
+ -e '/^SHA1: / d' -e '/^SHA256: / d' \
+ -e '/^Homepage: / d' -e '/^Tag: / d' \
+ -e '/^Xul-Appid: / d' \
+ -e '/^Status: / d'
+
+if echo "$GENERATE" | grep '^status-' > /dev/null; then
+ sed -i $TMPGEN -e '/^Package: / a\
+Status: install ok installed' \
+ -e '/^Filename: / d' -e '/^Size: / d' -e '/^MD5sum: / d'
+fi
+
+apt-sortpkgs $TMPGEN > $GENERATE
diff --git a/test/integration/framework b/test/integration/framework
index b4e9302e8..f01bb989b 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -36,7 +36,11 @@ msgdone() { if [ "$1" = "debug" -o "$1" = "info" ]; then true; else echo "${CDON
runapt() {
msgdebug "Executing: ${CCMD}$*${CDEBUG} "
- APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
+ if [ -f ./aptconfig.conf ]; then
+ APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
+ else
+ LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
+ fi
}
aptconfig() { runapt apt-config $*; }
aptcache() { runapt apt-cache $*; }