aboutsummaryrefslogtreecommitdiffstats
path: root/test/afb-test.sh
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-08-23 00:24:39 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-08-23 00:27:02 +0200
commit0406deaa862dffb3527ae13198f1d0f858656c2e (patch)
treebc82b780a02bc04f8b68c9ed327164d215ef0ef3 /test/afb-test.sh
parent590e30f846481c125a62093a7472937ec30a780b (diff)
Use separate test folder to hold test files
Also separate helloWorld example binding test from self aft tests Change-Id: I5b7c48b38cc6629c3edc97d280d7f9228451b337 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'test/afb-test.sh')
-rwxr-xr-xtest/afb-test.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/afb-test.sh b/test/afb-test.sh
new file mode 100755
index 0000000..d65795d
--- /dev/null
+++ b/test/afb-test.sh
@@ -0,0 +1,40 @@
+#!/bin/sh -x
+
+trap cleanup SIGINT SIGTERM SIGABRT SIGHUP
+
+cleanup() {
+ rm -f $LOGPIPE
+ pkill $PROCNAME
+ 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"
+
+[ "$1" ] && BUILDDIR="$1" || exit 1
+
+[ ! -p $LOGPIPE ] && mkfifo $LOGPIPE
+
+pkill $PROCNAME
+
+${BINDER} --name="${PROCNAME}" \
+--port="${PORT}" \
+--no-httpd \
+--tracereq=common \
+--token=${TOKEN} \
+--workdir="${BUILDDIR}/package-test" \
+--binding="$AFBTEST" \
+-vvv \
+--call="afTest/launch_all_tests:{}" \
+--call="afTest/exit:{}" > ${LOGPIPE} 2>&1 &
+
+while read -r line
+do
+ [ "$(echo "${line}" | grep 'NOTICE: Browser URL=')" ] && break
+done < ${LOGPIPE}
+
+rm -f ${LOGPIPE}