]> git.saurik.com Git - apt.git/blame - test/integration/test-00-commands-have-help
ensure outdated files are dropped without lists-cleanup
[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
14
15checkversionmessage() {
249aec3b 16 testsuccess grep '^apt .* (' ${1}-help.output
ad7e0941
DK
17}
18
19checkhelpmessage() {
20 checkversionmessage "$1"
21 testsuccess grep '^Usage:' ${1}-help.output
22}
23
24checkoptions() {
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
34for 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"
48done
49
50for CMD in 'apt-dump-solver' 'apt-internal-solver'; do
51 checkoptions "$(echo "$CMD" | tr -d '-')"
52done
081c9d44
DK
53
54# in times of need, we all look for super cow to save the day
55testsuccess aptget moo
56testsuccess aptget moo -q=2
57testsuccess aptget moo moo
58testsuccess aptget moo moo -q=2
59testsuccess aptget moo moo --color
60testsuccess aptget moo moo moo
61testsuccess aptget moo moo moo -q=2
62testsuccess aptget moo moo moo moo
63testsuccess aptget moo moo moo moo -q=2