summaryrefslogtreecommitdiff
path: root/test/integration/test-00-commands-have-help
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2015-08-18 11:54:05 +0200
committerMichael Vogt <mvo@debian.org>2015-08-18 11:54:05 +0200
commit21248c0f00ee71412dbadc6ebf84011cf974346d (patch)
tree7dc1f5904399482d2128765b5b86d57a4ac5b3e1 /test/integration/test-00-commands-have-help
parente5f34ad3b043abf033c1626eb8449b75955d6760 (diff)
parent4fc6b7570c3e97b65c118b58cdf6729fa94c9b03 (diff)
Merge branch 'debian/experimental' into feature/srv-records
Conflicts: cmdline/apt-helper.cc cmdline/makefile
Diffstat (limited to 'test/integration/test-00-commands-have-help')
-rwxr-xr-xtest/integration/test-00-commands-have-help63
1 files changed, 63 insertions, 0 deletions
diff --git a/test/integration/test-00-commands-have-help b/test/integration/test-00-commands-have-help
new file mode 100755
index 000000000..f2317dbdf
--- /dev/null
+++ b/test/integration/test-00-commands-have-help
@@ -0,0 +1,63 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64'
+
+# this test does double duty: The obvious is checking for --help and co,
+# but it also checks if the binary can find all methods in the library.
+# The later is quite handy for manual testing of non-abibreaking changes
+export LD_BIND_NOW=1
+
+checkversionmessage() {
+ testsuccess grep '^apt .* (' ${1}-help.output
+}
+
+checkhelpmessage() {
+ checkversionmessage "$1"
+ testsuccess grep '^Usage:' ${1}-help.output
+}
+
+checkoptions() {
+ testsuccess $1 --help
+ cp -f rootdir/tmp/testsuccess.output ${1}-help.output
+ checkhelpmessage "$1"
+
+ testsuccess $1 --version
+ cp -f rootdir/tmp/testsuccess.output ${1}-help.output
+ checkversionmessage "$1"
+}
+
+for CMD in 'apt-cache' 'apt-cdrom' 'apt-config' \
+ 'apt-extracttemplates' 'apt-get' 'apt-helper' \
+ 'apt-mark' 'apt-sortpkgs' 'apt' 'apt-ftparchive'; do
+ cmd="$(echo "$CMD" | tr -d '-')"
+ msgtest 'Test for failure with no parameters calling' "$CMD"
+ if $cmd > ${cmd}-help.output 2>&1; then
+ echo
+ cat ${cmd}-help.output
+ msgfail 'zero exit'
+ else
+ msgpass
+ fi
+ checkhelpmessage "$cmd"
+ checkoptions "$cmd"
+done
+
+for CMD in 'apt-dump-solver' 'apt-internal-solver'; do
+ checkoptions "$(echo "$CMD" | tr -d '-')"
+done
+
+# in times of need, we all look for super cow to save the day
+testsuccess aptget moo
+testsuccess aptget moo -q=2
+testsuccess aptget moo moo
+testsuccess aptget moo moo -q=2
+testsuccess aptget moo moo --color
+testsuccess aptget moo moo moo
+testsuccess aptget moo moo moo -q=2
+testsuccess aptget moo moo moo moo
+testsuccess aptget moo moo moo moo -q=2