]> git.saurik.com Git - apt.git/blob - test/integration/test-00-commands-have-help
add apt-key support for armored GPG key files (*.asc)
[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 # german variant of klingon used for testing usage of non-existent l10n
15 export LC_ALL=tlh_DE.UTF-8
16
17 checkversionmessage() {
18 testsuccess grep '^apt .* (' ${1}-help.output
19 }
20
21 checkhelpmessage() {
22 checkversionmessage "$1"
23 testsuccess grep '^Usage:' ${1}-help.output
24 }
25
26 checkoptions() {
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
36 for 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"
50 done
51
52 for CMD in 'apt-dump-solver' 'apt-internal-solver' 'apt-internal-planner'; do
53 checkoptions "$(echo "$CMD" | tr -d '-')"
54 done
55
56 # in times of need, we all look for super cow to save the day
57 testsuccess aptget moo
58 testsuccess aptget moo -q=2
59 testsuccess aptget moo moo
60 testsuccess aptget moo moo -q=2
61 testsuccess aptget moo moo --color
62 testsuccess aptget moo moo moo
63 testsuccess aptget moo moo moo -q=2
64 testsuccess aptget moo moo moo moo
65 testsuccess aptget moo moo moo moo -q=2