test-0047.sh 631 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. . ./test-common.sh
  3. cleanup 47
  4. . ./test-common-selinux.sh
  5. if [ $SELINUX_TESTS = 0 ]; then
  6. echo "Skipping SELinux test 47"
  7. exit 77
  8. fi
  9. # ------------------------------- Test 47 ------------------------------------
  10. # test that newly created state file has the same SELinux context as the
  11. # previous one
  12. preptest test.log 47 1
  13. cat > state << EOF
  14. logrotate state -- version 2
  15. EOF
  16. chcon --type=logrotate_tmp_t state
  17. $RLR test-config.47
  18. ls -Z state|grep logrotate_tmp_t >/dev/null
  19. if [ $? != 0 ]; then
  20. echo "state file should have selinux context logrotate_tmp_t."
  21. exit 3
  22. fi
  23. checkoutput <<EOF
  24. test.log 0 zero
  25. EOF