diff options
author | David Kalnischkies <david@kalnischkies.de> | 2017-11-18 03:48:59 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2017-11-19 18:26:19 +0100 |
commit | 3f8664036e63d2a2d58120ab6c1e8a0a09937c71 (patch) | |
tree | 492e0eddd4d4555293f092eb1c21ecb3dad2bbf7 /test | |
parent | 7fba4e0df1768703ce657d8bf8200472c2dd825f (diff) |
support COLUMNS environment variable in apt tools
apt usually gets the width of the window from the terminal or failing
that has a default value, but especially for testing it can be handy
to control the size as you can't be sure that variable sized content
will always be linebreaked as expected in the testcases.
Diffstat (limited to 'test')
-rwxr-xr-x | test/integration/test-00-commands-have-help | 13 | ||||
-rwxr-xr-x | test/integration/test-kernel-helper-autoremove | 17 |
2 files changed, 26 insertions, 4 deletions
diff --git a/test/integration/test-00-commands-have-help b/test/integration/test-00-commands-have-help index 2d8fa1105..4a0cc64d4 100755 --- a/test/integration/test-00-commands-have-help +++ b/test/integration/test-00-commands-have-help @@ -86,3 +86,16 @@ testmoo '@1484822790' 'Have you mooed today?' testmoo '@1484822791' 'Have you mooed today?' testmoo '@1484822792' 'Have you mooed today?' testmoo '@1484822793' 'Have you mooed today?' + +# that also helps with reproducibility of output… +export COLUMNS=80 +testsuccess aptget moo +export COLUMNS=0 +testwarning aptget moo +export COLUMNS=80a +testwarning aptget moo +export COLUMNS=a80 +testwarning aptget moo +export COLUMNS= +testwarning aptget moo +unset COLUMNS diff --git a/test/integration/test-kernel-helper-autoremove b/test/integration/test-kernel-helper-autoremove index a70841d9d..8cde3432f 100755 --- a/test/integration/test-kernel-helper-autoremove +++ b/test/integration/test-kernel-helper-autoremove @@ -116,16 +116,17 @@ msgmsg "run without parameter" testprotected msgtest 'Check kernel autoremoval protection list does not include' 'old kernel' testfailure --nomsg grep '^\^linux-image-1\\\.0\\\.0-2-generic\$$' protected.list +export COLUMNS=99999 testsuccessequal "Reading package lists... Building dependency tree... Reading state information... The following packages will be REMOVED: - linux-headers-1000000-1-generic linux-image-1.0.0-2-generic - ${CURRENTKERNEL}-dbg + linux-headers-1000000-1-generic linux-image-1.0.0-2-generic ${CURRENTKERNEL}-dbg 0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded. Remv linux-headers-1000000-1-generic [100.0.0-1] Remv linux-image-1.0.0-2-generic [1.0.0-2] Remv ${CURRENTKERNEL}-dbg [5-1]" aptget autoremove -s +unset COLUMNS msgmsg "install unknown kernel" # even if installed/uname reports a kernel which we can't find via dpkg, @@ -136,32 +137,39 @@ msgtest 'Check kernel autoremoval protection list does not include' 'old kernel' testfailure --nomsg grep '^\^linux-image-1\\\.0\\\.0-2-generic\$$' protected.list msgtest 'Check kernel autoremoval protection list does include' 'unknown installed kernel' testsuccess --nomsg grep '^\^linux-image-1\\\.0\\\.0-2-ungeneric\$$' protected.list +export COLUMNS=9 testsuccessequal "Reading package lists... Building dependency tree... Reading state information... The following packages will be REMOVED: - linux-headers-1000000-1-generic linux-image-1.0.0-2-generic + linux-headers-1000000-1-generic + linux-image-1.0.0-2-generic ${CURRENTKERNEL}-dbg 0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded. Remv linux-headers-1000000-1-generic [100.0.0-1] Remv linux-image-1.0.0-2-generic [1.0.0-2] Remv ${CURRENTKERNEL}-dbg [5-1]" aptget autoremove -s +unset COLUMNS msgmsg "install an old kernel" testprotected 1.0.0-2-generic msgtest 'Check kernel autoremoval protection list includes' 'installed kernel' testsuccess --nomsg grep '^\^linux-image-1\\\.0\\\.0-2-generic\$$' protected.list +export COLUMNS=9 testsuccessequal "Reading package lists... Building dependency tree... Reading state information... The following packages will be REMOVED: - linux-headers-1000000-1-generic ${CURRENTKERNEL}-dbg + linux-headers-1000000-1-generic + ${CURRENTKERNEL}-dbg 0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded. Remv linux-headers-1000000-1-generic [100.0.0-1] Remv ${CURRENTKERNEL}-dbg [5-1]" aptget autoremove -s +unset COLUMNS # rt kernel was put on hold while the protected list was generated testsuccess aptmark unhold "${CURRENTKERNEL}-rt" +export COLUMNS=99999 testsuccessequal "Reading package lists... Building dependency tree... Reading state information... @@ -170,3 +178,4 @@ The following packages will be REMOVED: 0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded. Remv linux-headers-1000000-1-generic [100.0.0-1] Remv ${CURRENTKERNEL}-dbg [5-1]" aptget autoremove -s +unset COLUMNS |