Initial test framework: make check

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2019-10-29 11:08:23 +01:00
parent ec9c92987f
commit b67d57cf59
9 changed files with 47 additions and 5 deletions

1
.gitignore vendored
View File

@ -19,3 +19,4 @@ klogd.service
missing missing
stamp-h1 stamp-h1
syslogd.service syslogd.service
test-driver

View File

@ -16,7 +16,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
SUBDIRS = src man SUBDIRS = man src test
doc_DATA = README.md ChangeLog.md syslog.conf doc_DATA = README.md ChangeLog.md syslog.conf
EXTRA_DIST = README.md ChangeLog.md syslog.conf EXTRA_DIST = README.md ChangeLog.md syslog.conf

View File

@ -23,7 +23,12 @@ AM_SILENT_RULES([yes])
AC_CONFIG_SRCDIR([src/syslogd.c]) AC_CONFIG_SRCDIR([src/syslogd.c])
AC_CONFIG_HEADER([config.h]) AC_CONFIG_HEADER([config.h])
AC_CONFIG_FILES([Makefile src/Makefile man/Makefile klogd.service syslogd.service]) AC_CONFIG_FILES([Makefile
man/Makefile
src/Makefile
test/Makefile
klogd.service
syslogd.service])
AC_PROG_CC AC_PROG_CC
AC_PROG_INSTALL AC_PROG_INSTALL

View File

@ -1,3 +0,0 @@
*.* -/tmp/syslog_tst.log
*.* @192.168.1.1

2
test/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.log
*.trs

6
test/Makefile.am Normal file
View File

@ -0,0 +1,6 @@
EXTRA_DIST = start.sh stop.sh
CLEANFILES = *~ *.trs *.log
TEST_EXTENSIONS = .sh
TESTS = start.sh
TESTS += stop.sh

15
test/start.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
. ./test.rc
if [ x"${srcdir}" = x ]; then
srcdir=.
fi
cat <<EOF > ${CFG}
*.* -${LOG}
*.* @192.168.1.1
EOF
../src/syslogd -d -n -f ${CFG} -p ${SCK} -P ${PID} &
sleep 1

11
test/stop.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
. ./test.rc
if [ -e ${PID} ]; then
kill `cat ${PID}`
fi
rm -f ${CFG}
rm -f ${LOG}
rm -f ${PID}
rm -f ${SCK}

5
test/test.rc Normal file
View File

@ -0,0 +1,5 @@
NM=syslog-test
CFG=/tmp/${NM}.conf
LOG=/tmp/${NM}.log
PID=/tmp/${NM}.pid
SCK=/tmp/${NM}.sock