test-0010.sh 922 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. . ./test-common.sh
  3. cleanup 10
  4. # ------------------------------- Test 10 ------------------------------------
  5. preptest test.log 10 1
  6. . ./test-common-selinux.sh
  7. if [ $SELINUX_TESTS = 1 ]; then
  8. chcon --type=logrotate_tmp_t test.log
  9. else
  10. echo "Skipping SELinux part of test 10"
  11. fi
  12. $RLR test-config.10 --force
  13. checkoutput <<EOF
  14. test.log 0
  15. test.log.1 0 zero
  16. EOF
  17. echo "newfile" > test.log
  18. $RLR test-config.10 --force
  19. if [ $SELINUX_TESTS = 1 ]; then
  20. ls -Z test.log.2.gz|grep logrotate_tmp_t >/dev/null
  21. if [ $? != 0 ]; then
  22. echo "test.log.2.gz should have selinux context logrotate_tmp_t."
  23. ls -Z test.log.2.gz
  24. exit 3
  25. fi
  26. ls -Z test.log.1|grep logrotate_tmp_t >/dev/null
  27. if [ $? != 0 ]; then
  28. echo "test.log.1 should have selinux context logrotate_tmp_t."
  29. ls -Z test.log.1
  30. exit 3
  31. fi
  32. fi
  33. checkoutput <<EOF
  34. test.log 0
  35. test.log.1 0 newfile
  36. test.log.2.gz 1 zero
  37. EOF
  38. checkmail test.log.1 newfile