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.
 
 
 
 
 
 

177 lines
5.0 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 'dpkg
  42. bar
  43. fancy
  44. specific
  45. foo' aptcache pkgnames
  46. testsuccessequal 'bar' aptcache pkgnames bar
  47. testsuccessequal 'fancy
  48. foo' 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. <foobar>
  113. <cool>
  114. <cooler>' aptcache depends foo --recurse --implicit
  115. testsuccessequal 'foo
  116. Depends: bar
  117. bar
  118. Depends: bar
  119. Replaces: foo' aptcache depends foo --recurse --important --replaces
  120. testsuccessequal 'foo
  121. Depends: bar
  122. bar
  123. Depends: bar
  124. Replaces: foo' aptcache depends foo --recurse --important --replaces --implicit
  125. testsuccessequal 'bar
  126. Depends: bar
  127. Breaks: foo
  128. Replaces: foo' aptcache depends bar
  129. testsuccessequal 'bar
  130. Depends: bar
  131. Breaks: foo
  132. Replaces: foo' aptcache depends bar --implicit
  133. testsuccessequal 'specific
  134. Depends: <bar:i386>
  135. Depends: <specific:amd64>
  136. specific
  137. Breaks: <foo:amd64>
  138. Replaces: <foo:i386>' aptcache depends specific
  139. testsuccessequal 'specific
  140. Depends: <bar:i386>
  141. Depends: <specific:amd64>
  142. specific
  143. Breaks: <foo:amd64>
  144. Replaces: <foo:i386>' aptcache depends specific --implicit
  145. ## rdepends
  146. # Note that specific does not appear in this list as it doesn't depend on foo,
  147. # but on an arch-specific foo!
  148. testsuccessequal 'foo
  149. Reverse Depends:
  150. bar
  151. bar' aptcache rdepends foo
  152. testsuccessequal 'foo
  153. Reverse Depends:
  154. Breaks: bar
  155. Replaces: bar' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1
  156. testsuccessequal 'foo
  157. Reverse Depends:
  158. Breaks: bar (<< 1)
  159. Replaces: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1
  160. testsuccessequal 'foo
  161. Reverse Depends:
  162. Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 --important --breaks