diff --git a/test/.gitignore b/test/.gitignore index 7e563b8..c75e349 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -1,2 +1,4 @@ +*.o *.log *.trs +api diff --git a/test/Makefile.am b/test/Makefile.am index 18f9ec6..79d6f33 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,9 +1,17 @@ EXTRA_DIST = start.sh stop.sh -EXTRA_DIST += local.sh remote.sh +EXTRA_DIST += api.sh local.sh remote.sh CLEANFILES = *~ *.trs *.log TEST_EXTENSIONS = .sh +check_PROGRAMS = api +api_SOURCES = api.c +api_CFLAGS = -I../src +api_LDFLAGS = -static +api_LDADD = -L../src ../src/libsyslog.la + TESTS = start.sh TESTS += local.sh TESTS += remote.sh +TESTS += api.sh TESTS += stop.sh + diff --git a/test/api.c b/test/api.c new file mode 100644 index 0000000..d89b8b1 --- /dev/null +++ b/test/api.c @@ -0,0 +1,14 @@ +#include +#include "syslog.h" + +int main(void) +{ + char *msg = getenv("MSG"); + + if (!msg) + return 1; + + syslog(LOG_ERR, msg); + + return 0; +} diff --git a/test/api.sh b/test/api.sh new file mode 100755 index 0000000..c97c18c --- /dev/null +++ b/test/api.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +. ./test.rc + +export MSG="no-openlog-apitest" +./api +grep "api ${MSG}" ${LOG} diff --git a/test/test.rc b/test/test.rc index 4d00bb5..ff4e43a 100644 --- a/test/test.rc +++ b/test/test.rc @@ -5,4 +5,6 @@ CAP=/tmp/${NM}.pcapng CONF=/tmp/${NM}.conf CONFD=/tmp/${NM}.d SOCK=/tmp/${NM}.sock -PORT=5514 \ No newline at end of file +PORT=5514 + +export SYSLOG_UNIX_PATH=${SOCK}