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.
 
 
 
 
 
 

148 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. insertinstalledpackage 'cool' 'all' '1'
  8. insertinstalledpackage 'stuff' 'all' '1'
  9. insertinstalledpackage 'somestuff' 'all' '1' 'Depends: cool, stuff'
  10. insertpackage 'unstable' 'cool' 'all' '2' 'Multi-Arch: foreign'
  11. insertpackage 'unstable' 'stuff' 'all' '2' 'Multi-Arch: foreign'
  12. insertpackage 'unstable' 'coolstuff' 'i386,amd64' '2' 'Depends: cool, stuff'
  13. insertpackage 'unstable' 'awesome' 'all' '2' 'Multi-Arch: foreign
  14. Conflicts: badstuff'
  15. insertpackage 'unstable' 'badstuff' 'all' '2' 'Multi-Arch: foreign
  16. Conflicts: awesome'
  17. insertpackage 'unstable' 'awesomecoolstuff' 'i386' '2' 'Depends: coolstuff, awesome'
  18. insertpackage 'experimental' 'cool' 'all' '3' 'Multi-Arch: foreign'
  19. insertpackage 'experimental' 'stuff' 'all' '3' 'Multi-Arch: foreign'
  20. insertpackage 'experimental' 'coolstuff' 'i386,amd64' '3' 'Depends: cool, stuff'
  21. setupaptarchive
  22. testfailure aptget install --solver dump coolstuff -s
  23. testsuccess grep ERR_NO_FILENAME rootdir/tmp/testfailure.output
  24. export APT_EDSP_DUMP_FILENAME="/nonexistent/apt/edsp.dump"
  25. testfailure aptget install --solver dump coolstuff -s
  26. testsuccess grep ERR_WRITE_ERROR rootdir/tmp/testfailure.output
  27. export APT_EDSP_DUMP_FILENAME="${TMPWORKINGDIRECTORY}/downloaded/dump.edsp"
  28. testfailureequal 'Reading package lists...
  29. Building dependency tree...
  30. Execute external solver...
  31. The solver encountered an error of type: ERR_JUST_DUMPING
  32. The following information might help you to understand what is wrong:
  33. I am too dumb, i can just dump!
  34. Please use one of my friends instead!
  35. E: External solver failed with: I am too dumb, i can just dump!' aptget install --solver dump coolstuff -s
  36. testsuccess test -s "$APT_EDSP_DUMP_FILENAME"
  37. rm -f "$APT_EDSP_DUMP_FILENAME"
  38. testsuccessequal 'Reading package lists...
  39. Building dependency tree...
  40. Execute external solver...
  41. The following NEW packages will be installed:
  42. coolstuff
  43. 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
  44. Inst coolstuff (2 unstable [amd64])
  45. Conf coolstuff (2 unstable [amd64])' aptget install --solver apt coolstuff -s
  46. testsuccessequal 'Reading package lists...
  47. Building dependency tree...
  48. Execute external solver...
  49. The following NEW packages will be installed:
  50. coolstuff
  51. 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
  52. Inst coolstuff (3 experimental [amd64])
  53. Conf coolstuff (3 experimental [amd64])' aptget install --solver apt coolstuff -s -t experimental
  54. testsuccessequal 'Reading package lists...
  55. Building dependency tree...
  56. Execute external solver...
  57. The following packages will be REMOVED:
  58. somestuff
  59. 0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded.
  60. Remv somestuff [1]' aptget autoremove --solver apt somestuff -s
  61. testsuccess aptmark auto cool stuff
  62. testsuccessequal 'Reading package lists...
  63. Building dependency tree...
  64. Reading state information...
  65. Execute external solver...
  66. The following packages will be REMOVED:
  67. cool somestuff stuff
  68. 0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
  69. Remv somestuff [1]
  70. Remv cool [1]
  71. Remv stuff [1]' aptget autoremove --solver apt somestuff -s
  72. testsuccessequal "Reading package lists...
  73. Building dependency tree...
  74. Reading state information...
  75. Execute external solver...
  76. The following package was automatically installed and is no longer required:
  77. stuff
  78. Use 'apt-get autoremove' to remove it.
  79. The following packages will be REMOVED:
  80. cool* somestuff*
  81. 0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
  82. Purg somestuff [1]
  83. Purg cool [1]" aptget purge --solver apt cool -s
  84. testsuccess aptget install awesomecoolstuff:i386 -s
  85. testsuccess aptget install --solver apt awesomecoolstuff:i386 -s
  86. rm -f "$APT_EDSP_DUMP_FILENAME"
  87. testfailure aptget install --solver dump awesomecoolstuff:i386 -s
  88. testsuccess test -s "$APT_EDSP_DUMP_FILENAME"
  89. testequal 'Install: awesomecoolstuff:i386' grep :i386 "$APT_EDSP_DUMP_FILENAME"
  90. testempty grep -e ':amd64' -e 'Architecture: any' "$APT_EDSP_DUMP_FILENAME"
  91. testsuccess aptget dist-upgrade -s
  92. testsuccess aptget dist-upgrade -s --solver apt
  93. testsuccess aptget upgrade -s
  94. testsuccess aptget upgrade -s --solver apt
  95. testfailure aptget install awesome badstuff -s
  96. testfailure aptget install awesome badstuff -s --solver apt
  97. testsuccess grep 'ERR_UNSOLVABLE' rootdir/tmp/testfailure.output
  98. configarchitecture 'armel'
  99. testfailure aptget install --solver apt awesomecoolstuff:i386 -s
  100. msgtest 'An invalid EDSP file generates a' 'hard error'
  101. if echo "Request: This is a test\nFoo: bar\n\n" | aptinternalsolver -q=0 > solver.result 2>&1; then
  102. cat solver.result
  103. msgfail
  104. else
  105. msgpass
  106. fi
  107. msgtest 'Test direct calling is okay for' 'apt-internal-solver'
  108. cat "$APT_EDSP_DUMP_FILENAME" | aptinternalsolver -q=0 > solver.result 2>&1 || true
  109. if [ "$(tail -n2 solver.result | head -n1 )" = "Message: Done" ]; then
  110. msgpass
  111. else
  112. cat solver.result
  113. msgfail
  114. fi
  115. rm -f "$APT_EDSP_DUMP_FILENAME"
  116. testsuccess aptinternalsolver scenario
  117. testsuccessequal 'Package: stuff
  118. Source: stuff
  119. Architecture: all
  120. Version: 1
  121. Source-Version: 1
  122. Installed: yes
  123. APT-ID: 2
  124. Priority: optional
  125. Section: other
  126. APT-Pin: 100
  127. APT-Candidate: yes
  128. ' aptinternalsolver scenario stuff