test-external-dependency-solver-protocol 4.7 KB

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