Olaf Mandel
2016-06-22 09:03:01 UTC
Hello,
I am trying to use GNU Autotest (via AX_GNU_AUTOTEST()) to run
end-to-end tests on a network server. My current test script looks
somewhat like this:
AT_CHECK([server&], , [ignore])
AT_CHECK([client --cmd]), , [expected-output])
AT_CHECK([killall server], , [ignore])
This is far from perfect, however: there is no cleanup if the client
check fails or if the executable is called differently (see below).
Now I want to combine this with valgrind checking (from
AX_VALGRIND_CHECK()): I defined the check-TESTS target in the Makefile
so it calls "make check-autotest" and renames the log files to the
expected names and I added a macro to the test script to use an
environment variable RUNNER:
AC_DEFUN([WRAP_CMD], [${RUNNER} $(which $1) $2])
AT_CHECK(WRAP_CMD([server], [&]), , [ignore])
AT_CHECK(WRAP_CMD([client], [--cmd]), , [expected-output])
AT_CHECK(WRAP_CMD([killall], [server]), , [ignore])
But this fails to kill the server simply because the actual command
being executed by the first AT_CHECK with make check-valgrind is:
valgrind --error-exitcode=1 --quiet ./server &
So the simple killall call is no longer feasible.
Now my question: is there a standard and approved way to start a
background process in a GNU Autotest script and to kill it at or before
the AT_CLEANUP ?
Thank you for any suggestions,
Olaf Mandel
I am trying to use GNU Autotest (via AX_GNU_AUTOTEST()) to run
end-to-end tests on a network server. My current test script looks
somewhat like this:
AT_CHECK([server&], , [ignore])
AT_CHECK([client --cmd]), , [expected-output])
AT_CHECK([killall server], , [ignore])
This is far from perfect, however: there is no cleanup if the client
check fails or if the executable is called differently (see below).
Now I want to combine this with valgrind checking (from
AX_VALGRIND_CHECK()): I defined the check-TESTS target in the Makefile
so it calls "make check-autotest" and renames the log files to the
expected names and I added a macro to the test script to use an
environment variable RUNNER:
AC_DEFUN([WRAP_CMD], [${RUNNER} $(which $1) $2])
AT_CHECK(WRAP_CMD([server], [&]), , [ignore])
AT_CHECK(WRAP_CMD([client], [--cmd]), , [expected-output])
AT_CHECK(WRAP_CMD([killall], [server]), , [ignore])
But this fails to kill the server simply because the actual command
being executed by the first AT_CHECK with make check-valgrind is:
valgrind --error-exitcode=1 --quiet ./server &
So the simple killall call is no longer feasible.
Now my question: is there a standard and approved way to start a
background process in a GNU Autotest script and to kill it at or before
the AT_CLEANUP ?
Thank you for any suggestions,
Olaf Mandel