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

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