test-apt-helper-cat-file 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. TESTTOOL="${BUILDDIRECTORY}/../test/interactive-helper/test_fileutl"
  7. msgtest 'Check if we have build the test tool' "$TESTTOOL"
  8. if [ -x "$TESTTOOL" ]; then
  9. msgpass
  10. else
  11. msgskip 'not available'
  12. exit 0
  13. fi
  14. cat >rootdir/etc/apt/apt.conf.d/rev-as-compressor <<EOF
  15. APT::Compressor::rev {
  16. Name "rev";
  17. Extension ".rev";
  18. Binary "rev";
  19. Cost "1";
  20. };
  21. EOF
  22. configcompression 'ALL'
  23. cat >./test.txt <<EOF
  24. This is a test.
  25. EOF
  26. compressfile ./test.txt
  27. while read compressor extension command; do
  28. if [ "$compressor" = '.' ]; then
  29. FILE='./test.txt'
  30. else
  31. FILE="./test.txt.${extension}"
  32. fi
  33. if [ -d /proc/self/fd ]; then
  34. testsuccess runapt "${TESTTOOL}" "$FILE"
  35. testequal '3' grep -c '/test.txt' rootdir/tmp/testsuccess.output
  36. else
  37. msgtest 'Test if /proc interface is available'
  38. msgskip 'seems not'
  39. fi
  40. testsuccessequal "$(cat ./test.txt)" apthelper cat-file "$FILE"
  41. done < "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf"