$(SYSTEMD_DAEMON_LIBS) \
$(top_builddir)/common/libcommon.la
+%.service: %.service.in
+ sed -e "s,\@libdir\@,$(libdir),g" \
+ -e "s,\@BOOT_MANAGER_VERSION_API\@,$(BOOT_MANAGER_VERSION_API),g" < $< > $@
+
dbus_servicedir = $(datadir)/dbus-1/system-services
dbus_service_in_files = \
dbus_service_DATA = $(dbus_service_in_files:.service.in=.service)
-%.service: %.service.in
- sed -e "s,\@libdir\@,$(libdir),g" \
- -e "s,\@BOOT_MANAGER_VERSION_API\@,$(BOOT_MANAGER_VERSION_API),g" < $< > $@
-
systemd_servicedir = $(libdir)/systemd/system
systemd_service_in_files = \
systemd_service_DATA = $(systemd_service_in_files:.service.in=.service)
-%.service: %.service.in
- sed -e "s,\@libdir\@,$(libdir),g" \
- -e "s,\@BOOT_MANAGER_VERSION_API\@,$(BOOT_MANAGER_VERSION_API),g" < $< > $@
-
CLEANFILES = \
$(dbus_service_DATA) \
$(systemd_service_DATA)
boot_manager_service_read_luc (BootManagerService *service,
GError **error)
{
- GVariant *context;
- GFile *luc_file;
- char *data;
- gsize data_len;
+ const gchar *luc_path;
+ GVariant *context;
+ GFile *luc_file;
+ char *data;
+ gsize data_len;
g_return_val_if_fail (BOOT_MANAGER_IS_SERVICE (service), NULL);
g_return_val_if_fail ((error == NULL || *error == NULL), NULL);
+ /* check which configuration file to use; the LUC_PATH environment variable
+ * has priority over the build-time LUC_PATH definition */
+ luc_path = g_getenv ("LUC_PATH");
+ if (luc_path == NULL)
+ luc_path = LUC_PATH;
+
/* initialize the GFile */
- luc_file = g_file_new_for_path (LUC_PATH);
+ luc_file = g_file_new_for_path (luc_path);
/* read the contents of the file */
if (!g_file_load_contents (luc_file, NULL, &data, &data_len, NULL, error))
boot_manager_service_write_luc (BootManagerService *service,
GError **error)
{
- GError *err = NULL;
- GFile *luc_file;
- GFile *luc_dir;
+ const gchar *luc_path;
+ GError *err = NULL;
+ GFile *luc_file;
+ GFile *luc_dir;
g_return_if_fail (BOOT_MANAGER_IS_SERVICE (service));
g_return_if_fail (error == NULL || *error == NULL);
+ /* check which configuration file to use; the LUC_PATH environment variable
+ * has priority over the build-time LUC_PATH definition */
+ luc_path = g_getenv ("LUC_PATH");
+ if (luc_path == NULL)
+ luc_path = LUC_PATH;
+
/* initialize the GFiles */
- luc_file = g_file_new_for_path (LUC_PATH);
+ luc_file = g_file_new_for_path (luc_path);
luc_dir = g_file_get_parent (luc_file);
/* make sure the last user context's directory exists */
const gint key,
const GVariantType *expected_type);
gboolean g_variant_string_array_has_string (GVariant *array,
- const gchar *str);
+ const gchar *str);
gint g_int_pointer_compare (gconstpointer a,
gconstpointer b);
boot-manager/Makefile
legacy-app-handler/Makefile
nsm-dummy/busconf/Makefile
-nsm-dummy/dbus/Makefile
-nsm-dummy/systemd/Makefile
nsm-dummy/Makefile
tests/Makefile
tests/boot-manager/Makefile
# vi:set ts=8 sw=8 noet ai nocindent:
SUBDIRS = \
- busconf \
- dbus \
- systemd
+ busconf
nsm_dummydir = \
$(libdir)/boot-manager-$(BOOT_MANAGER_VERSION_API)
$(SYSTEMD_DAEMON_LIBS) \
$(top_builddir)/common/libcommon.la
+%.service: %.service.in
+ sed -e "s,\@libdir\@,$(libdir),g" \
+ -e "s,\@BOOT_MANAGER_VERSION_API\@,$(BOOT_MANAGER_VERSION_API),g" < $< > $@
+
+dbus_servicedir = $(datadir)/dbus-1/system-services
+
+dbus_service_in_files = \
+ com.contiautomotive.NodeStateManager.Consumer.service.in \
+ com.contiautomotive.NodeStateManager.LifecycleControl.service.in
+
+dbus_service_DATA = $(dbus_service_in_files:.service.in=.service)
+
+systemd_servicedir = ${libdir}/systemd/system
+
+systemd_service_in_files = \
+ nsm-dummy.service.in
+
+systemd_service_DATA = $(systemd_service_in_files:.service.in=.service)
+
+CLEANFILES = \
+ $(dbus_service_DATA) \
+ $(systemd_service_DATA)
+
+EXTRA_DIST = \
+ $(dbus_service_in_files) \
+ $(systemd_service_in_files)
nsm_dummy_confdir = $(sysconfdir)/dbus-1/system.d
-nsm_dummy_conf_DATA = \
+nsm_dummy_conf_DATA = \
com.contiautomotive.NodeStateManager.conf
+
+EXTRA_DIST = \
+ $(nsm_dummy_conf_DATA)
# vi:set ts=8 sw=8 noet ai nocindent:
-TESTS = \
+installcheck-local: $(noinst_SCRIPTS) $(noinst_PROGRAMS)
+ @echo "============================="
+ @echo "Running test for LUC handling"
+ @if ./test-luc-handler; then \
+ echo "Test for LUC handling passed"; \
+ else \
+ echo "Test for LUC handling failed"; \
+ fi
+ @echo "============================="
+
+noinst_SCRIPTS = \
test-luc-handler
EXTRA_DIST = \
test-luc-handler
-export LUC_PATH = \
- $(sysconfdir)/boot-manager/last-user-context
+export LUC_PATH = last-user-context
+
+export BOOT_MANAGER_CMD = \
+ $(libdir)/boot-manager-$(BOOT_MANAGER_VERSION_API)/boot-manager
noinst_PROGRAMS = \
gvariant-writer
#!/bin/bash
+
#set -e
+#set -x
+
-#function to compare the LastUserContext
+# function to compare the LastUserContext
# $1 is the context
# $2 is the path to the file to compare the context to
compare_luc()
diff -q "$LUC_PATH" "$2"
}
+
# function to begin registration
begin()
{
&> /dev/null
}
+
# function to make a registration call
register()
{
"$1" &> /dev/null
}
+
# function to begin registration
end()
{
exit 1
}
+
+# clean up before running the test scripts
rm -f temp
rm -f "$LUC_PATH"
-#Test a simple dictionary
+# kill any existing instances of the boot manager
+skill -SIGKILL boot-manager 2>&1 >/dev/null
+
+# start the boot manager manually
+$BOOT_MANAGER_CMD &
+
+# wait for ten seconds, hoping the boot manager will become available
+sleep 2
+
+# kill the boot manager when the test script exits
+trap "skill -SIGKILL boot-manager 2>&1 >/dev/null" EXIT
+
+
+# test a simple dictionary
begin
register "{0: ['app1.unit']}"
end
[ -z "$(compare_luc "{0: ['app1.unit']}" "temp")" ] \
|| fail "Registration was not identical"
-#Test whether RegisterWithLUC() writes by itself
+
+# test whether RegisterWithLUC() writes by itself
register "{1: ['app2.service']}"
[ "$(compare_luc "{1: ['app2.service']}" "temp" )" ] \
|| fail "Registration happened with only RegisterWithLUC() called"
-#Test whether calling FinishLUCRegistration() by itself changes the file
+
+# test whether calling FinishLUCRegistration() by itself changes the file
end
[ -z "$(compare_luc "{0: ['app1.unit']}" "temp")" ] \
|| fail "FinishLUCRegistration() without BeginLUCRegistration() changed the file"
-#Test whether a complex dictionary works
+
+# test whether a complex dictionary works
dict="{0: ['app1.unit'], 1: ['app1.unit', 'app3.unit'], 2: ['app2.unit']}"
begin
register "$dict"
[ -z "$(compare_luc "$dict" "temp")" ] \
|| fail "Failed to register a complex dictionary type"
-#Test with multiple RegisterWithLUC() calls
+
+# test with multiple RegisterWithLUC() calls
dict="{0: ['app1.unit'], 1: ['app3.unit']}"
begin
register "{0: ['app1.unit']}"
[ -z "$(compare_luc "$dict" "temp")" ] \
|| fail "Failed to register correctly when multiple calls are used"
-#Test that using multiply RegisterWithLUC() calls changes the order of the apps
+
+# test that using multiply RegisterWithLUC() calls changes the order of the apps
dict="{1: ['app2.unit', 'app1.unit']}"
begin
register "{1: ['app1.unit', 'app2.unit']}"
# vi:set ts=8 sw=8 noet ai nocindent:
-testscriptdir = $(libdir)/boot-manager-$(BOOT_MANAGER_VERSION_API)
-
-testscript_DATA = \
- legacy-app-handler-test
-
-testconfdir = $(sysconfdir)/dbus-1/system.d
-
-testconf_DATA = \
- legacy-app-handler-test.conf
-
-servicedir = $(libdir)/systemd/system
-
service_in_files = \
legacy-app-handler-test1.service.in \
legacy-app-handler-test2.service.in \
legacy-app-handler-test3.service.in
-service_DATA = $(service_in_files:.service.in=.service)
+noinst_DATA = \
+ legacy-app-handler-test \
+ legacy-app-handler-test.conf \
+ $(service_in_files:.service.in=.service)
%.service: %.service.in
sed -e "s,\@libdir\@,$(libdir),g" \
-e "s,\@BOOT_MANAGER_VERSION_API\@,$(BOOT_MANAGER_VERSION_API),g" < $< > $@
CLEANFILES = \
- $(service_DATA)
+ *.service
EXTRA_DIST = \
- $(service_in_files) \
- $(testconf_DATA) \
- $(testscript_DATA)
+ legacy-app-handler-test \
+ legacy-app-handler-test.conf \
+ $(service_in_files)