test-bug-612958-use-dpkg-multiarch-config 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'i386'
  7. testpass() {
  8. msgtest 'Test architecture handling success' "$1 with $2"
  9. rm -f archs.conf
  10. aptconfig dump --no-empty --format='%V%n' APT::Architectures > archs.conf
  11. testsuccess --nomsg grep "^$2\$" archs.conf
  12. }
  13. testfail() {
  14. msgtest 'Test architecture handling failure' "$1 with $2"
  15. rm -f archs.conf
  16. aptconfig dump --no-empty --format='%V%n' APT::Architectures > archs.conf
  17. testfailure --nomsg grep "^$2\$" archs.conf
  18. }
  19. testpass 'no config' 'i386'
  20. testfail 'no config' 'amd64'
  21. testfail 'no config' 'armel'
  22. CONFFILE=rootdir/etc/apt/apt.conf.d/99multiarch
  23. echo '#clear APT::Architectures;' >> $CONFFILE
  24. echo 'APT::Architectures:: "i386";' >> $CONFFILE
  25. echo 'APT::Architectures:: "amd64";' >> $CONFFILE
  26. testpass 'apt config' 'i386'
  27. testpass 'apt config' 'amd64'
  28. testfail 'apt config' 'armel'
  29. echo 'APT::Architectures:: "armel";' >> $CONFFILE
  30. testpass 'apt config' 'armel'
  31. rm $CONFFILE
  32. echo '#clear APT::Architectures;' >> $CONFFILE
  33. echo 'APT::Architectures "i386,amd64";' >> $CONFFILE
  34. testpass 'apt config' 'i386'
  35. testpass 'apt config' 'amd64'
  36. testfail 'apt config' 'armel'
  37. rm $CONFFILE
  38. echo '#clear APT::Architectures;' >> $CONFFILE
  39. echo 'Dir::Bin::dpkg "./dpkg-printer";' >> $CONFFILE
  40. echo '#! /bin/sh
  41. echo "amd64"' > ./dpkg-printer
  42. chmod +x ./dpkg-printer
  43. testpass 'dpkg config' 'i386'
  44. testpass 'dpkg config' 'amd64'
  45. testfail 'dpkg config' 'armel'
  46. echo '#! /bin/sh
  47. echo "amd64 armel"' > ./dpkg-printer
  48. testpass 'dpkg config' 'i386'
  49. testpass 'dpkg config' 'amd64'
  50. testpass 'dpkg config' 'armel'
  51. echo '#! /bin/sh
  52. echo "amd64
  53. armel"' > ./dpkg-printer
  54. testpass 'dpkg config' 'i386'
  55. testpass 'dpkg config' 'amd64'
  56. testpass 'dpkg config' 'armel'
  57. echo '#! /bin/sh
  58. echo "amd64
  59. i386"' > ./dpkg-printer
  60. testpass 'dpkg config' 'i386'
  61. testpass 'dpkg config' 'amd64'
  62. testfail 'dpkg config' 'armel'