From: Jannis Pohlmann Date: Wed, 13 Jun 2012 10:46:08 +0000 (+0100) Subject: Add rudimentary test suite with a LUC Handler test script X-Git-Tag: boot-manager-0.1.0~40 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1f93dcd790347061621841233e2b1f95b23aea8f;p=profile%2Fivi%2Fnode-startup-controller.git Add rudimentary test suite with a LUC Handler test script For now the LUC Handler test only does the following: 1. reset the LUC to be empty 2. attempt to register one foreground app In the future we have to add more tests to it. --- diff --git a/Makefile.am b/Makefile.am index 2a12980..b769f29 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,8 @@ # vi:set ts=8 sw=8 noet ai nocindent: SUBDIRS = \ - luc-handler + luc-handler \ + tests .PHONY: ChangeLog diff --git a/configure.ac b/configure.ac index 2ac99cc..e79defd 100644 --- a/configure.ac +++ b/configure.ac @@ -97,4 +97,6 @@ AC_OUTPUT([ Makefile luc-handler/Makefile luc-handler/org.genivi.LUCHandler1.gschema.xml +tests/Makefile +tests/luc-handler/Makefile ]) diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..150ed2c --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,4 @@ +# vi:set ts=8 sw=8 noet ai nocindent: + +SUBDIRS = \ + luc-handler diff --git a/tests/luc-handler/Makefile.am b/tests/luc-handler/Makefile.am new file mode 100644 index 0000000..b7c8512 --- /dev/null +++ b/tests/luc-handler/Makefile.am @@ -0,0 +1,4 @@ +# vi:set ts=8 sw=8 noet ai nocindent: + +TESTS = \ + test-luc-handler diff --git a/tests/luc-handler/test-luc-handler b/tests/luc-handler/test-luc-handler new file mode 100755 index 0000000..cb3d2cc --- /dev/null +++ b/tests/luc-handler/test-luc-handler @@ -0,0 +1,45 @@ +#!/bin/bash + +set -e + +# function to read the LastUserContext property +get_luc() +{ + gdbus call -e \ + -d org.genivi.LUCHandler1 \ + -o /org/genivi/LUCHandler1 \ + -m org.freedesktop.DBus.Properties.Get \ + "org.genivi.LUCHandler1" \ + "LastUserContext" +} + +# function to make a registration call +register() +{ + gdbus call -e \ + -d org.genivi.LUCHandler1 \ + -o /org/genivi/LUCHandler1 \ + -m org.genivi.LUCHandler1.Register \ + "$1" &> /dev/null +} + +# function to fail with a reason +fail() +{ + echo "ERROR: $1" + exit 1 +} + +# reset the LUC +gsettings set org.genivi.LUCHandler1 last-user-context '{}' + +# assert that the LastUserContext property is empty now +[[ "$(get_luc)" = "(<@a{sas} {}>,)" ]] \ + || fail "LastUserContext out of sync with GSettings key after resetting" + +# register one app for foreground +register '{ "foreground": [ "app1" ] }' + +# verify that the app was registered +[[ "$(get_luc)" = "(<{'foreground': ['app1']}>,)" ]] \ + || fail "Registration of a single foreground app was not applied"