export MSGLEVEL=4
elif [ "$1" = '--color=no' ]; then
export MSGCOLOR='NO'
+ elif [ "$1" = '--color=yes' ]; then
+ export MSGCOLOR='YES'
+ elif [ "$1" = '--color' ]; then
+ export MSGCOLOR="$(echo "$2" | tr 'a-z' 'A-Z')"
+ shift
+ elif [ "$1" = '--level' ]; then
+ export MSGLEVEL=$2
+ shift
else
echo >&2 "WARNING: Unknown parameter »$1« will be ignored"
fi
export MSGLEVEL="${MSGLEVEL:-3}"
# we all like colorful messages
-if [ "$MSGCOLOR" != 'NO' ] && [ "$MSGCOLOR" != 'ALWAYS' ]; then
+if [ "${MSGCOLOR:-YES}" = 'YES' ]; then
if [ ! -t 1 ]; then # but check that we output to a terminal
export MSGCOLOR='NO'
fi
TEST_DEFAULT_GROUP="$USER"
fi
- # Acquire::AllowInsecureRepositories=false is not yet the default
- # but we want it to be the default soon
- configallowinsecurerepositories "false";
-
# cleanup the environment a bit
- # prefer our apt binaries over the system apt binaries
+ # prefer our apt binaries over the system apt binaries
export PATH="${BUILDDIRECTORY}:${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
export LC_ALL=C.UTF-8
unset LANGUAGE APT_CONFIG
EOF
testsuccess --nomsg gcc -fPIC -shared -o noopchroot.so noopchroot.c -ldl
}
-
-configallowinsecurerepositories() {
- echo "Acquire::AllowInsecureRepositories \"$1\";" > rootdir/etc/apt/apt.conf.d/allow-insecure-repositories.conf
-
-}
-
configcompression() {
while [ -n "$1" ]; do
case "$1" in
rewritesourceslist() {
local APTARCHIVE="file://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')"
+ local APTARCHIVE2="copy://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')"
for LIST in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do
- sed -i $LIST -e "s#$APTARCHIVE#${1}#" -e "s#http://localhost:${APTHTTPPORT}/#${1}#" -e "s#https://localhost:${APTHTTPSPORT}/#${1}#"
+ sed -i $LIST -e "s#$APTARCHIVE#${1}#" -e "s#$APTARCHIVE2#${1}#" \
+ -e "s#http://localhost:${APTHTTPPORT}/#${1}#" \
+ -e "s#https://localhost:${APTHTTPSPORT}/#${1}#"
done
}
testfailure "$@"
msgtest 'Check that the output of the previous failed command has expected' 'failures and warnings'
local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.comparefile"
- grep '^\(W\|E\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true
+ grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true
+ testoutputequal "$COMPAREFILE" echo "$CMP"
+ msggroup
+}
+testwarningmsg() {
+ msggroup 'testwarningmsg'
+ local CMP="$1"
+ shift
+ testwarning "$@"
+ msgtest 'Check that the output of the previous warned command has expected' 'warnings'
+ local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarningmsg.comparefile"
+ grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" > "$COMPAREFILE" 2>&1 || true
testoutputequal "$COMPAREFILE" echo "$CMP"
msggroup
}