From 274415d050766240f88baa74288cd901950ba1b0 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Thu, 1 Mar 2018 19:17:35 +0100 Subject: [PATCH] tests: use the --pid-file and -p options in ocserv This allows detecting issues like in #143 where these two options regressed. Signed-off-by: Nikos Mavrogiannopoulos --- tests/test-pass | 7 ++++++- tests/test-pass-opt-cert | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/test-pass b/tests/test-pass index b60ee8b4..ca0b037a 100755 --- a/tests/test-pass +++ b/tests/test-pass @@ -22,13 +22,14 @@ SERV="${SERV:-../src/ocserv}" srcdir=${srcdir:-.} NO_NEED_ROOT=1 PORT=4444 +PIDFILE=ocserv-pid.$$.tmp . `dirname $0`/common.sh echo "Testing local backend with username-password... " update_config test1.config -launch_sr_server -d 1 -f -c ${CONFIG} & PID=$! +launch_sr_server -d 1 -p ${PIDFILE} -f -c ${CONFIG} & PID=$! wait_server $PID echo "Connecting to obtain cookie... " @@ -63,6 +64,10 @@ echo "Connecting to obtain cookie with empty password... " #( echo "test" | LD_PRELOAD=libsocket_wrapper.so $OPENCONNECT -q $ADDRESS:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true ) || # fail $PID "Could not connect to server" +if ! test -f ${PIDFILE};then + fail $PID "Could not find pid file ${PIDFILE}" +fi + cleanup exit 0 diff --git a/tests/test-pass-opt-cert b/tests/test-pass-opt-cert index ee2d5260..86d20e69 100755 --- a/tests/test-pass-opt-cert +++ b/tests/test-pass-opt-cert @@ -23,13 +23,14 @@ srcdir=${srcdir:-.} TMPFILE=${srcdir}/outfile.$$.tmp NO_NEED_ROOT=1 PORT=8445 +PIDFILE=ocserv-pid.$$.tmp . `dirname $0`/common.sh echo "Testing local backend with username-password and optional certificate... " update_config test-pass-opt-cert.config -launch_sr_server -d 1 -f -c ${CONFIG} & PID=$! +launch_sr_server -d 1 -f --pid-file ${PIDFILE} -c ${CONFIG} & PID=$! wait_server $PID connect() @@ -80,6 +81,10 @@ if test $? = 0;then fi echo ok +if ! test -f ${PIDFILE};then + fail $PID "Could not find pid file ${PIDFILE}" +fi + cleanup exit 0