test-0006.sh 812 B

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