]> git.saurik.com Git - apt.git/blob - test/integration/test-00-commands-have-help
support setting empty values (sanely) & removing support for
[apt.git] / test / integration / test-00-commands-have-help
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6
7 setupenvironment
8 configarchitecture '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
13 export LD_BIND_NOW=1
14
15 checkversionmessage() {
16 testsuccess grep '^apt .* (' ${1}-help.output
17 }
18
19 checkhelpmessage() {
20 checkversionmessage "$1"
21 testsuccess grep '^Usage:' ${1}-help.output
22 }
23
24 checkoptions() {
25 testsuccess $1 --help
26 cp -f rootdir/tmp/testsuccess.output ${1}-help.output
27 checkhelpmessage "$1"
28
29 testsuccess $1 --version
30 cp -f rootdir/tmp/testsuccess.output ${1}-help.output
31 checkversionmessage "$1"
32 }
33
34 for CMD in 'apt-cache' 'apt-cdrom' 'apt-config' \
35 'apt-extracttemplates' 'apt-get' 'apt-helper' \
36 'apt-mark' 'apt-sortpkgs' 'apt' 'apt-ftparchive'; do
37 cmd="$(echo "$CMD" | tr -d '-')"
38 msgtest 'Test for failure with no parameters calling' "$CMD"
39 if $cmd > ${cmd}-help.output 2>&1; then
40 echo
41 cat ${cmd}-help.output
42 msgfail 'zero exit'
43 else
44 msgpass
45 fi
46 checkhelpmessage "$cmd"
47 checkoptions "$cmd"
48 done
49
50 for CMD in 'apt-dump-solver' 'apt-internal-solver'; do
51 checkoptions "$(echo "$CMD" | tr -d '-')"
52 done
53
54 # in times of need, we all look for super cow to save the day
55 testsuccess aptget moo
56 testsuccess aptget moo -q=2
57 testsuccess aptget moo moo
58 testsuccess aptget moo moo -q=2
59 testsuccess aptget moo moo --color
60 testsuccess aptget moo moo moo
61 testsuccess aptget moo moo moo -q=2
62 testsuccess aptget moo moo moo moo
63 testsuccess aptget moo moo moo moo -q=2