From 0479205d5869805da3122e2683d2e5ecd0058815 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 25 Jan 2016 19:14:37 +0100 Subject: fix tests run via sudo checking the history file Git-Dch: Ignore --- test/integration/test-apt-get-autoremove | 5 ++++- test/integration/test-bug-611729-mark-as-manual | 8 +++++++- test/integration/test-disappearing-packages | 13 ++++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/test/integration/test-apt-get-autoremove b/test/integration/test-apt-get-autoremove index 8d4516582..7a28c51f1 100755 --- a/test/integration/test-apt-get-autoremove +++ b/test/integration/test-apt-get-autoremove @@ -59,7 +59,10 @@ testsuccess aptget autoremove -y testdpkgnotinstalled 'po-debconf' testmarkedauto -sed rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' -e 's#), #)\nInstall: #g' | sort -u > apt-history.log +sed rootdir/var/log/apt/history.log -e '/^Commandline: / d' \ + -e '/^Start-Date: / d' -e '/^End-Date: / d' \ + -e '/^Requested-By: / d' \ + -e 's#), #)\nInstall: #g' | sort -u > apt-history.log testfileequal 'apt-history.log' ' Install: debhelper:i386 (8.0.0) Install: po-debconf:i386 (1.0.16, automatic) diff --git a/test/integration/test-bug-611729-mark-as-manual b/test/integration/test-bug-611729-mark-as-manual index bd9af32b6..97ef846e3 100755 --- a/test/integration/test-bug-611729-mark-as-manual +++ b/test/integration/test-bug-611729-mark-as-manual @@ -56,8 +56,14 @@ testdpkginstalled b c testmarkedauto 'b' sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' -testfileequal 'rootdir/var/log/apt/history.log' ' +if [ -n "$SUDO_USER" ]; then + testfileequal 'rootdir/var/log/apt/history.log' " +Requested-By: $SUDO_USER ($(id -u "$SUDO_USER")) +Reinstall: b:i386 (1.0)" +else + testfileequal 'rootdir/var/log/apt/history.log' ' Reinstall: b:i386 (1.0)' +fi testsuccessequal 'Reading package lists... Building dependency tree... diff --git a/test/integration/test-disappearing-packages b/test/integration/test-disappearing-packages index b922d2f72..177491d81 100755 --- a/test/integration/test-disappearing-packages +++ b/test/integration/test-disappearing-packages @@ -44,11 +44,22 @@ $CMD 2>&1 | tail -n 4 | diff -u "$COMPAREFILE" - && msgpass || msgfail rm "$COMPAREFILE" sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' -e "s#:$(getarchitecture 'native') #:native #" -testfileequal 'rootdir/var/log/apt/history.log' ' +if [ -n "$SUDO_USER" ]; then + testfileequal 'rootdir/var/log/apt/history.log' " +Requested-By: $SUDO_USER ($(id -u "$SUDO_USER")) +Install: old-pkg:native (1.0) + +Requested-By: $SUDO_USER ($(id -u "$SUDO_USER")) +Install: new-pkg:native (2.0, automatic) +Upgrade: old-pkg:native (1.0, 2.0) +Disappeared: old-pkg (1.0)" +else + testfileequal 'rootdir/var/log/apt/history.log' ' Install: old-pkg:native (1.0) Install: new-pkg:native (2.0, automatic) Upgrade: old-pkg:native (1.0, 2.0) Disappeared: old-pkg (1.0)' +fi testmarkedauto # new-pkg should have get the manual flag from old-pkg -- cgit v1.2.3