summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-04-09 17:18:19 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2017-06-26 23:31:15 +0200
commit0cbe571a44468806af95f3d8661b07b01704eb26 (patch)
tree8bf641d31706f3bbdd94b180eea3eec872ef743a
parente250df1a623fd08f8a5afe2d94bd29a35e872725 (diff)
make the create-test-data script great again
Changes in the past to the buildsystem and the testing framework broke this little helper script – lets fix those problems to restore functionality. Gbp-Dch: Ignore
-rwxr-xr-xtest/integration/create-test-data49
-rw-r--r--test/integration/framework2
2 files changed, 32 insertions, 19 deletions
diff --git a/test/integration/create-test-data b/test/integration/create-test-data
index 7040aaed7..eff2ba530 100755
--- a/test/integration/create-test-data
+++ b/test/integration/create-test-data
@@ -6,42 +6,55 @@ if [ -z "$1" -o -z "$2" ]; then
exit 1
fi
+CHECK_ARGS='no'
TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"
-BUILDDIRECTORY="${TESTDIR}/../../build/bin"
+find_project_binary_dir
+BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"${PROJECT_BINARY_DIR}/cmdline"}"
-GENERATE=$1
-CODENAME=$2
+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#")
+WORKDIR="$(mktemp -d)"
+cleanupworkdir() {
+ if [ -z "$WORKDIR" ]; then return; fi
+ rm -rf "$WORKDIR"
+}
+trap "cleanupworkdir;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+touch "$WORKDIR/status"
+TMPGEN="$WORKDIR/Packages"
+export LANG=C.UTF-8
+
+aptgetinstall() {
+ aptget install "$@" --no-install-recommends -t "$CODENAME" -s \
+ -o Dir::state::status="$WORKDIR/status" \
+ -o Dir::Cache="$WORKDIR" \
+ -o pkgCacheGen::Essential=none \
+ -o APT::Immediate-Configure=0
+}
+LISTOFPKGS="$(aptgetinstall "$@" 2> /dev/null | awk '/^Inst/ {print $2}' | sed -e "s#\$#/$CODENAME#")"
if [ -z "$LISTOFPKGS" ]; then
echo "List of packages is empty: run apt-get install command again for you now"
- aptget install $* -t $CODENAME -so Dir::state::status=$WORKDIR/status -o Dir::Cache::archives=$WORKDIR -o pkgCacheGen::Essential=none -o APT::Immediate-Configure=0
+ aptgetinstall
exit 1
fi
-aptcache show $LISTOFPKGS --no-all-versions 2> $WORKDIR/error.lst > $TMPGEN
-sed -i $TMPGEN \
- -e '/^ / d' \
+aptcache show $LISTOFPKGS --no-all-versions 2> "$WORKDIR/error.lst" | sed -e '/^ / d' \
-e '/^SHA1: / d' -e '/^SHA256: / d' \
-e '/^Homepage: / d' -e '/^Tag: / d' \
-e '/^Xul-Appid: / d' \
- -e '/^Status: / d'
+ -e '/^Status: / d' \
+ -e 's/^Description-en:/Description:/' \
+ > "$TMPGEN"
if [ "$CODENAME" = "experimental" ]; then
- aptcache show $(cat $WORKDIR/error.lst | cut -d"'" -f 4 | sed -e 's#$#/sid#') --no-all-versions 2> /dev/null >> $TMPGEN
+ aptcache show $(cut -d"'" -f 4 "$WORKDIR/error.lst" | sed -e 's#$#/sid#') --no-all-versions 2> /dev/null >> "$TMPGEN"
fi
if echo "$GENERATE" | grep '^status-' > /dev/null; then
- sed -i $TMPGEN -e '/^Package: / a\
+ sed -i "$TMPGEN" -e '/^Package: / a\
Status: install ok installed' \
-e '/^Filename: / d' -e '/^Size: / d' -e '/^MD5sum: / d'
fi
-apt-sortpkgs $TMPGEN > $GENERATE
+apt-sortpkgs "$TMPGEN" > "$GENERATE"
diff --git a/test/integration/framework b/test/integration/framework
index 32e109a77..773d25851 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -2,7 +2,7 @@
EXIT_CODE=0
-while [ -n "$1" ]; do
+while [ -n "$1" -a -z "$CHECK_ARGS" ]; do
if [ "$1" = "-q" ]; then
export MSGLEVEL=2
elif [ "$1" = "-qq" ]; then