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