diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/integration/test-apt-cli-list | 27 | ||||
-rwxr-xr-x | test/integration/test-apt-get-changelog | 4 | ||||
-rwxr-xr-x | test/integration/test-apt-progress-fd | 71 | ||||
-rwxr-xr-x | test/integration/test-apt-progress-fd-deb822 | 23 | ||||
-rwxr-xr-x | test/integration/test-apt-progress-fd-error | 4 | ||||
-rwxr-xr-x | test/integration/test-bug-624218-Translation-file-handling | 70 | ||||
-rwxr-xr-x | test/integration/test-bug-722207-print-uris-even-if-very-quiet | 2 | ||||
-rwxr-xr-x | test/integration/test-frontend-lock | 80 | ||||
-rwxr-xr-x | test/integration/test-no-fds-leaked-to-maintainer-scripts | 37 |
9 files changed, 252 insertions, 66 deletions
diff --git a/test/integration/test-apt-cli-list b/test/integration/test-apt-cli-list index 8928a4856..3a9ca2c15 100755 --- a/test/integration/test-apt-cli-list +++ b/test/integration/test-apt-cli-list @@ -5,7 +5,7 @@ TESTDIR="$(readlink -f "$(dirname "$0")")" . "$TESTDIR/framework" setupenvironment -configarchitecture "i386" +configarchitecture 'i386' 'armel' insertpackage 'unstable' 'foo' 'all' '1.0' insertinstalledpackage 'bar' 'i386' '1.0' @@ -17,6 +17,10 @@ insertinstalledpackage 'baz' 'all' '0.1' insertpackage 'testing' 'baz' 'all' '1.0' insertpackage 'unstable' 'baz' 'all' '2.0' +insertinstalledpackage 'foreign' 'armel' '1.0' 'Multi-Arch: foreign' +insertpackage 'unstable' 'foreign' 'i386,armel' '2.0' 'Multi-Arch: foreign' +insertpackage 'unstable' 'lib' 'i386,armel' '2.0' 'Multi-Arch: same' + setupaptarchive testsuccessequal "Listing... @@ -24,7 +28,11 @@ bar/now 1.0 i386 [installed,local] baz/unstable 2.0 all [upgradable from: 0.1] dpkg/now 1.16.2+fake all [installed,local] foo/unstable 1.0 all -foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list +foobar/unstable 2.0 i386 [upgradable from: 1.0] +foreign/unstable 2.0 armel [upgradable from: 1.0] +foreign/unstable 2.0 i386 +lib/unstable 2.0 armel +lib/unstable 2.0 i386" apt list testsuccessequal "Listing... foo/unstable 1.0 all @@ -32,7 +40,8 @@ foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list "foo*" testsuccessequal "Listing... baz/unstable 2.0 all [upgradable from: 0.1] -foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list --upgradable +foobar/unstable 2.0 i386 [upgradable from: 1.0] +foreign/unstable 2.0 armel [upgradable from: 1.0]" apt list --upgradable # FIXME: hm, hm - does it make sense to have this different? shouldn't # we use "installed,upgradable" consistently? @@ -40,7 +49,8 @@ testsuccessequal "Listing... bar/now 1.0 i386 [installed,local] baz/now 0.1 all [installed,upgradable to: 2.0] dpkg/now 1.16.2+fake all [installed,local] -foobar/now 1.0 i386 [installed,upgradable to: 2.0]" apt list --installed +foobar/now 1.0 i386 [installed,upgradable to: 2.0] +foreign/now 1.0 armel [installed,upgradable to: 2.0]" apt list --installed testsuccessequal "Listing... bar/now 1.0 i386 [installed,local] @@ -72,3 +82,12 @@ baz/now 0.1 all [installed,upgradable to: 2.0] # test format strings for machine parseable output testsuccessequal 'bar - 1.0 - 1.0 baz - 0.1 - 2.0' apt list -qq bar baz -o APT::Cmd::use-format=true -o APT::Cmd::format="\${Package} - \${installed:Version} - \${candidate:Version}" + + +insertinstalledpackage 'lib' 'i386,armel' '1.0' 'Multi-Arch: same' +testsuccessequal 'Listing... +baz/unstable 2.0 all [upgradable from: 0.1] +foobar/unstable 2.0 i386 [upgradable from: 1.0] +foreign/unstable 2.0 armel [upgradable from: 1.0] +lib/unstable 2.0 armel [upgradable from: 1.0] +lib/unstable 2.0 i386 [upgradable from: 1.0]' apt list --upgradeable diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog index 2a632d6db..15c3dd50f 100755 --- a/test/integration/test-apt-get-changelog +++ b/test/integration/test-apt-get-changelog @@ -18,8 +18,8 @@ setupaptarchive --no-update changetowebserver testsuccess aptget update -testsuccessequal "'http://metadata.ftp-master.debian.org/changelogs/main/f/foo/foo_1.0_changelog' foo.changelog -'http://metadata.ftp-master.debian.org/changelogs/main/libb/libbar/libbar_1.0_changelog' libbar.changelog" aptget changelog foo libbar --print-uris +testsuccessequal "'https://metadata.ftp-master.debian.org/changelogs/main/f/foo/foo_1.0_changelog' foo.changelog +'https://metadata.ftp-master.debian.org/changelogs/main/libb/libbar/libbar_1.0_changelog' libbar.changelog" aptget changelog foo libbar --print-uris releasechanger() { # modifying the Release files in lists… bad stuff. Good that this is only a test… diff --git a/test/integration/test-apt-progress-fd b/test/integration/test-apt-progress-fd index 57728ca81..4c19a7b00 100755 --- a/test/integration/test-apt-progress-fd +++ b/test/integration/test-apt-progress-fd @@ -10,7 +10,7 @@ configarchitecture 'amd64' 'i386' buildsimplenativepackage 'testing' 'amd64' '0.1' 'stable' buildsimplenativepackage 'testing' 'amd64' '0.8.15' 'stable' buildsimplenativepackage 'testing2' 'amd64,i386' '0.8.15' 'stable' -setupaptarchive +setupaptarchive # install native exec 3> apt-progress.log @@ -18,14 +18,13 @@ testsuccess aptget install testing=0.1 -y -o APT::Status-Fd=3 testfileequal './apt-progress.log' 'dlstatus:1:0.0000:Retrieving file 1 of 1 dlstatus:1:100.0000:Retrieving file 1 of 1 pmstatus:dpkg-exec:0.0000:Running dpkg -pmstatus:testing:0.0000:Installing testing (amd64) -pmstatus:testing:16.6667:Preparing testing (amd64) -pmstatus:testing:33.3333:Unpacking testing (amd64) -pmstatus:testing:50.0000:Preparing to configure testing (amd64) -pmstatus:dpkg-exec:50.0000:Running dpkg -pmstatus:testing:50.0000:Configuring testing (amd64) -pmstatus:testing:66.6667:Configuring testing (amd64) -pmstatus:testing:83.3333:Installed testing (amd64)' +pmstatus:testing:0.0000:Preparing testing (amd64) +pmstatus:testing:20.0000:Unpacking testing (amd64) +pmstatus:testing:40.0000:Installing testing (amd64) +pmstatus:dpkg-exec:40.0000:Running dpkg +pmstatus:testing:40.0000:Preparing to configure testing (amd64) +pmstatus:testing:60.0000:Configuring testing (amd64) +pmstatus:testing:80.0000:Installed testing (amd64)' # upgrade exec 3> apt-progress.log @@ -33,14 +32,13 @@ testsuccess aptget install testing=0.8.15 -y -o APT::Status-Fd=3 testfileequal './apt-progress.log' 'dlstatus:1:0.0000:Retrieving file 1 of 1 dlstatus:1:100.0000:Retrieving file 1 of 1 pmstatus:dpkg-exec:0.0000:Running dpkg -pmstatus:testing:0.0000:Installing testing (amd64) -pmstatus:testing:16.6667:Preparing testing (amd64) -pmstatus:testing:33.3333:Unpacking testing (amd64) -pmstatus:testing:50.0000:Preparing to configure testing (amd64) -pmstatus:dpkg-exec:50.0000:Running dpkg -pmstatus:testing:50.0000:Configuring testing (amd64) -pmstatus:testing:66.6667:Configuring testing (amd64) -pmstatus:testing:83.3333:Installed testing (amd64)' +pmstatus:testing:0.0000:Preparing testing (amd64) +pmstatus:testing:20.0000:Unpacking testing (amd64) +pmstatus:testing:40.0000:Installing testing (amd64) +pmstatus:dpkg-exec:40.0000:Running dpkg +pmstatus:testing:40.0000:Preparing to configure testing (amd64) +pmstatus:testing:60.0000:Configuring testing (amd64) +pmstatus:testing:80.0000:Installed testing (amd64)' # reinstall exec 3> apt-progress.log @@ -48,24 +46,22 @@ testsuccess aptget install testing=0.8.15 --reinstall -y -o APT::Status-Fd=3 testfileequal './apt-progress.log' 'dlstatus:1:0.0000:Retrieving file 1 of 1 dlstatus:1:100.0000:Retrieving file 1 of 1 pmstatus:dpkg-exec:0.0000:Running dpkg -pmstatus:testing:0.0000:Installing testing (amd64) -pmstatus:testing:16.6667:Preparing testing (amd64) -pmstatus:testing:33.3333:Unpacking testing (amd64) -pmstatus:testing:50.0000:Preparing to configure testing (amd64) -pmstatus:dpkg-exec:50.0000:Running dpkg -pmstatus:testing:50.0000:Configuring testing (amd64) -pmstatus:testing:66.6667:Configuring testing (amd64) -pmstatus:testing:83.3333:Installed testing (amd64)' +pmstatus:testing:0.0000:Preparing testing (amd64) +pmstatus:testing:20.0000:Unpacking testing (amd64) +pmstatus:testing:40.0000:Installing testing (amd64) +pmstatus:dpkg-exec:40.0000:Running dpkg +pmstatus:testing:40.0000:Preparing to configure testing (amd64) +pmstatus:testing:60.0000:Configuring testing (amd64) +pmstatus:testing:80.0000:Installed testing (amd64)' # and remove exec 3> apt-progress.log testsuccess aptget remove testing -y -o APT::Status-Fd=3 testfileequal './apt-progress.log' 'pmstatus:dpkg-exec:0.0000:Running dpkg -pmstatus:testing:0.0000:Removing testing (amd64) -pmstatus:testing:25.0000:Preparing for removal of testing (amd64) -pmstatus:testing:50.0000:Removing testing (amd64) -pmstatus:testing:75.0000:Removed testing (amd64) -pmstatus:dpkg-exec:75.0000:Running dpkg' +pmstatus:testing:0.0000:Preparing for removal of testing (amd64) +pmstatus:testing:33.3333:Removing testing (amd64) +pmstatus:testing:66.6667:Removing testing (amd64) +pmstatus:dpkg-exec:66.6667:Running dpkg' # install non-native and ensure we get proper progress info exec 3> apt-progress.log @@ -73,13 +69,12 @@ testsuccess aptget install testing2:i386 -y -o APT::Status-Fd=3 testfileequal './apt-progress.log' 'dlstatus:1:0.0000:Retrieving file 1 of 1 dlstatus:1:100.0000:Retrieving file 1 of 1 pmstatus:dpkg-exec:0.0000:Running dpkg -pmstatus:testing2:0.0000:Installing testing2 (i386) -pmstatus:testing2:16.6667:Preparing testing2 (i386) -pmstatus:testing2:33.3333:Unpacking testing2 (i386) -pmstatus:testing2:50.0000:Preparing to configure testing2 (i386) -pmstatus:dpkg-exec:50.0000:Running dpkg -pmstatus:testing2:50.0000:Configuring testing2 (i386) -pmstatus:testing2:66.6667:Configuring testing2 (i386) -pmstatus:testing2:83.3333:Installed testing2 (i386)' +pmstatus:testing2:0.0000:Preparing testing2 (i386) +pmstatus:testing2:20.0000:Unpacking testing2 (i386) +pmstatus:testing2:40.0000:Installing testing2 (i386) +pmstatus:dpkg-exec:40.0000:Running dpkg +pmstatus:testing2:40.0000:Preparing to configure testing2 (i386) +pmstatus:testing2:60.0000:Configuring testing2 (i386) +pmstatus:testing2:80.0000:Installed testing2 (i386)' rm -f apt-progress*.log diff --git a/test/integration/test-apt-progress-fd-deb822 b/test/integration/test-apt-progress-fd-deb822 index d9a4505d1..dd66e28a9 100755 --- a/test/integration/test-apt-progress-fd-deb822 +++ b/test/integration/test-apt-progress-fd-deb822 @@ -10,7 +10,7 @@ configarchitecture 'amd64' 'i386' buildsimplenativepackage 'testing' 'amd64' '0.1' 'stable' buildsimplenativepackage 'testing' 'all' '0.8.15' 'stable' buildsimplenativepackage 'testing2' 'amd64,i386' '0.8.15' 'stable' -setupaptarchive +setupaptarchive # install native exec 3> apt-progress.log @@ -23,40 +23,35 @@ Message: Running dpkg Status: progress Package: testing:amd64 Percent: 0.0000 -Message: Installing testing (amd64) - -Status: progress -Package: testing:amd64 -Percent: 16.6667 Message: Preparing testing (amd64) Status: progress Package: testing:amd64 -Percent: 33.3333 +Percent: 20.0000 Message: Unpacking testing (amd64) Status: progress Package: testing:amd64 -Percent: 50.0000 -Message: Preparing to configure testing (amd64) +Percent: 40.0000 +Message: Installing testing (amd64) Status: progress -Percent: 50.0000 +Percent: 40.0000 Message: Running dpkg Status: progress Package: testing:amd64 -Percent: 50.0000 -Message: Configuring testing (amd64) +Percent: 40.0000 +Message: Preparing to configure testing (amd64) Status: progress Package: testing:amd64 -Percent: 66.6667 +Percent: 60.0000 Message: Configuring testing (amd64) Status: progress Package: testing:amd64 -Percent: 83.3333 +Percent: 80.0000 Message: Installed testing (amd64) ' diff --git a/test/integration/test-apt-progress-fd-error b/test/integration/test-apt-progress-fd-error index 4439c042a..39c1053a1 100755 --- a/test/integration/test-apt-progress-fd-error +++ b/test/integration/test-apt-progress-fd-error @@ -18,8 +18,8 @@ setupaptarchive exec 3> apt-progress.log testfailure aptget install foo1 foo2 -y -o APT::Status-Fd=3 -msgtest 'Ensure correct error message' -testsuccess --nomsg grep "foo2_0.8.15_[^.]\+.deb:36.3636:trying to overwrite '/usr/bin/file-conflict', which is also in package foo1 0.8.15" apt-progress.log +msgtest 'Ensure correct error message' 'file-conflict' +testsuccess --nomsg grep "foo2_0.8.15_[^.]\+.deb:[0-9.]\+:trying to overwrite '/usr/bin/file-conflict', which is also in package foo1 0.8.15" apt-progress.log testsuccess test -s rootdir/var/crash/foo2.0.crash testsuccess grep '^Package: foo2 0.8.15$' rootdir/var/crash/foo2.0.crash diff --git a/test/integration/test-bug-624218-Translation-file-handling b/test/integration/test-bug-624218-Translation-file-handling index b629dd665..c116278ee 100755 --- a/test/integration/test-bug-624218-Translation-file-handling +++ b/test/integration/test-bug-624218-Translation-file-handling @@ -6,24 +6,78 @@ TESTDIR="$(readlink -f "$(dirname "$0")")" setupenvironment configarchitecture 'i386' -buildsimplenativepackage 'coolstuff' 'all' '1.0' 'unstable' +insertpackage 'unstable' 'unrelated' 'i386' '1' +insertpackage 'unstable' 'ancientstuff' 'all' '1' +insertpackage 'unstable' 'boringstuff' 'all' '1' '' '' 'shared short description' +insertpackage 'unstable' 'coolstuff' 'all' '1' +insertpackage 'unstable' 'dullstuff' 'all' '1' '' '' 'shared short description' +insertpackage 'unstable' 'evilstuff' 'all' '1' +insertpackage 'unstable' 'foostuff' 'all' '1' '' '' 'shared short description' +insertpackage 'unstable' 'goodstuff' 'all' '1' +insertpackage 'unstable' "longdesc" 'all' '1' '' '' "$(for i in $(seq 0 100); do printf '%s' 'lorem ipsum '; done)" setupaptarchive --no-update - changetowebserver + +testsuccess aptget update +PKGORDER='coolstuff foostuff coolstuff foostuff' +msgtest 'Prepare expectation for' 'aptcache show' +if aptcache show $PKGORDER | grep -v '^ ' > aptcacheshow.out 2>&1; then + msgpass +else + cat aptcacheshow.out || true + msgfail +fi +testsuccessequal '4' grep -c '^Package: ' aptcacheshow.out +msgtest 'Prepare expectation for' 'apt show' +if apt show $PKGORDER | grep -v -e '^ ' -e '^[A-Z][a-z]\+-Size: ' > aptshow.out 2>&1; then + msgpass +else + cat aptshow.out || true + msgfail +fi +testsuccessequal '4' grep -c '^Package: ' aptshow.out rm -rf rootdir/var/lib/apt/lists +checkaptshow() { + testsuccess aptcache show $PKGORDER + sed -i -e 's#^Description: #Description-en: #' rootdir/tmp/testsuccess.output + testequal "$(cat aptcacheshow.out) +" grep -v '^ ' rootdir/tmp/testsuccess.output + + testsuccess apt show $PKGORDER + sed -i -e 's#^Description-en: #Description: #' rootdir/tmp/testsuccess.output + testequal "$(cat aptshow.out) +" grep -v -e '^ ' -e '^[A-Z][a-z]\+-Size: ' rootdir/tmp/testsuccess.output + + if [ -n "$(ls rootdir/var/lib/apt/lists/*Translation* 2>/dev/null)" ]; then + testsuccess find rootdir/var/lib/apt/lists/ -name '*Translation*' -delete + + testsuccess aptcache show $PKGORDER + sed -i -e 's#^Description: #Description-en: #' rootdir/tmp/testsuccess.output + testequal "$(cat aptcacheshow.out) +" grep -v '^ ' rootdir/tmp/testsuccess.output + + testsuccess apt show $PKGORDER + sed -i -e 's#^Description-en: #Description: #' rootdir/tmp/testsuccess.output + testequal "$(cat aptshow.out) +" grep -v -e '^ ' -e '^[A-Z][a-z]\+-Size: ' rootdir/tmp/testsuccess.output + fi +} + translationslisted() { msgtest 'No download of non-existent locals' "$1" export LC_ALL="" testsuccess --nomsg aptget update -o Acquire::Languages=en testfailure grep -q -e 'Translation-[^e][^n] ' rootdir/tmp/testsuccess.output + checkaptshow rm -rf rootdir/var/lib/apt/lists msgtest 'Download of existent locals' "$1" testsuccess --nomsg aptget update cp rootdir/tmp/testsuccess.output testsuccess.output testsuccess grep -q -e 'Translation-en ' testsuccess.output + checkaptshow rm -rf rootdir/var/lib/apt/lists msgtest 'Download of en in LC_ALL=C' "$1" @@ -31,6 +85,7 @@ translationslisted() { testsuccess --nomsg aptget update cp rootdir/tmp/testsuccess.output testsuccess.output testsuccess grep -q -e 'Translation-en ' testsuccess.output + checkaptshow rm -rf rootdir/var/lib/apt/lists unset LC_ALL @@ -38,21 +93,25 @@ translationslisted() { testsuccess --nomsg aptget update -o Acquire::Languages=en cp rootdir/tmp/testsuccess.output testsuccess.output testsuccess grep -q -e 'Translation-en ' testsuccess.output + checkaptshow rm -rf rootdir/var/lib/apt/lists msgtest 'Download of nothing else in forced language' "$1" testsuccess --nomsg aptget update -o Acquire::Languages=en testfailure grep -q -e 'Translation-[^e][^n] ' rootdir/tmp/testsuccess.output + checkaptshow rm -rf rootdir/var/lib/apt/lists msgtest 'Download no Translation- if forced language is non-existent' "$1" testsuccess --nomsg aptget update -o Acquire::Languages=ast_DE testfailure grep -q -e 'Translation-' rootdir/tmp/testsuccess.output + checkaptshow rm -rf rootdir/var/lib/apt/lists msgtest 'Download of nothing if none is forced' "$1" testsuccess --nomsg aptget update -o Acquire::Languages=none testfailure grep -q -e 'Translation' rootdir/tmp/testsuccess.output + checkaptshow rm -rf rootdir/var/lib/apt/lists } @@ -66,26 +125,31 @@ echo 'Acquire::AllowInsecureRepositories "true";' > rootdir/etc/apt/apt.conf.d/ msgtest 'Download of en as forced language' 'without Index' testwarning --nomsg aptget update -o Acquire::Languages=en testsuccess grep -q -e 'Translation-en ' rootdir/tmp/testwarning.output +checkaptshow rm -rf rootdir/var/lib/apt/lists msgtest 'Download of nothing else in forced language' 'without Index' testwarning --nomsg aptget update -o Acquire::Languages=en testfailure grep -q -e 'Translation-[^e][^n] ' rootdir/tmp/testwarning.output +checkaptshow rm -rf rootdir/var/lib/apt/lists msgtest 'Download of ast_DE as forced language' 'without Index' testwarning --nomsg aptget update -o Acquire::Languages=ast_DE testsuccess grep -q -e 'Translation-ast_DE$' rootdir/tmp/testwarning.output +checkaptshow rm -rf rootdir/var/lib/apt/lists msgtest 'Download of nothing else in forced language' 'without Index' testwarning --nomsg aptget update -o Acquire::Languages=ast_DE testfailure grep -q -e 'Translation-[^a][^s]' rootdir/tmp/testwarning.output +checkaptshow rm -rf rootdir/var/lib/apt/lists msgtest 'Download of nothing if none is forced' 'without Index' testwarning --nomsg aptget update -o Acquire::Languages=none testfailure grep -q -e 'Translation' rootdir/tmp/testwarning.output +checkaptshow rm -rf rootdir/var/lib/apt/lists mkdir -p rootdir/var/lib/apt/lists @@ -94,6 +158,7 @@ touch rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_i18 msgtest 'Download of builtin files' 'without Index' testwarning --nomsg aptget update testsuccess grep -q -e 'Translation-ast_DE' rootdir/tmp/testwarning.output +checkaptshow rm -rf rootdir/var/lib/apt/lists mkdir -p rootdir/var/lib/apt/lists @@ -102,4 +167,5 @@ touch rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_i18 msgtest 'Download of nothing (even builtin) if none is forced' 'without Index' testwarning --nomsg aptget update -o Acquire::Languages=none testfailure grep -q -e 'Translation' rootdir/tmp/testwarning.output +checkaptshow rm -rf rootdir/var/lib/apt/lists diff --git a/test/integration/test-bug-722207-print-uris-even-if-very-quiet b/test/integration/test-bug-722207-print-uris-even-if-very-quiet index 82c1d715f..8d17507cb 100755 --- a/test/integration/test-bug-722207-print-uris-even-if-very-quiet +++ b/test/integration/test-bug-722207-print-uris-even-if-very-quiet @@ -23,7 +23,7 @@ testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.d testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 SHA256:0000000000000000000000000000000000000000000000000000000000000000" aptget download apt -qq --print-uris testsuccessequal "'file://${APTARCHIVE}/apt_2.dsc' apt_2.dsc 9 SHA256:7776436a6d741497f1cd958014e1a05b352224231428152aae39da3c17fd2fd4 'file://${APTARCHIVE}/apt_2.tar.gz' apt_2.tar.gz 12 SHA256:f57f565eabe3fde0ec6e6e0bcc8db1d86fe2b4d6344a380a23520ddbb7728e99" aptget source apt -qq --print-uris -testsuccessequal "'http://metadata.ftp-master.debian.org/changelogs/main/a/apt/apt_2_changelog' apt.changelog" aptget changelog apt -qq --print-uris +testsuccessequal "'https://metadata.ftp-master.debian.org/changelogs/main/a/apt/apt_2_changelog' apt.changelog" aptget changelog apt -qq --print-uris testsuccessequal "'file://${APTARCHIVE}/apt_2.dsc' apt_2.dsc 9 SHA256:7776436a6d741497f1cd958014e1a05b352224231428152aae39da3c17fd2fd4 'file://${APTARCHIVE}/apt_2.tar.gz' apt_2.tar.gz 12 SHA256:f57f565eabe3fde0ec6e6e0bcc8db1d86fe2b4d6344a380a23520ddbb7728e99 diff --git a/test/integration/test-frontend-lock b/test/integration/test-frontend-lock new file mode 100755 index 000000000..939344afc --- /dev/null +++ b/test/integration/test-frontend-lock @@ -0,0 +1,80 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" + +setupenvironment +configarchitecture 'i386' + +insertinstalledpackage 'package1' 'i386' '1.0' +insertinstalledpackage 'package2' 'i386' '1.0' +insertinstalledpackage 'package3' 'i386' '1.0' +insertinstalledpackage 'package4' 'i386' '1.0' +insertinstalledpackage 'package5' 'i386' '1.0' +insertinstalledpackage 'package6' 'i386' '1.0' +buildsimplenativepackage 'foo' 'all' '1' + +setupaptarchive + +buildsimplenativepackage 'bar' 'all' '1' + + +# Checks that the correct variable is set +msgmsg 'Post-Invoke script has DPKG_FRONTEND_LOCKED set' +testsuccess aptget -q -y -o Dpkg::Post-Invoke::="echo DPKG_FRONTEND_LOCKED=\$DPKG_FRONTEND_LOCKED" remove package1 +cp rootdir/tmp/testsuccess.output install.output +testsuccess grep DPKG_FRONTEND_LOCKED=true install.output + +msgmsg 'Pre-Invoke script has DPKG_FRONTEND_LOCKED set' +testsuccess aptget -q -y -o Dpkg::Pre-Invoke::="echo DPKG_FRONTEND_LOCKED=\$DPKG_FRONTEND_LOCKED" remove package2 +cp rootdir/tmp/testsuccess.output install.output +testsuccess grep DPKG_FRONTEND_LOCKED=true install.output + +msgmsg 'Pre-Install-Pkgs script has DPKG_FRONTEND_LOCKED set' +testsuccess aptget -q -y -o DPkg::Pre-Install-Pkgs::="echo DPKG_FRONTEND_LOCKED=\$DPKG_FRONTEND_LOCKED" remove package3 +cp rootdir/tmp/testsuccess.output install.output +testsuccess grep DPKG_FRONTEND_LOCKED=true install.output + + +# Check that the frontend lock is hold by apt-get +msgmsg 'Post-Invoke script runs while frontend is locked' +testfailure aptget -q -y -o Dpkg::Post-Invoke::="apt-get remove" remove package4 +cp rootdir/tmp/testfailure.output install.output +testsuccess grep "E: Unable to acquire the dpkg frontend lock (${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/lock-frontend), is another process using it?" install.output +testsuccess grep "E: Problem executing scripts DPkg::Post-Invoke 'apt-get remove'" install.output + +msgmsg 'Pre-Invoke script runs while frontend is locked' +testfailure aptget -q -y -o Dpkg::Pre-Invoke::="apt-get remove" remove package5 +cp rootdir/tmp/testfailure.output install.output +testsuccess grep "E: Unable to acquire the dpkg frontend lock (${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/lock-frontend), is another process using it?" install.output +testsuccess grep "E: Problem executing scripts DPkg::Pre-Invoke 'apt-get remove'" install.output + +msgmsg 'Pre-Install-Pkgs runs while frontend is locked' +testfailure aptget -q -y -o DPkg::Pre-Install-Pkgs::="apt-get remove" remove package6 +cp rootdir/tmp/testfailure.output install.output +testsuccess grep "E: Unable to acquire the dpkg frontend lock (${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/lock-frontend), is another process using it?" install.output +testsuccess grep "E: Sub-process apt-get remove returned an error code (100)" install.output +testsuccess grep "Failure running script apt-get remove" install.output + + +# Applied test case from DonKult +msgmsg 'Applied case of frontend locking' +cat > ./post-invoke <<EOF +#!/bin/sh +set -e +#export DPKG_FRONTEND_LOCKED=true +${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg -i ${TMPWORKINGDIRECTORY}/incoming/bar_1_all.deb +EOF +chmod +x ./post-invoke +echo "dpkg::post-invoke:: \"${TMPWORKINGDIRECTORY}/post-invoke\";" > rootdir/etc/apt/apt.conf.d/01dpkgpostinvoke + +testdpkgnotinstalled 'foo' 'bar' +testsuccess apt show foo +testfailure apt show bar + +testsuccess apt install foo -s +testdpkgnotinstalled 'foo' 'bar' + +testsuccess apt install foo +testdpkginstalled 'foo' 'bar' diff --git a/test/integration/test-no-fds-leaked-to-maintainer-scripts b/test/integration/test-no-fds-leaked-to-maintainer-scripts index 747af69ff..85b3d0ee1 100755 --- a/test/integration/test-no-fds-leaked-to-maintainer-scripts +++ b/test/integration/test-no-fds-leaked-to-maintainer-scripts @@ -55,7 +55,15 @@ checkinstall() { tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log testfileequal 'terminal.log' "$(cat terminal.output)" - testequal "startup archives unpack + testequalor2 "startup archives unpack +install $PKGNAME <none> 1.0 +status half-installed $PKGNAME 1.0 +status unpacked $PKGNAME 1.0 +startup packages configure +configure $PKGNAME 1.0 <none> +status unpacked $PKGNAME 1.0 +status half-configured $PKGNAME 1.0 +status installed $PKGNAME 1.0" "startup archives unpack install $PKGNAME <none> 1.0 status half-installed $PKGNAME 1.0 status unpacked $PKGNAME 1.0 @@ -78,7 +86,18 @@ checkpurge() { testfileequal 'terminal.log' "$(cat terminal.output)" if dpkg --compare-versions "$(dpkg_version)" 'ge' '1.18.11'; then - testequal "startup packages remove + testequalor2 "startup packages remove +status installed $PKGNAME 1.0 +remove $PKGNAME 1.0 <none> +status half-configured $PKGNAME 1.0 +status half-installed $PKGNAME 1.0 +status config-files $PKGNAME 1.0 +startup packages configure +startup packages purge +purge $PKGNAME 1.0 <none> +status config-files $PKGNAME 1.0 +status not-installed $PKGNAME <none> +startup packages configure" "startup packages remove status installed $PKGNAME 1.0 remove $PKGNAME 1.0 <none> status half-configured $PKGNAME 1.0 @@ -96,7 +115,19 @@ status config-files $PKGNAME 1.0 status not-installed $PKGNAME <none> startup packages configure" cut -f 3- -d' ' rootdir/var/log/dpkg.log else - testequal "startup packages remove + testequalor2 "startup packages remove +status installed $PKGNAME 1.0 +remove $PKGNAME 1.0 <none> +status half-configured $PKGNAME 1.0 +status half-installed $PKGNAME 1.0 +status config-files $PKGNAME 1.0 +startup packages configure +startup packages purge +remove $PKGNAME 1.0 <none> +purge $PKGNAME 1.0 <none> +status config-files $PKGNAME 1.0 +status not-installed $PKGNAME <none> +startup packages configure" "startup packages remove status installed $PKGNAME 1.0 remove $PKGNAME 1.0 <none> status half-configured $PKGNAME 1.0 |