syslog06 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #! /bin/sh
  2. # Copyright (c) International Business Machines Corp., 2002
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
  12. # the GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. # 12/05/02 Port to bash -Robbie Williamson <robbiew@us.ibm.com>
  18. # 02/05/03 Modified - Manoj Iyer <manjo@mail.utexas.edu> use USCTEST macros
  19. # fixed bugs.
  20. # 07/27/05 Michael Reed <mreedltp@vnet.ibm.com>
  21. # Made changes to account for the replacement of syslogd
  22. # with syslog-ng on SLES
  23. #
  24. ##################################################################
  25. # case 6: Test the logging option: LOG_NDELAY #
  26. # #
  27. # o Do openlog() without LOG_NDELAY option. #
  28. # o open a file and check the returned file descriptor #
  29. # It should be 3. #
  30. # o Now do openlog() with LOG_NDELAY option. #
  31. # o open a file and check the returned file descriptor. #
  32. # It should be greater than 3. #
  33. ##################################################################
  34. . syslog-lib.sh || exit 1
  35. syslog_case6()
  36. {
  37. tst_resm TINFO "syslog: Testing the log option: LOG_NDELAY..."
  38. # Create the configuration file specific to this test case.
  39. # For this case, it's a dummy one. No use of it.
  40. case "$CONFIG_FILE" in
  41. /etc/syslog.conf|/etc/rsyslog.conf)
  42. echo "$RSYSLOG_CONFIG" > $CONFIG_FILE
  43. echo "user.info /var/log/messages" >> $CONFIG_FILE
  44. ;;
  45. /etc/syslog-ng/syslog-ng.conf)
  46. echo "source src{ internal(); unix-dgram(\"/dev/log\"); udp(ip(\"0.0.0.0\") port(514)); };" > $CONFIG_FILE
  47. echo "filter f_syslog_user { level(info) and facility(user); };">> $CONFIG_FILE
  48. echo "destination syslog-messages { file(\"/var/log/messages\");};" >> $CONFIG_FILE
  49. echo "log { source(src); filter(f_syslog_user); destination(syslog-messages);};" >> $CONFIG_FILE
  50. ;;
  51. esac
  52. restart_syslog_daemon
  53. if ! syslogtst 6 2>/dev/null; then
  54. status_flag=1
  55. fi
  56. }
  57. tst_resm TINFO " Test the logging option: LOG_NDELAY"
  58. tst_resm TINFO " o Do openlog() without LOG_NDELAY option."
  59. tst_resm TINFO " o open a file and check the returned file descriptor"
  60. tst_resm TINFO " It should be 3."
  61. tst_resm TINFO " o Now do openlog() with LOG_NDELAY option."
  62. tst_resm TINFO " o open a file and check the returned file descriptor."
  63. tst_resm TINFO " It should be greater than 3."
  64. setup
  65. syslog_case6
  66. cleanup ${status_flag:=0}