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.

test-apt-cli-list 2.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture "i386"
  7. insertpackage 'unstable' 'foo' 'all' '1.0'
  8. insertinstalledpackage 'bar' 'i386' '1.0'
  9. insertinstalledpackage 'foobar' 'i386' '1.0'
  10. insertpackage 'unstable' 'foobar' 'i386' '2.0'
  11. insertinstalledpackage 'baz' 'all' '0.1'
  12. insertpackage 'testing' 'baz' 'all' '1.0'
  13. insertpackage 'unstable' 'baz' 'all' '2.0'
  14. setupaptarchive
  15. testsuccessequal "Listing...
  16. bar/now 1.0 i386 [installed,local]
  17. baz/unstable 2.0 all [upgradable from: 0.1]
  18. foo/unstable 1.0 all
  19. foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list
  20. testsuccessequal "Listing...
  21. foo/unstable 1.0 all
  22. foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list "foo*"
  23. testsuccessequal "Listing...
  24. baz/unstable 2.0 all [upgradable from: 0.1]
  25. foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list --upgradable
  26. # FIXME: hm, hm - does it make sense to have this different? shouldn't
  27. # we use "installed,upgradable" consitently?
  28. testsuccessequal "Listing...
  29. bar/now 1.0 i386 [installed,local]
  30. baz/now 0.1 all [installed,upgradable to: 2.0]
  31. foobar/now 1.0 i386 [installed,upgradable to: 2.0]" apt list --installed
  32. testsuccessequal "Listing...
  33. bar/now 1.0 i386 [installed,local]
  34. foobar/unstable 2.0 i386 [upgradable from: 1.0]
  35. foobar/now 1.0 i386 [installed,upgradable to: 2.0]
  36. " apt list bar foobar --all-versions
  37. testsuccessequal "Listing...
  38. bar/now 1.0 i386 [installed,local]
  39. an autogenerated dummy bar=1.0/installed
  40. " apt list bar --verbose
  41. # test for dpkg ^rc state
  42. insertinstalledpackage 'conf-only' 'i386' '1.0' '' '' 'deinstall ok config-files'
  43. testsuccessequal "Listing...
  44. conf-only/now 1.0 i386 [residual-config]" apt list conf-only
  45. # ensure that the users learns about multiple versions too
  46. testsuccessequal "Listing...
  47. baz/unstable 2.0 all [upgradable from: 0.1]
  48. N: There are 2 additional versions. Please use the '-a' switch to see them." apt list baz -o quiet=0
  49. testsuccessequal 'Listing...
  50. baz/unstable 2.0 all [upgradable from: 0.1]
  51. baz/testing 1.0 all
  52. baz/now 0.1 all [installed,upgradable to: 2.0]
  53. ' apt list baz -o quiet=0 -a
  54. # test format strings for machine parseable output
  55. testsuccessequal 'bar - 1.0 - 1.0
  56. baz - 0.1 - 2.0' apt list -qq bar baz -o APT::Cmd::use-format=true -o APT::Cmd::format="\${Package} - \${installed:Version} - \${candidate:Version}"