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.
 
 
 
 
 
 

184 lines
5.1 KiB

  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64' 'i386'
  7. DESCR='Some description
  8. That has multiple lines'
  9. insertpackage 'unstable' 'fancy' 'all' '1'
  10. insertpackage 'unstable,installed' 'foo' 'all' '1' 'Depends: bar
  11. Conflicts: foobar
  12. Recommends: cool (>= 2) | cooler (<< 5)' "$DESCR"
  13. insertpackage 'unstable' 'bar' 'all' '1' 'Depends: bar
  14. Breaks: foo (<< 1)
  15. Replaces: foo (<< 1)' "$DESCR"
  16. insertpackage 'unstable' 'specific' 'all' '1' 'Depends: bar:i386, specific:amd64
  17. Breaks: foo:amd64 (<< 1)
  18. Replaces: foo:i386 (<< 1)' "$DESCR"
  19. setupaptarchive
  20. # dpkg is installed by our framework
  21. testdpkginstalled 'dpkg'
  22. testempty aptcache unmet dpkg
  23. # FIXME: Find some usecase for unmet as it seems kinda useless/broken
  24. #testsuccess aptcache unmet
  25. #testsuccess aptcache unmet foo
  26. # not too useful to test, but makes coverage green…
  27. testsuccess aptcache stats
  28. cp rootdir/tmp/testsuccess.output stats.output
  29. testsuccess test -s stats.output
  30. testfailureequal 'E: apt-cache stats does not take any arguments' aptcache stats foo
  31. testsuccess aptcache xvcg foo
  32. cp rootdir/tmp/testsuccess.output xvcg.output
  33. testsuccess test -s xvcg.output
  34. testsuccess aptcache dotty foo
  35. cp rootdir/tmp/testsuccess.output dotty.output
  36. testsuccess test -s dotty.output
  37. # for this, even the sourcecode says it is useless (expect debugging)
  38. testsuccess aptcache dump
  39. cp rootdir/tmp/testsuccess.output dump.output
  40. testsuccess test -s dump.output
  41. testsuccessequal 'bar
  42. foo
  43. dpkg
  44. specific
  45. fancy' aptcache pkgnames
  46. testsuccessequal 'bar' aptcache pkgnames bar
  47. testsuccessequal 'foo
  48. fancy' aptcache pkgnames f
  49. testsuccessequal " foo | 1 | file:$(readlink -f .)/aptarchive unstable/main all Packages" aptcache madison foo
  50. ### depends
  51. testsuccessequal 'foo
  52. Depends: bar
  53. Conflicts: <foobar>
  54. |Recommends: <cool>
  55. Recommends: <cooler>' aptcache depends foo
  56. testsuccessequal 'foo
  57. Depends: bar
  58. Conflicts: <foobar>
  59. |Recommends: <cool>
  60. Recommends: <cooler>' aptcache depends foo --implicit
  61. testsuccessequal 'foo
  62. Depends: bar
  63. Conflicts: <foobar>
  64. Recommends: <cool>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1
  65. testsuccessequal 'foo
  66. Depends: bar
  67. Conflicts: <foobar>
  68. Recommends: <cool>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1 --implicit
  69. testsuccessequal 'foo
  70. Depends: bar
  71. Conflicts: <foobar>
  72. |Recommends: <cool> (>= 2)
  73. Recommends: <cooler> (<< 5)' aptcache depends foo -o APT::Cache::ShowVersion=1
  74. testsuccessequal 'foo
  75. Depends: bar
  76. Conflicts: <foobar>
  77. |Recommends: <cool> (>= 2)
  78. Recommends: <cooler> (<< 5)' aptcache depends foo -o APT::Cache::ShowVersion=1 --implicit
  79. testsuccessequal 'foo
  80. Depends: bar
  81. Conflicts: <foobar>' aptcache depends foo --no-recommends
  82. testsuccessequal 'foo
  83. Depends: bar
  84. Conflicts: <foobar>' aptcache depends foo --no-recommends --implicit
  85. testsuccessequal 'foo
  86. Depends: bar' aptcache depends foo --important --implicit
  87. testsuccessequal 'foo
  88. Conflicts: <foobar>' aptcache depends foo --important --no-depends --conflicts
  89. testsuccessequal 'foo
  90. Conflicts: <foobar>' aptcache depends foo --important --no-depends --conflicts --implicit
  91. testsuccessequal 'foo
  92. Depends: bar
  93. Conflicts: <foobar>
  94. |Recommends: <cool>
  95. Recommends: <cooler>
  96. bar
  97. Depends: bar
  98. Breaks: foo
  99. Replaces: foo
  100. <foobar>
  101. <cool>
  102. <cooler>' aptcache depends foo --recurse
  103. testsuccessequal 'foo
  104. Depends: bar
  105. Conflicts: <foobar>
  106. |Recommends: <cool>
  107. Recommends: <cooler>
  108. bar
  109. Depends: bar
  110. Breaks: foo
  111. Replaces: foo
  112. Breaks: <foo:i386>
  113. Replaces: <foo:i386>
  114. <foobar>
  115. <cool>
  116. <cooler>
  117. <foo:i386>' aptcache depends foo --recurse --implicit
  118. testsuccessequal 'foo
  119. Depends: bar
  120. bar
  121. Depends: bar
  122. Replaces: foo' aptcache depends foo --recurse --important --replaces
  123. testsuccessequal 'foo
  124. Depends: bar
  125. bar
  126. Depends: bar
  127. Replaces: foo
  128. Replaces: <foo:i386>
  129. <foo:i386>' aptcache depends foo --recurse --important --replaces --implicit
  130. testsuccessequal 'bar
  131. Depends: bar
  132. Breaks: foo
  133. Replaces: foo' aptcache depends bar
  134. testsuccessequal 'bar
  135. Depends: bar
  136. Breaks: foo
  137. Replaces: foo
  138. Breaks: <foo:i386>
  139. Replaces: <foo:i386>' aptcache depends bar --implicit
  140. testsuccessequal 'specific
  141. Depends: <bar:i386>
  142. Depends: <specific:amd64>
  143. specific
  144. Breaks: <foo:amd64>
  145. Replaces: <foo:i386>' aptcache depends specific
  146. testsuccessequal 'specific
  147. Depends: <bar:i386>
  148. Depends: <specific:amd64>
  149. specific
  150. Breaks: <foo:amd64>
  151. Replaces: <foo:i386>' aptcache depends specific --implicit
  152. ## rdepends
  153. # Note that specific does not appear in this list as it doesn't depend on foo,
  154. # but on an arch-specific foo!
  155. testsuccessequal 'foo
  156. Reverse Depends:
  157. bar
  158. bar' aptcache rdepends foo
  159. testsuccessequal 'foo
  160. Reverse Depends:
  161. Breaks: bar
  162. Replaces: bar' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1
  163. testsuccessequal 'foo
  164. Reverse Depends:
  165. Breaks: bar (<< 1)
  166. Replaces: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1
  167. testsuccessequal 'foo
  168. Reverse Depends:
  169. Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 --important --breaks