#!/bin/bash # # json dbus bridge # # Copyright (c) 2010 by Michael Olbrich # # To the extent possible under law, Pengutronix e.K. has waived all copyright # and related or neighboring rights to JSON-DBus-Bridge Demo Code. # . "@abs_srcdir@/libtest.sh" tests=() if [ $# -eq 0 ]; then names=`cd "@abs_srcdir@";echo *_test.sh` else names="$@" fi for t in $names; do name= for tt in \ "@abs_srcdir@/$t" \ "@abs_srcdir@/${t}_test.sh" \ "@abs_srcdir@/$t.sh"; do if [ -x "$tt" ]; then name="$tt" break fi done if [ -z "$name" ]; then echo "Test '$t' not found." exit 1 fi tests[${#tests[@]}]="$name" done errors=0 finish() { kill $test_service_pid kill $lighttpd_pid if [ $errors -eq 0 ]; then echo "Success." else echo "$errors tests failed." exit 1 fi } trap finish SIGINT trap finish SIGQUIT "@abs_srcdir@/dbus-test-service.py" & test_service_pid=$! /usr/sbin/lighttpd -f "@abs_builddir@/lighttpd.conf" -D & lighttpd_pid=$! JDB_TEST_URL="http://localhost:8080/rpc" echo -n "waiting for lighttpd " for i in `seq 10`; do sleep 1 echo -n "." jdb_test_bridge > /dev/null 2>&1 && break done if [ $? -ne 0 ]; then echo echo echo starting lighttpd failed! finish exit 1 else echo echo echo lighttpd sucessfully started. Running tests echo fi export JDB_TEST_URL="http://localhost:8080/rpc" export JDB_TEST_SERVICE="com.pengutronix.jdb.test|/" export JDB_TEST_VERBOSE="yes" for t in "${tests[@]}"; do echo running `basename "$t"`: "$t" || errors=$[errors+1] done finish