]> git.saurik.com Git - apt.git/blobdiff - test/integration/framework
eipp: add Allow-Temporary-Remove-of-Essentials
[apt.git] / test / integration / framework
index 1f843babfdcc3f277482f615795adf04afc79e94..93e17e4548ff346e993746e8b8f25fc73f8483b0 100644 (file)
@@ -191,6 +191,7 @@ aptitude() { runapt aptitude "$@"; }
 aptextracttemplates() { runapt apt-extracttemplates "$@"; }
 aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; }
 aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; }
 aptextracttemplates() { runapt apt-extracttemplates "$@"; }
 aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; }
 aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; }
+aptinternalplaner() { runapt "${APTINTERNALPLANER}" "$@"; }
 
 dpkg() {
        "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@"
 
 dpkg() {
        "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@"
@@ -289,6 +290,7 @@ setupenvironment() {
         APTWEBSERVERBINDIR="${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}"
         APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${BUILDDIRECTORY}/apt-internal-solver"}"
        APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${BUILDDIRECTORY}/apt-dump-solver"}"
         APTWEBSERVERBINDIR="${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}"
         APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${BUILDDIRECTORY}/apt-internal-solver"}"
        APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${BUILDDIRECTORY}/apt-dump-solver"}"
+       APTINTERNALPLANER="${APT_INTEGRATION_TESTS_INTERNAL_PLANER:-"${BUILDDIRECTORY}/apt-internal-planer"}"
        test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first"
         # -----
 
        test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first"
         # -----
 
@@ -302,10 +304,13 @@ setupenvironment() {
        mkdir -p usr/lib/apt
        ln -s "${METHODSDIR}" usr/lib/apt/methods
        if [ "$BUILDDIRECTORY" = "$LIBRARYPATH" ]; then
        mkdir -p usr/lib/apt
        ln -s "${METHODSDIR}" usr/lib/apt/methods
        if [ "$BUILDDIRECTORY" = "$LIBRARYPATH" ]; then
-               mkdir -p usr/lib/apt/solvers
+               mkdir -p usr/lib/apt/solvers usr/lib/apt/planers
                ln -s "${BUILDDIRECTORY}/apt-dump-solver" usr/lib/apt/solvers/dump
                ln -s "${BUILDDIRECTORY}/apt-dump-solver" usr/lib/apt/solvers/dump
+               ln -s "${BUILDDIRECTORY}/apt-dump-solver" usr/lib/apt/planers/dump
                ln -s "${BUILDDIRECTORY}/apt-internal-solver" usr/lib/apt/solvers/apt
                ln -s "${BUILDDIRECTORY}/apt-internal-solver" usr/lib/apt/solvers/apt
+               ln -s "${BUILDDIRECTORY}/apt-internal-planer" usr/lib/apt/planers/apt
                echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" > etc/apt/apt.conf.d/externalsolver.conf
                echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" > etc/apt/apt.conf.d/externalsolver.conf
+               echo "Dir::Bin::Planers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/planers\";" > etc/apt/apt.conf.d/externalplaner.conf
        fi
         # use the autoremove from the BUILDDIRECTORY if its there, otherwise
         # system
        fi
         # use the autoremove from the BUILDDIRECTORY if its there, otherwise
         # system
@@ -339,7 +344,9 @@ setupenvironment() {
        # destroys coverage reporting though, so we disable changing user for the calling gpgv
        echo "Dir::Bin::apt-key \"${BUILDDIRECTORY}/apt-key\";" >> aptconfig.conf
        if [ "$(id -u)" = '0' ]; then
        # destroys coverage reporting though, so we disable changing user for the calling gpgv
        echo "Dir::Bin::apt-key \"${BUILDDIRECTORY}/apt-key\";" >> aptconfig.conf
        if [ "$(id -u)" = '0' ]; then
-               echo 'Binary::gpgv::Debug::NoDropPrivs "true";' >>aptconfig.conf
+               echo 'Binary::gpgv::APT::Sandbox::User "root";' >> aptconfig.conf
+               # same for the solver executables
+               echo 'APT::Solver::RunAsUser "root";' >> aptconfig.conf
        fi
 
        cat > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <<EOF
        fi
 
        cat > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <<EOF
@@ -421,6 +428,9 @@ EOF
                echo 'Acquire::gpgv::Options { "--weak-digest"; "sha1"; };' > rootdir/etc/apt/apt.conf.d/no-sha1
        fi
 
                echo 'Acquire::gpgv::Options { "--weak-digest"; "sha1"; };' > rootdir/etc/apt/apt.conf.d/no-sha1
        fi
 
+       # most tests just need one signed Release file, not both
+       export APT_DONT_SIGN='Release.gpg'
+
        msgdone "info"
 }
 
        msgdone "info"
 }
 
@@ -534,6 +544,10 @@ EOF
        testempty --nomsg gcc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c -ldl
 }
 configcompression() {
        testempty --nomsg gcc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c -ldl
 }
 configcompression() {
+       if [ "$1" = 'ALL' ]; then
+               configcompression '.' $(aptconfig dump APT::Compressor --format '%t %v%n' | sed -n 's#^Extension \.\(.*\)$#\1#p')
+               return
+       fi
        local CMD='apthelper cat-file -C'
        while [ -n "$1" ]; do
                case "$1" in
        local CMD='apthelper cat-file -C'
        while [ -n "$1" ]; do
                case "$1" in
@@ -958,7 +972,7 @@ buildaptarchivefromfiles() {
 }
 
 compressfile() {
 }
 
 compressfile() {
-       cat "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" | while read compressor extension command; do
+       while read compressor extension command; do
                if [ "$compressor" = '.' ]; then
                        if [ -n "$2" ]; then
                                touch -d "$2" "$1"
                if [ "$compressor" = '.' ]; then
                        if [ -n "$2" ]; then
                                touch -d "$2" "$1"
@@ -969,7 +983,7 @@ compressfile() {
                if [ -n "$2" ]; then
                        touch -d "$2" "${1}.${extension}"
                fi
                if [ -n "$2" ]; then
                        touch -d "$2" "${1}.${extension}"
                fi
-       done
+       done < "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf"
 }
 
 # can be overridden by testcases for their pleasure
 }
 
 # can be overridden by testcases for their pleasure
@@ -1694,8 +1708,9 @@ testfailure() {
                local EXITCODE=$?
                if expr match "$1" '^apt.*' >/dev/null; then
                        if [ "$1" = 'aptkey' ]; then
                local EXITCODE=$?
                if expr match "$1" '^apt.*' >/dev/null; then
                        if [ "$1" = 'aptkey' ]; then
-                               if grep -q -E " Can't check signature: " "$OUTPUT" || \
-                                       grep -q -E " BAD signature from " "$OUTPUT"; then
+                               if grep -q " Can't check signature: 
+ BAD signature from 
+ signature could not be verified" "$OUTPUT"; then
                                        msgpass
                                else
                                        msgfailoutput "run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@"
                                        msgpass
                                else
                                        msgfailoutput "run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@"