]> git.saurik.com Git - apt.git/blobdiff - test/integration/framework
disable updating insecure repositories in apt by default
[apt.git] / test / integration / framework
index 2fb924802ce8ab2f51cad548f1b303a778fe9624..f9bb2e8243c701c881bbef7c67cc2468b1309f99 100644 (file)
@@ -9,6 +9,14 @@ while [ -n "$1" ]; do
                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
@@ -17,7 +25,7 @@ done
 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
@@ -380,12 +388,8 @@ EOF
                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
@@ -498,12 +502,6 @@ int execvp(const char *file, char *const argv[]) {
 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
@@ -1149,8 +1147,11 @@ webserverconfig() {
 
 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
 }
 
@@ -1650,7 +1651,18 @@ testfailuremsg() {
        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
 }