diff options
-rw-r--r-- | test/CMakeLists.txt | 4 | ||||
-rwxr-xr-x | test/afb-test.sh | 37 |
2 files changed, 21 insertions, 20 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0c42261..94dca38 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -21,7 +21,7 @@ # ----------------------------------------------------- PROJECT_SUBDIRS_ADD(${PROJECT_SRC_DIR_PATTERN}) -ADD_TEST(NAME AGL_SERVICE_CAN_LOW_LEVEL_TESTS +ADD_TEST(NAME AFB-TEST_TESTS WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND afb-test.sh ${CMAKE_BINARY_DIR} + COMMAND afb-test.sh "${CMAKE_BINARY_DIR}" ) diff --git a/test/afb-test.sh b/test/afb-test.sh index 03f256b..b30ffcc 100755 --- a/test/afb-test.sh +++ b/test/afb-test.sh @@ -1,42 +1,43 @@ #!/bin/sh -trap cleanup SIGINT SIGTERM SIGABRT SIGHUP +trap "cleanup 1" SIGINT SIGTERM SIGABRT SIGHUP +trap "cleanup 0" EXIT cleanup() { - rm -f $LOGPIPE + trap '' SIGINT SIGTERM SIGABRT SIGHUP EXIT + kill $AFTESTPID + rm -f $AFTESTSOCKET pkill $PROCNAME - exit 1 + exit $1 } BINDER=$(command -v afb-daemon) -AFBTEST="$(pkg-config --variable libdir afb-test)/aft.so" PROCNAME="aft-aftest" PORT=1234 TOKEN= -LOGPIPE="test.pipe" +AFTESTSOCKET=/tmp/afTest [ "$1" ] && BUILDDIR="$1" || exit 1 -[ ! -p $LOGPIPE ] && mkfifo $LOGPIPE - pkill $PROCNAME +${BINDER} --name=afbd-aftest \ +--workdir="${BUILDDIR}/package" \ +--binding=lib/aft.so \ +--ws-server=unix:${AFTESTSOCKET} > /dev/null 2>&1 & +AFTESTPID=$! + +sleep 0.3 + ${BINDER} --name="${PROCNAME}" \ --port="${PORT}" \ --no-httpd \ --tracereq=common \ --token=${TOKEN} \ --workdir="${BUILDDIR}/package-test" \ ---binding="$AFBTEST" \ --vvv \ +--binding="${BUILDDIR}/package/lib/aft.so" \ +--ws-client=unix:${AFTESTSOCKET} \ --call="aft-aftest/launch_all_tests:{}" \ ---call="aft-aftest/exit:{}" > ${LOGPIPE} 2>&1 & - -while read -r line -do - [ "$(echo "${line}" | grep 'NOTICE: Browser URL=')" ] && break -done < ${LOGPIPE} - -rm -f ${LOGPIPE} +--call="aft-aftest/exit:{}" -find ${BUILDDIR} -name test_results.log -exec cat {} \; +find "${BUILDDIR}" -name test_results.log -exec cat {} \; |