test-0063.sh 973 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. . ./test-common.sh
  3. cleanup 63
  4. # ------------------------------- Test 63 ------------------------------------
  5. # Rotate sparse file, no data should be lost when hole is in the end of file
  6. preptest test.log 63 1 0
  7. printf zero > test.log
  8. truncate -s 10M test.log
  9. cp test.log test.example
  10. SIZE_SPARSE_OLD=$(du test.log|awk '{print $1}')
  11. SIZE_OLD=$(du --apparent-size test.log|awk '{print $1}')
  12. $RLR test-config.63 --force
  13. SIZE_NEW=$(du --apparent-size test.log.1|awk '{print $1}')
  14. SIZE_SPARSE_NEW=$(du test.log.1|awk '{print $1}')
  15. if [ $SIZE_OLD != $SIZE_NEW ]; then
  16. echo "Bad apparent size of sparse logs"
  17. echo "test.log: $SIZE_OLD"
  18. echo "test.log.1: $SIZE_NEW"
  19. exit 3
  20. fi
  21. if [ $SIZE_SPARSE_OLD -gt 100 ] || [ $SIZE_SPARSE_NEW -gt 100 ]; then
  22. echo "Bad size of sparse logs"
  23. echo "test.log: $SIZE_SPARSE_OLD"
  24. echo "test.log.1: $SIZE_SPARSE_NEW"
  25. exit 3
  26. fi
  27. checkoutput <<EOF
  28. test.log 0
  29. test.log.1 0 zero
  30. EOF
  31. rm -f test.example