diff options
author | Jean-Pierre Bogler <jean-pierre.bogler@continental-corporation.com> | 2015-06-11 15:51:55 +0200 |
---|---|---|
committer | Jean-Pierre Bogler <jean-pierre.bogler@continental-corporation.com> | 2015-06-11 15:53:15 +0200 |
commit | b8bace22d04fdd899cc398659b47aaa9aed58102 (patch) | |
tree | d7abd800d0a8800e8f0d94fe0cd343460e42a067 | |
parent | dd4a86b9459537d2e85489b36abf80f34d12f098 (diff) | |
download | node-state-manager-b8bace22d04fdd899cc398659b47aaa9aed58102.tar.gz |
Add configure switch to set which NSMC to compile
This patch was based on a contribution from Angar Wehrle
and allows to select which NodeStateMachine (NSMC) should
be build during configuration.
Change-Id: I70db0ba7a037daf125954818932b2446da588122
Signed-off-by: Jean-Pierre Bogler <jean-pierre.bogler@continental-corporation.com>
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | NodeStateMachineStub/Makefile.am | 8 | ||||
-rw-r--r-- | NodeStateMachineTest/Makefile.am (renamed from NodeStateTest/Makefile.am) | 2 | ||||
-rw-r--r-- | NodeStateMachineTest/NodeStateMachine.c (renamed from NodeStateTest/NodeStateMachineTest.c) | 5 | ||||
-rw-r--r-- | NodeStateMachineTest/NodeStateMachine.h (renamed from NodeStateTest/NodeStateMachineTest.h) | 2 | ||||
-rw-r--r-- | NodeStateMachineTest/NodeStateTest.c (renamed from NodeStateTest/NodeStateTest.c) | 3 | ||||
-rw-r--r-- | NodeStateMachineTest/org.genivi.NodeStateMachineTest.xml (renamed from NodeStateTest/org.genivi.NodeStateMachineTest.xml) | 0 | ||||
-rw-r--r-- | NodeStateManager/Makefile.am | 6 | ||||
-rw-r--r-- | configure.ac | 11 | ||||
-rw-r--r-- | run_tests.sh | 25 |
12 files changed, 64 insertions, 17 deletions
@@ -1,3 +1,12 @@ +11th Jun. 2015, Jean-Pierre Bogler: + - Contribution from Ansgar Wehrle: + - Introduced configure switch "---with-nsmc" + in configure.ac. + - Restructured project to either compile using + the test or stub NSMC + - Add "run_tests.sh" as a convenient way to + start tests. + 16th Oct. 2013, Jean-Pierre Bogler: - Introduced parameters for restart reason and type in NSMC call. diff --git a/Makefile.am b/Makefile.am index 2352391..6fbdd8b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,6 +19,7 @@ ####################################################################################################################### ACLOCAL_AMFLAGS=-I m4 -SUBDIRS = NodeStateAccess NodeStateMachineStub NodeStateManager NodeStateTest - +SUBDIRS = NodeStateAccess @NSMC@ NodeStateManager +check: + ./run_tests.sh
\ No newline at end of file @@ -1,3 +1,8 @@ +2.0.1 +===== +* Introduced configure switch "--with-nsmc=" to compile + against different NodeStateMachines + 2.0.0 ===== * Extended interface of NodeStateMachine (NSMC) diff --git a/NodeStateMachineStub/Makefile.am b/NodeStateMachineStub/Makefile.am index a8386a0..0905bd5 100644 --- a/NodeStateMachineStub/Makefile.am +++ b/NodeStateMachineStub/Makefile.am @@ -14,12 +14,12 @@ # ####################################################################################################################### -lib_LTLIBRARIES = libNodeStateMachine.la +lib_LTLIBRARIES = libNodeStateMachineStub.la -libNodeStateMachine_la_CFLAGS = \ +libNodeStateMachineStub_la_CFLAGS = \ -I$(top_srcdir)/NodeStateManager \ $(PLATFORM_CFLAGS) -libNodeStateMachine_la_SOURCES = NodeStateMachine.c NodeStateMachine.h +libNodeStateMachineStub_la_SOURCES = NodeStateMachine.c NodeStateMachine.h -libNodeStateMachine_la_LDFLAGS = -avoid-version +libNodeStateMachineStub_la_LDFLAGS = -avoid-version diff --git a/NodeStateTest/Makefile.am b/NodeStateMachineTest/Makefile.am index 0ccc153..a7a57e3 100644 --- a/NodeStateTest/Makefile.am +++ b/NodeStateMachineTest/Makefile.am @@ -47,7 +47,7 @@ libNodeStateMachineTest_la_CFLAGS = -I../NodeStateManager \ $(GLIB_CFLAGS) \ $(GOBJECT_CFLAGS) -libNodeStateMachineTest_la_SOURCES = NodeStateMachineTest.c +libNodeStateMachineTest_la_SOURCES = NodeStateMachine.c nodist_libNodeStateMachineTest_la_SOURCES = NodeStateMachineTestApi.c diff --git a/NodeStateTest/NodeStateMachineTest.c b/NodeStateMachineTest/NodeStateMachine.c index 4381d73..c3cf803 100644 --- a/NodeStateTest/NodeStateMachineTest.c +++ b/NodeStateMachineTest/NodeStateMachine.c @@ -33,7 +33,7 @@ #include <gio/gio.h> /* Access dbus using glib */ -#include "NodeStateMachineTest.h" /* Own header file */ +#include "NodeStateMachine.h" /* Own header file */ #include "NodeStateTypes.h" /* Know the types of the NSM */ #include "NodeStateManager.h" /* Access inhternal NSM interfaces */ @@ -278,8 +278,9 @@ NsmErrorStatus_e NsmcSetData(NsmDataType_e enData, unsigned char *pData, unsigne } -unsigned char NsmcRequestNodeRestart(void) +unsigned char NsmcRequestNodeRestart(NsmRestartReason_e enRestartReason, unsigned int u32RestartType) { + printf("NSMC: NsmcRequestNodeRestart called. Restart reason: %d. RestartType: 0x%02X\n", enRestartReason, u32RestartType); return 1; } diff --git a/NodeStateTest/NodeStateMachineTest.h b/NodeStateMachineTest/NodeStateMachine.h index a502ba3..7c9853b 100644 --- a/NodeStateTest/NodeStateMachineTest.h +++ b/NodeStateMachineTest/NodeStateMachine.h @@ -104,7 +104,7 @@ NsmErrorStatus_e NsmcSetData(NsmDataType_e enData, unsigned char *pData, unsigne \retval true: The request for the restart could be processed. false: Error processing the restart request. This will be used by the NSM to request a node restart when requested by one of its clients.*/ -unsigned char NsmcRequestNodeRestart(void); +unsigned char NsmcRequestNodeRestart(NsmRestartReason_e enRestartReason, unsigned int u32RestartType); /** \brief Get version of the interface diff --git a/NodeStateTest/NodeStateTest.c b/NodeStateMachineTest/NodeStateTest.c index 75060dd..a719697 100644 --- a/NodeStateTest/NodeStateTest.c +++ b/NodeStateMachineTest/NodeStateTest.c @@ -3553,8 +3553,7 @@ static gboolean NSMTST__boTestCaseTimerCb(gpointer pUserData) NSMTST__u16TestIdx++; /* prepare system for next test */ /* The tests end if there was an error or there are no test cases left */ - if( (boTestSuccess == TRUE ) - && (NSMTST__u16TestIdx < sizeof(NSMTST__astTestCases)/sizeof(NSMTST__tstTestCase))) + if((NSMTST__u16TestIdx < sizeof(NSMTST__astTestCases)/sizeof(NSMTST__tstTestCase))) { boKeepTimerAlive = TRUE; } diff --git a/NodeStateTest/org.genivi.NodeStateMachineTest.xml b/NodeStateMachineTest/org.genivi.NodeStateMachineTest.xml index 9426f45..9426f45 100644 --- a/NodeStateTest/org.genivi.NodeStateMachineTest.xml +++ b/NodeStateMachineTest/org.genivi.NodeStateMachineTest.xml diff --git a/NodeStateManager/Makefile.am b/NodeStateManager/Makefile.am index d3e9f50..1161faf 100644 --- a/NodeStateManager/Makefile.am +++ b/NodeStateManager/Makefile.am @@ -18,7 +18,7 @@ bin_PROGRAMS = NodeStateManager NodeStateManager_SOURCES = NodeStateManager.c -NodeStateManager_CFLAGS = -I$(top_srcdir)/NodeStateMachineStub \ +NodeStateManager_CFLAGS = -I$(top_srcdir)/@NSMC@ \ -I$(top_srcdir)/NodeStateAccess \ $(DLT_CFLAGS) \ $(GIO_CFLAGS) \ @@ -31,7 +31,7 @@ NodeStateManager_CFLAGS = -I$(top_srcdir)/NodeStateMachineStub \ NodeStateManager_LDFLAGS = -export-dynamic NodeStateManager_LDADD = -L$(top_srcdir)/NodeStateAccess -lNodeStateAccess \ - -L$(top_srcdir)/NodeStateMachineStub -lNodeStateMachine \ + -L$(top_srcdir)/@NSMC@ -l@NSMC@ \ $(DLT_LIBS) \ $(GIO_LIBS) \ $(GIO_UNIX_LIBS) \ @@ -55,7 +55,7 @@ pkgconfig_DATA = config/node-state-manager.pc dbusinterfaces_DATA = $(top_srcdir)/NodeStateAccess/model/org.genivi.NodeStateManager.Consumer.xml \ $(top_srcdir)/NodeStateAccess/model/org.genivi.NodeStateManager.LifecycleConsumer.xml \ $(top_srcdir)/NodeStateAccess/model/org.genivi.NodeStateManager.LifecycleControl.xml \ - $(top_srcdir)/NodeStateTest/org.genivi.NodeStateMachineTest.xml + $(top_srcdir)/NodeStateMachineTest/org.genivi.NodeStateMachineTest.xml EXTRA_DIST = $(systemdsystemunit_DATA) \ $(dbussystemunit_DATA) \ diff --git a/configure.ac b/configure.ac index fcc9abc..50165fe 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ ####################################################################################################################### # Initialize autoconf -AC_INIT([node-state-manager],[2.0.0]) +AC_INIT([node-state-manager],[2.0.1]) AC_COPYRIGHT([Copyright (c) 2012 Continental Automotive GmbH]) AC_PREREQ([2.50]) @@ -47,6 +47,13 @@ PKG_CHECK_MODULES([DBUS], [dbus-1 >= 1.4.10]) PKG_CHECK_MODULES([SYSTEMD], [libsystemd-daemon >= 37 ]) PKG_CHECK_MODULES([PCL], [persistence_client_library >= 0.6.0 ]) +# Choose NodeStateMachine +AC_ARG_WITH([nsmc], + [AS_HELP_STRING([--with-nsmc], [Set the NodeStateMachine (default NodeStateMachineStub)])], + [nsmc=$withval], [nsmc="NodeStateMachineStub"]) + +AC_SUBST(NSMC, $nsmc) + # Derive path for storing systemd service files (e. g. /lib/systemd/system) AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), @@ -83,8 +90,8 @@ AC_SUBST([dbusinterfacesdir], [$with_dbusinterfacesdir]) # Define configure output AC_CONFIG_FILES([Makefile NodeStateManager/Makefile - NodeStateTest/Makefile NodeStateAccess/Makefile + NodeStateMachineTest/Makefile NodeStateMachineStub/Makefile NodeStateManager/config/nodestatemanager-daemon.service NodeStateManager/config/org.genivi.NodeStateManager.LifeCycleControl.service diff --git a/run_tests.sh b/run_tests.sh new file mode 100644 index 0000000..8e69c74 --- /dev/null +++ b/run_tests.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# fake session dbus as system dbus +export $(dbus-launch) +export DBUS_SYSTEM_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS + +./NodeStateManager/NodeStateManager > /dev/null 2>&1 & +pid_nsm=$! + +# wait until nsm has initialized +sleep 1 +./NodeStateMachineTest/NodeStateTest +ret_val=$? +sleep 1 + +# Terminate NSM +kill -15 $pid_nsm + +# ... and wait for it to exit +( sleep 60 ; kill -9 $pid_nsm ; ) & +killerPid=$! +wait $pid_nsm +kill $killerPid +kill $DBUS_SESSION_BUS_PID + +exit $ret_val |