From a8b19aeeb885596912fd8b03e082866b897688fd Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 19 Mar 2017 14:27:49 +0100 Subject: Call update from apt-key test for a strange path test We setup a "horrible" environment in the apt-key testcase to check all kinds of things, but we really should be making also at least a simple apt update call, as that in turn will call apt-key which is how apt-key is used in the non-testcase world, so that calling should be able to deal with such environments as well. Gbp-Dch: Ignore --- test/integration/framework | 5 ++++- test/integration/test-apt-key | 13 +++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/test/integration/framework b/test/integration/framework index 7fc69e1c5..32e109a77 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -2059,10 +2059,12 @@ aptautotest_aptget_update() { if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" + ( + cd / # all copied files are properly chmodded local backupIFS="$IFS" IFS="$(printf "\n\b")" - for file in $(find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock'); do + find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | while read file; do testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" done IFS="$backupIFS" @@ -2074,6 +2076,7 @@ aptautotest_aptget_update() { testfileequal "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" \ "$(find "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)" fi + ) } aptautotest_apt_update() { aptautotest_aptget_update "$@"; } aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; } diff --git a/test/integration/test-apt-key b/test/integration/test-apt-key index 4fd1510a2..13afff995 100755 --- a/test/integration/test-apt-key +++ b/test/integration/test-apt-key @@ -12,8 +12,13 @@ TESTDIR="$(readlink -f "$(dirname "$0")")" . "$TESTDIR/framework" setupenvironment +chmod o+x "${TMPWORKINGDIRECTORY}/.." configarchitecture 'amd64' +insertpackage 'unstable' 'bar' 'i386' '1' +insertsource 'unstable' 'foo' 'all' '1' +setupaptarchive --no-update + # start from a clean plate again cleanplate() { rm -rf "${ROOTDIR}/etc/apt/trusted.gpg.d/" "${ROOTDIR}/etc/apt/trusted.gpg" @@ -249,6 +254,10 @@ gpg: unchanged: 1' aptkey --fakeroot update chmod 000 "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.${EXT}" testwarning --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg" "${SIGNATURE}" testwarning aptkey list + # check that apt users see warnings, too + rm -rf "${ROOTDIR}/var/lib/apt/lists" + testwarning apt update + chmod 644 "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.${EXT}" rm -f "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.${EXT}" fi @@ -275,6 +284,10 @@ gpg: unchanged: 1' aptkey --fakeroot update msgtest 'Test verify fails on' 'bad file' testfailure --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg" "${SIGNATURE}2" + + # try to perform an entire update with this gpgv + rm -rf "${ROOTDIR}/var/lib/apt/lists" + testsuccess apt update -o Test::Dir="${ROOTDIR}" done rm -f "${ROOTDIR}/etc/apt/apt.conf.d/00gpgvcmd" -- cgit v1.2.3