aboutsummaryrefslogtreecommitdiffstats
path: root/test/test-platform/TestPlatform.cpp
diff options
context:
space:
mode:
authorFrédéric Boisnard <fredericx.boisnard@intel.com>2014-01-10 18:43:04 +0100
committerDavid Wagner <david.wagner@intel.com>2014-02-12 17:04:17 +0100
commit9e3882819ce9d1fcc99a3ea3efa549e87efa7e7a (patch)
treebaf04894dc5cc50766b69eb57166c941ee14a344 /test/test-platform/TestPlatform.cpp
parentcee2d6bf92a30111b643e1222dcb64f4d116f724 (diff)
downloadexternal_parameter-framework-9e3882819ce9d1fcc99a3ea3efa549e87efa7e7a.zip
external_parameter-framework-9e3882819ce9d1fcc99a3ea3efa549e87efa7e7a.tar.gz
external_parameter-framework-9e3882819ce9d1fcc99a3ea3efa549e87efa7e7a.tar.bz2
Add Exit command to test-platform
BZ: 151780 The only way to exit test-platform is to kill it. However during the build process, the hostDomainGenerator.sh script needs to start and exit test-platform, without knowing its PID. Allow exiting the test-plaform though a new 'exit' command. Change-Id: Ifb94ea1c2017a0b23e25b42a06e2ceeae69ace89 Signed-off-by: Frédéric Boisnard <fredericx.boisnard@intel.com>
Diffstat (limited to 'test/test-platform/TestPlatform.cpp')
-rw-r--r--test/test-platform/TestPlatform.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/test/test-platform/TestPlatform.cpp b/test/test-platform/TestPlatform.cpp
index 2ff704b..b69a10e 100644
--- a/test/test-platform/TestPlatform.cpp
+++ b/test/test-platform/TestPlatform.cpp
@@ -50,13 +50,16 @@ public:
}
};
-CTestPlatform::CTestPlatform(const string& strClass, int iPortNumber) :
+CTestPlatform::CTestPlatform(const string& strClass, int iPortNumber, sem_t& exitSemaphore) :
_pParameterMgrPlatformConnector(new CParameterMgrPlatformConnector(strClass)),
- _pParameterMgrPlatformConnectorLogger(new CParameterMgrPlatformConnectorLogger)
+ _pParameterMgrPlatformConnectorLogger(new CParameterMgrPlatformConnectorLogger),
+ _exitSemaphore(exitSemaphore)
{
_pCommandHandler = new CCommandHandler(this);
// Add command parsers
+ _pCommandHandler->addCommandParser("exit", &CTestPlatform::exit,
+ 0, "", "Exit TestPlatform");
_pCommandHandler->addCommandParser(
"createExclusiveSelectionCriterionFromStateList",
&CTestPlatform::createExclusiveSelectionCriterionFromStateList,
@@ -124,6 +127,20 @@ CTestPlatform::~CTestPlatform()
delete _pParameterMgrPlatformConnector;
}
+CTestPlatform::CommandReturn CTestPlatform::exit(
+ const IRemoteCommand& remoteCommand, string& strResult)
+{
+ (void)remoteCommand;
+
+ // Stop local server
+ _pRemoteProcessorServer->stop();
+
+ // Release the main blocking semaphore to quit application
+ sem_post(&_exitSemaphore);
+
+ return CTestPlatform::CCommandHandler::EDone;
+}
+
bool CTestPlatform::load(std::string& strError)
{
// Start remote processor server