Implemented -h command for test-platform

For new users, it was not very clear that you had
to give an .xml to the test-platform executable

This patch implements -h an explicits that
Added CmakeLists.txt for building the plugin
Fixed SubsystemBuilder function in Skeleton plugin

The system class convention needs the get<TYPE>SubsystemBuilder
function to have type in caps lock, otherwise the
pfw will loop infinitely when attempting to load plugin.
Added comments for new plugin developers

As a new pfw plugin developer, i encountered an undocumented
(in the plugin) naming issue related to how the pfw
loads subsystem builders.

This patchs just added a comment to inform other
developers not to make the same mistake
Revert "Android.mk: Remove the libparameter_includes hack"

This reverts commit 34e90ae1c744e1de6547e014326ef54f516439c8.

libparameter_includes and libparameter_includes_host are used to build
the parameter-framework plugins. They were removed by error.

We need to revert this patch since we still use those make targets.

Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
Fix hostDomainGenerator.sh error about localhost socket creation

BZ: 171573

If localhost is not bound to 127.0.0.1, socket creation fails in the
portAllocator.py script. This error is not well catched in the main
tool hostDomainGenerator.sh.

This patch updates portAllocator.py so that the IP address 127.0.0.1
is used instead of localhost. In addition, the potential error messages
raised by portAllocator.py are now correctly taken into account by
hostDomainGenerator.sh. HostDomainGenerator.sh has also been updated
to replace all instances of 'localhost' by '127.0.0.1'.

Change-Id: I7ed6ede7a1148360efac4bf38f49054066a50a29
Signed-off-by: Frédéric Boisnard <fredericx.boisnard@intel.com>
Fix "Argument list too long" bug during XML generation

BZ: 177060

When the initial XML file for tuning is too big, the XML generation
fails with the message: "Argument list too long". This is because the
generation relies on the PFW command "setDomainsWithSettingsXML", which
takes XML data as string argument. There is a limitation concerning
the size of this string, leading to the current issue.

This patch replaces the call to "setDomainsWithSettingsXML" by
"importDomainsWithSettingsXML", which takes a file as argument instead
of a string. There is no limitation on the file size.

Change-Id: Ieb12e6ba1391545021cd3f1e867dee0d28425d19
Signed-off-by: Frédéric Boisnard <fredericx.boisnard@intel.com>
Support context mapping at Subsystem level

BZ: 176942

Add a class (ConfigurableMappingElement) handling the mapping; to be derived by
all classes that can contain mapping.  ConfigurableMappingElement derives from
ConfigurableElement.  Until now, the only child of ConfigurableElement that
could have mapping was InstanceConfigurableElement (through TypeElement, that
contains all information related to its type).

Now, both InstanceConfigurableElement and Subsystem derive from
ConfigurableMappingElement.  That way, Subsystem XML elements can now have a
"Mapping" attribute, propagated to all Elements in the tree.  The Subsystem.xsd
schema is updated in that regard.

Only context mapping is relevant at the Subsystem-level (as opposed to
instantiation mapping).  If an instantiation mapping is set in the Subsystem,
it is silently ignored.

Change-Id: I3c09959bc5e3d18c5a4d354e498d69cc5489a247
Signed-off-by: David Wagner <david.wagner@intel.com>
Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
Restore autosync of string parameter

BZ: 183857

Sync for String parameter accessed from parameter handle API
does not work.

This patch allows synchronisation for string parameter accessed
from parameter handle APIs.

Change-Id: If738402f4c0fcb0bb51bd2515e46f3ac36a361dd
Signed-off-by: Francois Gaffie <francois.gaffie@intel.com>
Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
Add explicit API to append parameter path to error log

BZ: 183857

Explicit API names makes the code easier to read, allowing even
to remove some comments.
This patch adds an API to append the parameter path to the error log.

Change-Id: Id136497072e53c8dd0ea3d95354e1dfe6193f771
Signed-off-by: Francois Gaffie <francois.gaffie@intel.com>
Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
Local .xsd files for config validation

BZ: 184054

In order to verify that xml files are valid, the parameter framework
check them with .xsd files.
In those files, there are references towards base schemas on the
internet. Which means that every validation downloads a copy of
the base file via http.

To avoid doing http requests, we can use the file locally.
This patchs changes from remote file to local.

Change-Id: Ide48dba0000db7c97e1d269ee5573ac8afe7e4d4
Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
Android.mk hack for compiling libxml with schemas enabled

The "Schema" feature is enabled in the official libxml2.
We use that feature to validate the xml files given to the
parameter-framework.
In the libxml2 aosp version, this feature is not enabled.

This patch adds a new target, libxml2-schemas, which contains the
"Schemas" feature.

This should be removed when the "Schema" feature is integrated into the
aosp's libxml2 version.

Change-Id: Ida72de36e7fd196063a332ee70b30c0f0cb69024
Signed-off-by: David Wagner <david.wagner@intel.com>
Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
Added possibility to toggle xml validation

BZ: 184054

It was not possible to enable/disable xml file validation.
The parameter framework only relied on the LIBXML_SCHEMAS flag.

This patchs implements a new constructor for XmlFiles
which allows enabling/disabling xml/xsd check.

Change-Id: I32d220a42bb27f4ce685f07cb194e78e76f44a5d
Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
Test-platform enable/disable xml validation

BZ: 184054

test-platform has no way to tell to the parameter
framework that it wants the parameter framework to
validate xmls on loading.

New command added to test-platform executable.
setValidateSchemasOnStart true|false
    If set to true, the parameter framework will try
    to validate the .xmls with the .xsds located next to them.
    If set to false, it will never attempt to validate.

SetValidateSchemas is false by default to allow backward compatibility.

Note(a): This assumes that the script is able to
find the .xsd files (which should be in /tmp/Schemas/).

Change-Id: I7a5b0bc09d31e6647d8c631380d31503666e7e7b
Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
Fix KW10 issues

BZ: 186081

Due to upgrade klocwork (KW version from 9.6 to 10.0)
new issues have been raised.

This patch fix the new issues raised in PFW.

Change-Id: I54c14e4d6da1c9a5f8d82aec1769a9e7e948db50
Signed-off-by: Eduardo Mendi <eduardox.mendi@intel.com>
Add log in case of failure

BZ: 189977

The hostDomainGenerator.sh script generates xml files a build time.
Sometimes it fails but the log information are no sufficient to found
the root cause.

Add some log information in order to be able to find it.

Change-Id: I505577ee30503dccf25375b0ea262461ec4cce14
Signed-off-by: Kevin Rocard <kevinx.rocard@intel.com>
Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
Added copying of xsd files to host build output

BZ: 188323

In order to validate the .xml parameter framework files, we use XSDs.
Those must be in the same directory as the .xml files when they
are validated.

This patch copies the .xsd files towards a directory that
hostDomainGenerator knows, so that he can use the files and
copy them towards /tmp.

Change-Id: I938fc3791006777ff65c96d4259596111f93d7b8
Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
Fix xmlserializer makefile for schema validation

BZ: 188323

For schema validation features, we are using a special version of libxml2 called
libxml2-schemas (which contains the SCHEMAS feature).
This is just a different static library build with that feature only for
the parameter-framework.
The problem with that, is that the include/xmlversion.h does not
define the #LIBXML_SCHEMAS_ENABLED flag.
So when including it in our project, the flag is not defined.
This results in unexpected behaviour since validation was active in the
static library, but never called because the flag was not defined.

As a fix, we are defining the LIBXML_SCHEMAS_ENABLED flag in the makefile.

Change-Id: Id56ae5b668e587171b11e7607f2603ab5e3341a1
Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
Updated hostDomainGenerator.sh schema validation

BZ: 188323

In order to validate xml files, we need the corresponding schemas to be
next to the xml files. Those are put by the script in /tmp.

This patch add the copying of the schema files to /tmp.
I also adds an optional command line argument to disable/enable validation.
This is useful for platform specific enabling/disabling validation.
It can be used by calling hostDomainGenerator.sh --validate.

Change-Id: I7da65f230e5abf5b1d18c5cd6cf11b67dae5ed76
Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
FixedPointParameterType: fix potential compilation issue

BZ: 176178

The isEncodable() method has several prototypes and some compilers are not able
to decide which version to use and produce a compilation error.

Remove unnecessary casts and make the code simpler by using a template-based
conversion library from string to various numeric types instead of using
strtoll and strtod.

Change-Id: I53d0b4ebd12f2cbb315bb52d98365a35876b5aef
Signed-off-by: David Wagner <david.wagner@intel.com>
Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>