You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

102 lines
2.9 KiB

  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64'
  7. # this test does double duty: The obvious is checking for --help and co,
  8. # but it also checks if the binary can find all methods in the library.
  9. # The later is quite handy for manual testing of non-abibreaking changes
  10. export LD_BIND_NOW=1
  11. # german variant of klingon used for testing usage of non-existent l10n
  12. export LC_ALL=tlh_DE.UTF-8
  13. checkversionmessage() {
  14. testsuccess grep '^apt .* (' ${1}-help.output
  15. }
  16. checkhelpmessage() {
  17. checkversionmessage "$1"
  18. testsuccess grep '^Usage:' ${1}-help.output
  19. }
  20. checkoptions() {
  21. testsuccess $1 --help
  22. cp -f rootdir/tmp/testsuccess.output ${1}-help.output
  23. checkhelpmessage "$1"
  24. testsuccess $1 --version
  25. cp -f rootdir/tmp/testsuccess.output ${1}-help.output
  26. checkversionmessage "$1"
  27. }
  28. for CMD in 'apt-cache' 'apt-cdrom' 'apt-config' \
  29. 'apt-extracttemplates' 'apt-get' 'apt-helper' \
  30. 'apt-mark' 'apt-sortpkgs' 'apt' 'apt-ftparchive'; do
  31. cmd="$(echo "$CMD" | tr -d '-')"
  32. msgtest 'Test for failure with no parameters calling' "$CMD"
  33. if $cmd > ${cmd}-help.output 2>&1; then
  34. echo
  35. cat ${cmd}-help.output
  36. msgfail 'zero exit'
  37. else
  38. msgpass
  39. fi
  40. checkhelpmessage "$cmd"
  41. checkoptions "$cmd"
  42. done
  43. for CMD in 'apt-dump-solver' 'apt-internal-solver' 'apt-internal-planner'; do
  44. checkoptions "$(echo "$CMD" | tr -d '-')"
  45. done
  46. # in times of need, we all look for super cow to save the day
  47. testsuccess aptget moo
  48. testsuccess aptget moo -q=2
  49. testsuccess aptget moo moo
  50. testsuccess aptget moo moo -q=2
  51. testsuccess aptget moo moo --color
  52. testsuccess aptget moo moo moo
  53. testsuccess aptget moo moo moo -q=2
  54. testsuccess aptget moo moo moo moo
  55. testsuccess aptget moo moo moo moo -q=2
  56. export SOURCE_DATE_EPOCH=moo
  57. testwarningmsg 'W: Environment variable SOURCE_DATE_EPOCH was ignored as it has an invalid value: "moo"' apt moo
  58. testmoo() {
  59. export SOURCE_DATE_EPOCH="$(date -d "$1" +'%s')"
  60. testsuccess aptget moo
  61. cp rootdir/tmp/testsuccess.output moo.output
  62. testsuccess grep "$2" moo.output
  63. testsuccessequal "$2" apt moo -qqq
  64. unset SOURCE_DATE_EPOCH
  65. }
  66. testmoo '@0' 'Have you mooed today?'
  67. # the year 0 is too early for 32bit architectures
  68. testmoo '2000-12-25' 'Happy package management day!'
  69. testmoo '1930-02-18' "It's a Bird ... It's a Plane ... It's Super Cow!"
  70. testmoo '1966-11-07' 'Whoever needs milk, bows to the animal.'
  71. testmoo '1988-03-29' 'Have you mooed today?'
  72. testmoo '1993-08-16' 'Three moos for Debian!'
  73. testmoo '1998-04-01' 'Have you smashed some milk today?'
  74. testmoo '@1484822790' 'Have you mooed today?'
  75. testmoo '@1484822791' 'Have you mooed today?'
  76. testmoo '@1484822792' 'Have you mooed today?'
  77. testmoo '@1484822793' 'Have you mooed today?'
  78. # that also helps with reproducibility of output…
  79. export COLUMNS=80
  80. testsuccess aptget moo
  81. export COLUMNS=0
  82. testwarning aptget moo
  83. export COLUMNS=80a
  84. testwarning aptget moo
  85. export COLUMNS=a80
  86. testwarning aptget moo
  87. export COLUMNS=
  88. testwarning aptget moo
  89. unset COLUMNS