Add simple API test, syslog() no call to openlog()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
c05956010c
commit
b1548e7c73
2
test/.gitignore
vendored
2
test/.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
*.o
|
||||
*.log
|
||||
*.trs
|
||||
api
|
||||
|
@ -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
|
||||
|
||||
|
14
test/api.c
Normal file
14
test/api.c
Normal file
@ -0,0 +1,14 @@
|
||||
#include <stdlib.h>
|
||||
#include "syslog.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char *msg = getenv("MSG");
|
||||
|
||||
if (!msg)
|
||||
return 1;
|
||||
|
||||
syslog(LOG_ERR, msg);
|
||||
|
||||
return 0;
|
||||
}
|
7
test/api.sh
Executable file
7
test/api.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
. ./test.rc
|
||||
|
||||
export MSG="no-openlog-apitest"
|
||||
./api
|
||||
grep "api ${MSG}" ${LOG}
|
@ -6,3 +6,5 @@ CONF=/tmp/${NM}.conf
|
||||
CONFD=/tmp/${NM}.d
|
||||
SOCK=/tmp/${NM}.sock
|
||||
PORT=5514
|
||||
|
||||
export SYSLOG_UNIX_PATH=${SOCK}
|
||||
|
Loading…
Reference in New Issue
Block a user