5 #function to compare the LastUserContext
7 # $2 is the path to the file to compare the context to
10 ./gvariant-writer "$1" "$2"
11 diff -q "$luc_path" "$2"
14 # function to begin registration
18 -d org.genivi.BootManager1 \
19 -o /org/genivi/BootManager1/BootManager \
20 -m org.genivi.BootManager1.BootManager.BeginLUCRegistration \
24 # function to make a registration call
28 -d org.genivi.BootManager1 \
29 -o /org/genivi/BootManager1/BootManager \
30 -m org.genivi.BootManager1.BootManager.RegisterWithLUC \
34 # function to begin registration
38 -d org.genivi.BootManager1 \
39 -o /org/genivi/BootManager1/BootManager \
40 -m org.genivi.BootManager1.BootManager.FinishLUCRegistration \
45 # function to fail with a reason
56 #Test a simple dictionary
58 register "{0: ['app1.unit']}"
60 [ -z "$(compare_luc "{0: ['app1.unit']}" "temp")" ] \
61 || fail "Registration was not identical"
63 #Test whether RegisterWithLUC() writes by itself
64 register "{1: ['app2.service']}"
65 [ "$(compare_luc "{1: ['app2.service']}" "temp" )" ] \
66 || fail "Registration happened with only RegisterWithLUC() called"
68 #Test whether calling FinishLUCRegistration() by itself changes the file
70 [ -z "$(compare_luc "{0: ['app1.unit']}" "temp")" ] \
71 || fail "FinishLUCRegistration() without BeginLUCRegistration() changed the file"
73 #Test whether a complex dictionary works
74 dict="{0: ['app1.unit'], 1: ['app1.unit', 'app3.unit'], 2: ['app2.unit']}"
78 [ -z "$(compare_luc "$dict" "temp")" ] \
79 || fail "Failed to register a complex dictionary type"
81 #Test with multiple RegisterWithLUC() calls
82 dict="{0: ['app1.unit'], 1: ['app3.unit']}"
84 register "{0: ['app1.unit']}"
85 register "{1: ['app3.unit']}"
87 [ -z "$(compare_luc "$dict" "temp")" ] \
88 || fail "Failed to register correctly when multiple calls are used"
90 #Test that using multiply RegisterWithLUC() calls changes the order of the apps
91 dict="{1: ['app2.unit', 'app1.unit']}"
93 register "{1: ['app1.unit', 'app2.unit']}"
94 register "{1: ['app1.unit']}"
96 [ -z "$(compare_luc "$dict" "temp")" ] \
97 || fail "Failed to change the order of the apps on multiple RegisterWithLUC() calls"