test-0018.sh 852 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. . ./test-common.sh
  3. cleanup 18
  4. # ------------------------------- Test 18 ------------------------------------
  5. preptest test.log 18 1
  6. $RLR test-config.18 -l syslog --force
  7. checkoutput <<EOF
  8. test.log 0
  9. test.log.1.Z 1 zero
  10. EOF
  11. (echo "gzip -f -9") | diff -u - compress-args
  12. egrep -q '^LOGROTATE_COMPRESSED_FILENAME=.+/test.log.1$' compress-env
  13. if [ $? != 0 ]; then
  14. echo "LOGROTATE_COMPRESSED_FILENAME environment variable not found."
  15. cat compress-env
  16. exit 3
  17. fi
  18. SYSLOG_TESTS=0
  19. logger syslog_test 2>/dev/null
  20. if [ $? = 0 ]; then
  21. journalctl -n 50 2>/dev/null | grep syslog_test 2>/dev/null >/dev/null
  22. if [ $? = 0 ]; then
  23. SYSLOG_TESTS=1
  24. fi
  25. fi
  26. if [ $SYSLOG_TESTS = 1 ]; then
  27. journalctl -n 50 2>/dev/null|grep $PWD/test.log.1 2>/dev/null >/dev/null
  28. if [ $? != 0 ]; then
  29. echo "syslog message not found"
  30. exit 1
  31. fi
  32. fi