test-0046.sh 706 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. . ./test-common.sh
  3. cleanup 46
  4. # ------------------------------- Test 46 ------------------------------------
  5. # the state file is truncated and obviously corrupt
  6. preptest test.log 46 1
  7. cat > state << EOF
  8. logrotate state -- version 1
  9. "$PWD/test.log" 2000-1-1
  10. "$PWD/test2.l
  11. EOF
  12. DATESTRING=$(/bin/date +%Y%m%d)
  13. $RLR test-config.46 2>error.log
  14. grep "error: bad line 3 in state file state" error.log >/dev/null
  15. if [ $? != 0 ]; then
  16. echo "No error printed, but there should be one."
  17. exit 3
  18. fi
  19. rm -f error.log
  20. checkoutput <<EOF
  21. test.log 0
  22. EOF
  23. . ./test-common-selinux.sh
  24. if [ $SELINUX_TESTS = 1 ]; then
  25. chcon --type=logrotate_tmp_t test.log
  26. else
  27. echo "Skipping SELinux part of test 46"
  28. fi