test-apt-cli-list 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. dpkg/now 1.16.2+fake all [installed,local]
  19. foo/unstable 1.0 all
  20. foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list
  21. testsuccessequal "Listing...
  22. foo/unstable 1.0 all
  23. foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list "foo*"
  24. testsuccessequal "Listing...
  25. baz/unstable 2.0 all [upgradable from: 0.1]
  26. foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list --upgradable
  27. # FIXME: hm, hm - does it make sense to have this different? shouldn't
  28. # we use "installed,upgradable" consitently?
  29. testsuccessequal "Listing...
  30. bar/now 1.0 i386 [installed,local]
  31. baz/now 0.1 all [installed,upgradable to: 2.0]
  32. dpkg/now 1.16.2+fake all [installed,local]
  33. foobar/now 1.0 i386 [installed,upgradable to: 2.0]" apt list --installed
  34. testsuccessequal "Listing...
  35. bar/now 1.0 i386 [installed,local]
  36. foobar/unstable 2.0 i386 [upgradable from: 1.0]
  37. foobar/now 1.0 i386 [installed,upgradable to: 2.0]
  38. " apt list bar foobar --all-versions
  39. testsuccessequal "Listing...
  40. bar/now 1.0 i386 [installed,local]
  41. an autogenerated dummy bar=1.0/installed
  42. " apt list bar --verbose
  43. # test for dpkg ^rc state
  44. insertinstalledpackage 'conf-only' 'i386' '1.0' '' '' 'deinstall ok config-files'
  45. testsuccessequal "Listing...
  46. conf-only/now 1.0 i386 [residual-config]" apt list conf-only
  47. # ensure that the users learns about multiple versions too
  48. testsuccessequal "Listing...
  49. baz/unstable 2.0 all [upgradable from: 0.1]
  50. N: There are 2 additional versions. Please use the '-a' switch to see them." apt list baz -o quiet=0
  51. testsuccessequal 'Listing...
  52. baz/unstable 2.0 all [upgradable from: 0.1]
  53. baz/testing 1.0 all
  54. baz/now 0.1 all [installed,upgradable to: 2.0]
  55. ' apt list baz -o quiet=0 -a
  56. # test format strings for machine parseable output
  57. testsuccessequal 'bar - 1.0 - 1.0
  58. 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}"