]> git.saurik.com Git - apt.git/blame - test/integration/test-00-commands-have-help
eipp: add Allow-Temporary-Remove-of-Essentials
[apt.git] / test / integration / test-00-commands-have-help
CommitLineData
ad7e0941
DK
1#!/bin/sh
2set -e
3
3abb6a6a
DK
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
ad7e0941
DK
6
7setupenvironment
8configarchitecture 'amd64'
9
10# this test does double duty: The obvious is checking for --help and co,
11# but it also checks if the binary can find all methods in the library.
12# The later is quite handy for manual testing of non-abibreaking changes
13export LD_BIND_NOW=1
62600666
DK
14# german variant of klingon used for testing usage of non-existent l10n
15export LC_ALL=tlh_DE.UTF-8
ad7e0941
DK
16
17checkversionmessage() {
249aec3b 18 testsuccess grep '^apt .* (' ${1}-help.output
ad7e0941
DK
19}
20
21checkhelpmessage() {
22 checkversionmessage "$1"
23 testsuccess grep '^Usage:' ${1}-help.output
24}
25
26checkoptions() {
27 testsuccess $1 --help
28 cp -f rootdir/tmp/testsuccess.output ${1}-help.output
29 checkhelpmessage "$1"
30
31 testsuccess $1 --version
32 cp -f rootdir/tmp/testsuccess.output ${1}-help.output
33 checkversionmessage "$1"
34}
35
36for CMD in 'apt-cache' 'apt-cdrom' 'apt-config' \
37 'apt-extracttemplates' 'apt-get' 'apt-helper' \
38 'apt-mark' 'apt-sortpkgs' 'apt' 'apt-ftparchive'; do
39 cmd="$(echo "$CMD" | tr -d '-')"
40 msgtest 'Test for failure with no parameters calling' "$CMD"
41 if $cmd > ${cmd}-help.output 2>&1; then
42 echo
43 cat ${cmd}-help.output
44 msgfail 'zero exit'
45 else
46 msgpass
47 fi
48 checkhelpmessage "$cmd"
49 checkoptions "$cmd"
50done
51
f74d99c6 52for CMD in 'apt-dump-solver' 'apt-internal-solver' 'apt-internal-planer'; do
ad7e0941
DK
53 checkoptions "$(echo "$CMD" | tr -d '-')"
54done
081c9d44
DK
55
56# in times of need, we all look for super cow to save the day
57testsuccess aptget moo
58testsuccess aptget moo -q=2
59testsuccess aptget moo moo
60testsuccess aptget moo moo -q=2
61testsuccess aptget moo moo --color
62testsuccess aptget moo moo moo
63testsuccess aptget moo moo moo -q=2
64testsuccess aptget moo moo moo moo
65testsuccess aptget moo moo moo moo -q=2