test-apt-mark 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture 'amd64' 'i386'
  7. insertpackage 'unstable' 'bar' 'amd64,i386' '1'
  8. insertpackage 'unstable' 'uninstalled' 'all' '1'
  9. insertpackage 'unstable' 'uninstalled-native' 'amd64' '1'
  10. insertinstalledpackage 'foo' 'all' '1'
  11. insertinstalledpackage 'bar' 'amd64' '1'
  12. setupaptarchive
  13. # dpkg is "installed" by our test framework
  14. testdpkginstalled dpkg
  15. testnoautopkg() {
  16. testempty aptmark showauto
  17. testequal 'bar
  18. dpkg
  19. foo' aptmark showmanual
  20. testequal 'bar
  21. foo' aptmark showmanual bar foo uninstalled
  22. }
  23. testmarkonpkgasauto() {
  24. testsuccess aptmark $1 foo
  25. testequal 'foo' aptmark showauto
  26. testequal 'foo' aptmark showauto foo
  27. testequal 'bar
  28. dpkg' aptmark showmanual
  29. testequal 'bar' aptmark showmanual bar
  30. testsuccess aptmark $2 foo
  31. testnoautopkg
  32. }
  33. testequal 'E: No packages found' aptmark auto
  34. testequal 'E: No packages found' aptmark manual
  35. testnoautopkg
  36. testmarkonpkgasauto 'auto' 'manual'
  37. testmarkonpkgasauto 'markauto' 'unmarkauto'
  38. testnoholdpkg() {
  39. testempty aptmark showhold
  40. testempty aptmark showholds # typical "typo"
  41. testempty aptmark showhold dpkg
  42. testempty aptmark showholds dpkg
  43. }
  44. testmarkonepkgashold() {
  45. testsuccess aptmark hold $1
  46. testequal "$1" aptmark showhold
  47. testequal "$1" aptmark showholds
  48. testsuccess aptmark unhold $1
  49. testnoholdpkg
  50. }
  51. testequal 'E: No packages found' aptmark hold
  52. testequal 'E: No packages found' aptmark unhold
  53. testnoholdpkg
  54. testmarkonepkgashold 'foo'
  55. testmarkonepkgashold 'bar'
  56. testmarkonepkgashold 'uninstalled'
  57. testmarkonepkgashold 'uninstalled-native'
  58. testequal 'uninstalled set on hold.' aptmark hold uninstalled
  59. testequal 'uninstalled-native set on hold.' aptmark hold uninstalled-native