summaryrefslogtreecommitdiff
path: root/test/integration/framework
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-10-18 17:48:55 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2014-10-20 10:37:46 +0200
commitde81b2e20f80bb5f42034863a9a974c815a45da5 (patch)
tree4c601ca61dcdd8090adf198fba2191c18d9c87d4 /test/integration/framework
parent12796fa241ad6b0e8ccd1025a3723e18324e17b0 (diff)
aborted reverify restores file owner and permission
If we get an IMS hit for an InRelease file we use the file we already have and pass it into reverification, but this changes the permissions and on abort of the transaction they weren't switched back. This is now done, additionally, every file in partial which hasn't failed gets permission and owner changed for root access as well, as it is very well possible that the next invocation will (re)use these files.
Diffstat (limited to 'test/integration/framework')
-rw-r--r--test/integration/framework54
1 files changed, 32 insertions, 22 deletions
diff --git a/test/integration/framework b/test/integration/framework
index a8d6bf3d0..d692f62a9 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -23,25 +23,32 @@ if [ "$MSGCOLOR" != 'NO' ]; then
CCMD="\033[1;35m" # pink
fi
-msgdie() { printf "${CERROR}E: $1${CNORMAL}\n" >&2; exit 1; }
-msgwarn() { printf "${CWARNING}W: $1${CNORMAL}\n" >&2; }
-msgmsg() { printf "${CMSG}$1${CNORMAL}\n"; }
-msginfo() { printf "${CINFO}I: $1${CNORMAL}\n"; }
-msgdebug() { printf "${CDEBUG}D: $1${CNORMAL}\n"; }
-msgdone() { printf "${CDONE}DONE${CNORMAL}\n"; }
-msgnwarn() { printf "${CWARNING}W: $1${CNORMAL}" >&2; }
-msgnmsg() { printf "${CMSG}$1${CNORMAL}"; }
-msgninfo() { printf "${CINFO}I: $1${CNORMAL}"; }
-msgndebug() { printf "${CDEBUG}D: $1${CNORMAL}"; }
-msgtest() {
- while [ -n "$1" ]; do
- printf "${CINFO}$1${CCMD} "
- printf -- "$(echo "$2" | sed -e 's#^apt\([cgfs]\)#apt-\1#')${CINFO} "
+msgprintf() {
+ local START="$1"
+ local MIDDLE="$2"
+ local END="$3"
+ shift 3
+ if [ -n "$1" ]; then
+ printf "$START " "$1"
shift
- if [ -n "$1" ]; then shift; else break; fi
- done
- printf "…${CNORMAL} "
+ while [ -n "$1" ]; do
+ printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cgfs]\)#apt-\1#')"
+ shift
+ done
+ fi
+ printf "${END}"
}
+msgdie() { msgprintf "${CERROR}E: %s" '%s' "${CNORMAL}\n" "$@" >&2; exit 1; }
+msgwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}\n" "$@" >&2; }
+msgmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}\n" "$@"; }
+msginfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}\n" "$@"; }
+msgdebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}\n" "$@"; }
+msgdone() { msgprintf "${CDONE}DONE" '%s' "${CNORMAL}\n" "$@"; }
+msgnwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}" "$@" >&2; }
+msgnmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@"; }
+msgninfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}" "$@"; }
+msgndebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}" "$@"; }
+msgtest() { msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@"; }
msgpass() { printf "${CPASS}PASS${CNORMAL}\n"; }
msgskip() {
if [ $# -gt 0 ]; then printf "${CWARNING}SKIP: $*${CNORMAL}\n" >&2;
@@ -1222,18 +1229,21 @@ testfailure() {
fi
}
-testaccessrights() {
- msgtest "Test that file $1 has access rights set to" "$2"
- if [ "$2" = "$(stat --format '%a' "$1")" ]; then
+testfilestats() {
+ msgtest "Test that file $1 has $2 $3" "$4"
+ if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then
msgpass
else
echo >&2
ls -l >&2 "$1"
- echo -n >&2 "stat(1) reports access rights: "
- stat --format '%a' "$1"
+ echo -n >&2 "stat(1) reports for $2: "
+ stat --format "$2" "$1"
msgfail
fi
}
+testaccessrights() {
+ testfilestats "$1" '%a' '=' "$2"
+}
testwebserverlaststatuscode() {
local DOWNLOG='rootdir/tmp/webserverstatus-testfile.log'