]> git.saurik.com Git - apt.git/blobdiff - test/integration/framework
travis: add ppa:ubuntu-toolschain-r/test as source for gcc-5
[apt.git] / test / integration / framework
index 5d949009fc61e0f117459526e10e4ec8765ef986..b443f2a7b48432d03901fe37f7e1d991f8513b38 100644 (file)
@@ -99,10 +99,14 @@ msgdone() {
 }
 getaptconfig() {
        if [ -f ./aptconfig.conf ]; then
-            echo "./aptconfig.conf"
+               echo "$(readlink -f ./aptconfig.conf)"
        elif [ -f ../aptconfig.conf ]; then
-            echo "../aptconfig.conf"
-        fi
+               echo "$(readlink -f ../aptconfig.conf)"
+       elif [ -f ../../aptconfig.conf ]; then
+               echo "$(readlink -f ../../aptconfig.conf)"
+       elif [ -f "${TMPWORKINGDIRECTORY}/aptconfig.conf" ]; then
+               echo "$(readlink -f "${TMPWORKINGDIRECTORY}/aptconfig.conf")"
+       fi
 }
 runapt() {
        msgdebug "Executing: ${CCMD}$*${CDEBUG} "
@@ -141,8 +145,11 @@ gdb() {
        case "$1" in
        aptget) CMD="apt-get";;
        aptcache) CMD="apt-cache";;
+       aptcdrom) CMD="apt-cdrom";;
+       aptconfig) CMD="apt-config";;
        aptmark) CMD="apt-mark";;
        apthelper) CMD="apt-helper";;
+       aptftparchive) CMD="apt-ftparchive";;
        *) CMD="$1";;
        esac
        shift
@@ -563,10 +570,12 @@ echo '$NAME says \"Hello!\"'" > ${BUILDDIR}/${NAME}
 
  -- Joe Sixpack <joe@example.org>  $(date -R)" > ${BUILDDIR}/debian/changelog
        echo "Source: $NAME
-Section: $SECTION
 Priority: $PRIORITY
 Maintainer: Joe Sixpack <joe@example.org>
 Standards-Version: 3.9.3" > ${BUILDDIR}/debian/control
+       if [ "$SECTION" != '<none>' ]; then
+               echo "Section: $SECTION" >> ${BUILDDIR}/debian/control
+       fi
        local BUILDDEPS="$(echo "$DEPENDENCIES" | grep '^Build-')"
        test -z "$BUILDDEPS" || echo "$BUILDDEPS" >> ${BUILDDIR}/debian/control
        echo "
@@ -1289,7 +1298,7 @@ testdpkgstatus() {
        local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)"
        if [ "$PKGS" != $NR ]; then
                echo >&2 $PKGS
-               dpkg -l "$@" | grep '^[a-z]' >&2
+               dpkg -l "$@" | grep '^[a-z]' >&2 || true
                msgfail
        else
                msgpass
@@ -1315,6 +1324,17 @@ testmarkedauto() {
        fi
        aptmark showauto 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
 }
+testmarkedmanual() {
+       local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile"
+       if [ -n "$1" ]; then
+               msgtest 'Test for correctly marked as manually installed' "$*"
+               while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE
+       else
+               msgtest 'Test for correctly marked as manually installed' 'no package'
+               echo -n > $COMPAREFILE
+       fi
+       aptmark showmanual 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
+}
 
 msgfailoutput() {
        local MSG="$1"
@@ -1357,8 +1377,17 @@ testsuccess() {
                if expr match "$1" '^apt.*' >/dev/null; then
                        if grep -q -E ' runtime error: ' "$OUTPUT"; then
                                msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@"
-                       elif grep -q -E '^[WE]: ' "$OUTPUT"; then
-                               msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@"
+                       elif grep -E '^[WE]: ' "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then
+                               if [ "$IGNORE_PTY_NOT_MOUNTED" = '1' ]; then
+                                       if echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)' \
+                                               | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then
+                                               msgpass
+                                       else
+                                               msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@"
+                                       fi
+                               else
+                                       msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@"
+                               fi
                        else
                                msgpass
                        fi
@@ -1413,12 +1442,23 @@ testfailure() {
        else
                local EXITCODE=$?
                if expr match "$1" '^apt.*' >/dev/null; then
-                       if grep -q -E ' runtime error: ' "$OUTPUT"; then
-                               msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@"
-                       elif ! grep -q -E '^E: ' "$OUTPUT"; then
-                               msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@"
+                       if [ "$1" = 'aptkey' ]; then
+                               if grep -q -E " Can't check signature: " "$OUTPUT" || \
+                                       grep -q -E " BAD signature from " "$OUTPUT"; then
+                                       msgpass
+                               else
+                                       msgfailoutput "run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@"
+                               fi
                        else
-                               msgpass
+                               if grep -q -E ' runtime error: ' "$OUTPUT"; then
+                                       msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@"
+                               elif grep -q -E '==ERROR' "$OUTPUT"; then
+                                       msgfailoutput 'compiler sanitizers reported errors' "$OUTPUT" "$@"
+                               elif ! grep -q -E '^E: ' "$OUTPUT"; then
+                                       msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@"
+                               else
+                                       msgpass
+                               fi
                        fi
                else
                        msgpass