From 2448cf71ad24cbbcbbc89cc7522c431413617692 Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Wed, 10 Jul 2013 18:28:10 +0200 Subject: Add a command to set missing subsystem policy BZ: 122982 When the PFW starts, it loads subsystems using their corresponding plugins. If a requested plugin is not found, the start fails. This is a problem, as for host, plugins are not compiled. Add a command in test platform to use the feature continue load on missing subsystem. Change-Id: Ib533123683b860bfbe0fea069f4bb3c1cc1ef2d0 Signed-off-by: Kevin Rocard Reviewed-on: http://android.intel.com:8080/119305 Reviewed-by: Centelles, Sylvain Tested-by: Barthes, FabienX Reviewed-by: cactus Tested-by: cactus --- test/test-platform/Android.mk | 2 ++ test/test-platform/TestPlatform.cpp | 40 +++++++++++++++++++++++++++++++++++++ test/test-platform/TestPlatform.h | 23 ++++++++++++++++++++- test/test-platform/main.cpp | 9 ++++++--- 4 files changed, 70 insertions(+), 4 deletions(-) (limited to 'test/test-platform') diff --git a/test/test-platform/Android.mk b/test/test-platform/Android.mk index 5755c38..4a5ad41 100644 --- a/test/test-platform/Android.mk +++ b/test/test-platform/Android.mk @@ -31,6 +31,7 @@ LOCAL_C_INCLUDES += \ $(call include-path-for, libstdc++)/.. \ bionic/ +LOCAL_STATIC_LIBRARIES := libaudio_comms_convert LOCAL_SHARED_LIBRARIES := $(common_shared_libraries) libstlport include $(BUILD_EXECUTABLE) @@ -47,6 +48,7 @@ LOCAL_MODULE_TAGS := $(common_module_tags) LOCAL_C_INCLUDES += $(common_c_includes) +LOCAL_STATIC_LIBRARIES := libaudio_comms_convert_host LOCAL_SHARED_LIBRARIES := $(foreach shared_library, $(common_shared_libraries), \ $(shared_library)_host) diff --git a/test/test-platform/TestPlatform.cpp b/test/test-platform/TestPlatform.cpp index 91b86fd..0eaa261 100644 --- a/test/test-platform/TestPlatform.cpp +++ b/test/test-platform/TestPlatform.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include "TestPlatform.h" #include "ParameterMgrPlatformConnector.h" #include "RemoteProcessorServer.h" @@ -63,9 +64,19 @@ CTestPlatform::CTestPlatform(const string& strClass, int iPortNumber) : _pCommandHandler->addCommandParser("createInclusiveSelectionCriterion", &CTestPlatform::createInclusiveSelectionCriterionCommandProcess, 2, " ", "Create exclusive selection criterion"); _pCommandHandler->addCommandParser("start", &CTestPlatform::startParameterMgrCommandProcess, 0, "", "Start ParameterMgr"); + _pCommandHandler->addCommandParser("setCriterionState", &CTestPlatform::setCriterionStateCommandProcess, 2, " ", "Set the current state of a selection criterion"); _pCommandHandler->addCommandParser("applyConfigurations", &CTestPlatform::applyConfigurationsCommandProcess, 0, "", "Apply configurations selected by current selection criteria states"); + _pCommandHandler->addCommandParser("setFailureOnMissingSubsystem", + &CTestPlatform::setFailureOnMissingSubsystemCommandProcess, + 1, "true|false", "Set policy for missing subsystems, " + "either abort start or fallback on virtual subsystem"); + _pCommandHandler->addCommandParser("getMissingSubsystemPolicy", + &CTestPlatform::getFailureOnMissingSubsystemCommandProcess, + 0, "", "Get policy for missing subsystems, " + "either abort start or fallback on virtual subsystem"); + // Create server _pRemoteProcessorServer = new CRemoteProcessorServer(iPortNumber, _pCommandHandler); @@ -127,6 +138,35 @@ CTestPlatform::CCommandHandler::CommandStatus CTestPlatform::startParameterMgrCo CTestPlatform::CCommandHandler::EDone : CTestPlatform::CCommandHandler::EFailed; } +CTestPlatform::CCommandHandler::CommandStatus + CTestPlatform::setFailureOnMissingSubsystemCommandProcess( + const IRemoteCommand& remoteCommand, string& strResult) +{ + const string& strAbort = remoteCommand.getArgument(0); + + bool bFail; + + if(!audio_comms::utilities::convertTo(strAbort, bFail)) { + return CTestPlatform::CCommandHandler::EShowUsage; + } + + return _pParameterMgrPlatformConnector->setFailureOnMissingSubsystem(bFail, strResult) ? + CTestPlatform::CCommandHandler::EDone : CTestPlatform::CCommandHandler::EFailed; +} + +CTestPlatform::CCommandHandler::CommandStatus + CTestPlatform::getFailureOnMissingSubsystemCommandProcess( + const IRemoteCommand& remoteCommand, string& strResult) +{ + (void)remoteCommand; + (void)strResult; + + strResult = _pParameterMgrPlatformConnector->getFailureOnMissingSubsystem() ? + "true":"false"; + + return CTestPlatform::CCommandHandler::EDone; +} + CTestPlatform::CCommandHandler::CommandStatus CTestPlatform::setCriterionStateCommandProcess(const IRemoteCommand& remoteCommand, string& strResult) { diff --git a/test/test-platform/TestPlatform.h b/test/test-platform/TestPlatform.h index 8a3e59c..47f81f8 100644 --- a/test/test-platform/TestPlatform.h +++ b/test/test-platform/TestPlatform.h @@ -24,9 +24,9 @@ */ #pragma once +#include "RemoteCommandHandlerTemplate.h" #include #include -#include "RemoteCommandHandlerTemplate.h" using namespace std; @@ -57,6 +57,27 @@ private: CCommandHandler::CommandStatus setCriterionStateCommandProcess(const IRemoteCommand& remoteCommand, string& strResult); CCommandHandler::CommandStatus applyConfigurationsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult); + /** Callback to set if the PFW start should fail in case of missing subsystems. + * + * @param[in] remoteCommand contains the arguments of the received command. + * @param[out] strResult a string containing the result of the command. + * + * @return CCommandHandler::ESucceeded if command succeeded + * or CCommandHandler::EFailed otherwise + */ + CCommandHandler::CommandStatus setFailureOnMissingSubsystemCommandProcess( + const IRemoteCommand& remoteCommand, string& strResult); + /** Callback to get if the PFW start should fail in case of missing subsystems. + * + * @param[in] remoteCommand contains the arguments of the received command. + * @param[out] strResult a string containing the result of the command. + * + * @return CCommandHandler::ESucceeded if command succeeded + * or CCommandHandler::EFailed otherwise + */ + CCommandHandler::CommandStatus getFailureOnMissingSubsystemCommandProcess( + const IRemoteCommand& remoteCommand, string& strResult); + // Commands bool createExclusiveSelectionCriterionFromStateList(const string& strName, const IRemoteCommand& remoteCommand, string& strResult); bool createInclusiveSelectionCriterionFromStateList(const string& strName, const IRemoteCommand& remoteCommand, string& strResult); diff --git a/test/test-platform/main.cpp b/test/test-platform/main.cpp index 1cd1594..8a2a07a 100644 --- a/test/test-platform/main.cpp +++ b/test/test-platform/main.cpp @@ -22,11 +22,14 @@ * CREATED: 2011-11-25 * UPDATED: 2011-11-25 */ -#include -#include + #include "TestPlatform.h" + +#include +#include +extern "C" { #include -#include +} using namespace std; -- cgit v1.1