| #! /bin/sh |
| |
| # Copyright (c) International Business Machines Corp., 2002 |
| # |
| # This program is free software; you can redistribute it and/or modify |
| # it under the terms of the GNU General Public License as published by |
| # the Free Software Foundation; either version 2 of the License, or |
| # (at your option) any later version. |
| # |
| # This program is distributed in the hope that it will be useful, |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
| # the GNU General Public License for more details. |
| # |
| # You should have received a copy of the GNU General Public License |
| # along with this program; if not, write to the Free Software |
| # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| |
| # 12/05/02 Port to bash -Robbie Williamson <[email protected]> |
| # 02/05/03 Modified - Manoj Iyer <[email protected]> use USCTEST macros |
| # fixed bugs. |
| # 07/27/05 Michael Reed <[email protected]> |
| # Made changes to account for the replacement of syslogd |
| # with syslog-ng on SLES |
| # |
| ################################################################## |
| # case 6: Test the logging option: LOG_NDELAY # |
| # # |
| # o Do openlog() without LOG_NDELAY option. # |
| # o open a file and check the returned file descriptor # |
| # It should be 3. # |
| # o Now do openlog() with LOG_NDELAY option. # |
| # o open a file and check the returned file descriptor. # |
| # It should be greater than 3. # |
| ################################################################## |
| |
| . syslog-lib.sh || exit 1 |
| |
| syslog_case6() |
| { |
| tst_resm TINFO "syslog: Testing the log option: LOG_NDELAY..." |
| |
| # Create the configuration file specific to this test case. |
| # For this case, it's a dummy one. No use of it. |
| case "$CONFIG_FILE" in |
| /etc/syslog.conf|/etc/rsyslog.conf) |
| echo "$RSYSLOG_CONFIG" > $CONFIG_FILE |
| echo "user.info /var/log/messages" >> $CONFIG_FILE |
| ;; |
| |
| /etc/syslog-ng/syslog-ng.conf) |
| echo "source src{ internal(); unix-dgram(\"/dev/log\"); udp(ip(\"0.0.0.0\") port(514)); };" > $CONFIG_FILE |
| echo "filter f_syslog_user { level(info) and facility(user); };">> $CONFIG_FILE |
| echo "destination syslog-messages { file(\"/var/log/messages\");};" >> $CONFIG_FILE |
| echo "log { source(src); filter(f_syslog_user); destination(syslog-messages);};" >> $CONFIG_FILE |
| ;; |
| esac |
| |
| restart_syslog_daemon |
| |
| if ! syslogtst 6 2>/dev/null; then |
| status_flag=1 |
| fi |
| } |
| |
| tst_resm TINFO " Test the logging option: LOG_NDELAY" |
| tst_resm TINFO " o Do openlog() without LOG_NDELAY option." |
| tst_resm TINFO " o open a file and check the returned file descriptor" |
| tst_resm TINFO " It should be 3." |
| tst_resm TINFO " o Now do openlog() with LOG_NDELAY option." |
| tst_resm TINFO " o open a file and check the returned file descriptor." |
| tst_resm TINFO " It should be greater than 3." |
| |
| setup |
| syslog_case6 |
| cleanup ${status_flag:=0} |