summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/integration/framework16
-rwxr-xr-xtest/integration/test-apt-key8
2 files changed, 21 insertions, 3 deletions
diff --git a/test/integration/framework b/test/integration/framework
index 07b1f3236..8d0c9f5c3 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -54,7 +54,7 @@ msgprintf() {
printf "$START " "$1"
shift
while [ -n "$1" ]; do
- printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cfghs]\)#apt-\1#')"
+ printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cfghks]\)#apt-\1#')"
shift
done
fi
@@ -245,13 +245,23 @@ addtrap() {
trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
}
+escape_shell() {
+ echo "$@" | sed -e "s#'#'\"'\"'#g"
+}
+
setupenvironment() {
# privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir)
if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$(stat --format '%a' "$TMPDIR")" != '1777' ]; then
unset TMPDIR
fi
TMPWORKINGDIRECTORY="$(mktemp -d)"
- addtrap "cd /; rm -rf \"$TMPWORKINGDIRECTORY\";"
+ addtrap "cd /; rm -rf '$(escape_shell "$TMPWORKINGDIRECTORY")';"
+ if [ -n "$TMPDIR_ADD" ]; then
+ TMPWORKINGDIRECTORY="${TMPWORKINGDIRECTORY}/${TMPDIR_ADD}"
+ mkdir -p "$TMPWORKINGDIRECTORY"
+ unset TMPDIR_ADD
+ export TMPDIR="$TMPWORKINGDIRECTORY"
+ fi
msgninfo "Preparing environment for ${0##*/} in ${TMPWORKINGDIRECTORY}…"
mkdir -m 700 "${TMPWORKINGDIRECTORY}/downloaded"
@@ -1254,7 +1264,7 @@ EOF
# start with an unmounted disk
mv "${CD}" "${CD}-unmounted"
# we don't want the disk to be modifiable
- addtrap 'prefix' "chmod -f -R +w \"$PWD/rootdir/media/cdrom/dists/\" \"$PWD/rootdir/media/cdrom-unmounted/dists/\" || true;"
+ addtrap 'prefix' "chmod -f -R +w '$(escape_shell "$PWD/rootdir/media/cdrom/dists/")' '$(escape_shell "$PWD/rootdir/media/cdrom-unmounted/dists/")' || true;"
chmod -R 555 rootdir/media/cdrom-unmounted/dists
}
diff --git a/test/integration/test-apt-key b/test/integration/test-apt-key
index 6a4e0d867..7a2849b4e 100755
--- a/test/integration/test-apt-key
+++ b/test/integration/test-apt-key
@@ -1,6 +1,13 @@
#!/bin/sh
set -e
+# apt-key is a shell script, so relatively prune to be effected by 'crazy' things:
+# confuses config parser as there exists no way of escaping " currently.
+#TMPDIR="$(mktemp -d)/This is \"fü\$\$ing cràzy\", \$(man man | head -n1 | cut -d' ' -f 1)\$!"
+# gpg doesn't like | in path names – documented e.g. in the man gpg2 --agent-program
+#TMPDIR="$(mktemp -d)/This is fü\$\$ing cràzy, \$(man man | head -n1 | cut -d' ' -f 1)\$!"
+TMPDIR_ADD="This is fü\$\$ing cràzy, \$(apt -v)\$!"
+
TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"
@@ -187,6 +194,7 @@ gpg: unchanged: 1' aptkey --fakeroot update
echo 'Verify me. This is my signature.' > signature
testsuccess --nomsg aptkey --quiet --keyring keys/marvinparanoid.pub --secret-keyring keys/marvinparanoid.sec --readonly \
adv --batch --yes --default-key 'Marvin' --armor --detach-sign --sign --output signature.gpg signature
+ testsuccess test -s signature.gpg -a -s signature
for GPGV in '' 'gpgv' 'gpgv2'; do