test-0062.sh 988 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/bash
  2. . ./test-common.sh
  3. cleanup 62
  4. # ------------------------------- Test 62 ------------------------------------
  5. # Rotate sparse file
  6. preptest test.log 62 1 0
  7. printf zero > test.log
  8. truncate -s 10M test.log
  9. echo x >> test.log
  10. cp test.log test.example
  11. SIZE_SPARSE_OLD=$(du test.log|awk '{print $1}')
  12. if [ $SIZE_SPARSE_OLD -gt 100 ]; then
  13. echo "unable to create (or detect) sparse files"
  14. exit 77
  15. fi
  16. SIZE_OLD=$(du --apparent-size test.log|awk '{print $1}')
  17. $RLR test-config.62 --force
  18. SIZE_NEW=$(du --apparent-size test.log.1|awk '{print $1}')
  19. SIZE_SPARSE_NEW=$(du test.log.1|awk '{print $1}')
  20. if [ $SIZE_OLD != $SIZE_NEW ]; then
  21. echo "Bad apparent size of sparse logs"
  22. echo "test.log: $SIZE_OLD"
  23. echo "test.log.1: $SIZE_NEW"
  24. exit 3
  25. fi
  26. if [ $SIZE_SPARSE_NEW -gt 100 ]; then
  27. echo "Bad size of sparse logs"
  28. echo "test.log: $SIZE_SPARSE_OLD"
  29. echo "test.log.1: $SIZE_SPARSE_NEW"
  30. exit 3
  31. fi
  32. checkoutput <<EOF
  33. test.log 0
  34. test.log.1 0 zerox
  35. EOF
  36. rm -f test.example