aboutsummaryrefslogtreecommitdiffstats
path: root/test/afb-test.sh
diff options
context:
space:
mode:
authorClément Malléjac <clementmallejac@gmail.com>2018-07-27 17:05:53 +0200
committerClément Malléjac <clementmallejac@gmail.com>2018-08-22 11:33:44 +0200
commit7697648397638b082ce3d3d824c8c128490fc7ce (patch)
tree9dd46cf134acabd57f90492b8d2f3be7bd7fe63c /test/afb-test.sh
parent92f0e16392712fb80954426722675292d551bf0c (diff)
Setup the project for afb-test framework
Wrote a couple of basic API tests Setup mock apis for the test binding Added script to launch tests on native Linux machines Change-Id: I606752e7b46cb2afdc10f3319a24ef15675faa3b Signed-off-by: Clément Malléjac <clementmallejac@gmail.com>
Diffstat (limited to 'test/afb-test.sh')
-rwxr-xr-xtest/afb-test.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/afb-test.sh b/test/afb-test.sh
new file mode 100755
index 0000000..96733bf
--- /dev/null
+++ b/test/afb-test.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+trap "cleanup 0" EXIT
+trap "cleanup 1" SIGHUP SIGINT SIGABRT SIGTERM
+cleanup() {
+ rm -f $LOGPIPE
+ echo "Removing $LOGPIPE"
+ trap '' EXIT SIGHUP SIGINT SIGABRT SIGTERM
+ exit $1
+}
+
+BINDER=$(command -v afb-daemon)
+AFBTEST="$(pkg-config --variable libdir afb-test)/aft.so"
+PROCNAME="aft-signal-composer"
+PORT=1234
+TOKEN=
+LOGPIPE="test.pipe"
+[ "$1" ] && BUILDDIR="$1" || exit 1
+
+TESTPACKAGEDIR="${BUILDDIR}/package-test"
+[ ! -p $LOGPIPE ] && mkfifo $LOGPIPE
+export AFT_CONFIG_PATH="${TESTPACKAGEDIR}/etc"
+export AFT_PLUGIN_PATH="${TESTPACKAGEDIR}/var:${TESTPACKAGEDIR}/lib/plugins"
+
+pkill $PROCNAME
+
+${BINDER} --name="${PROCNAME}" \
+ --port="${PORT}" \
+ --roothttp=. \
+ --tracereq=common \
+ --token=${TOKEN} \
+ --workdir="${TESTPACKAGEDIR}" \
+ --binding="../package/lib/afb-signal-composer.so" \
+ --binding="$AFBTEST" \
+ --call="aft-signal-composer/launch_all_tests:{}" \
+ --call="aft-signal-composer/exit:{}" \
+ -vvv > ${LOGPIPE} 2>&1 &
+
+while read -r line
+do
+ [ "$(echo "${line}" | grep 'NOTICE: Browser URL=')" ] && break
+done < ${LOGPIPE} \ No newline at end of file