am 3ce2454c: (-s ours) Merge "Revert "Temporarily disable due to python-related build issues""
* commit '3ce2454cf75499317caf0c2b19ea0787a1c0af4a':
Revert "Temporarily disable due to python-related build issues"
diff --git a/.gitignore b/.gitignore
index 3739c27..b3e751b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
-
+*.pyc
+*.pyo
*.win
*.layout
*.user
diff --git a/.travis.yml b/.travis.yml
index d5e8b75..48c84b7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,38 +1,66 @@
+# Use travis docker infrastructure
+sudo: false
language: cpp
-compiler:
- - gcc
-# - clang # not supported yet
-# install SWIG for bindings generation
-before_install:
- - sudo apt-get update -qq
- - sudo apt-get install -y swig
+env:
+ global:
+ - PREFIX=$HOME/prefix
+
+compiler:
+ - gcc
+ - clang
+
+# Install a recent gcc and gcov,
+# it will not be necessary once travis worker is based on ubuntu > 12.04.
+# Install SWIG for bindings generation
+# Install valgrind for memcheck tests
+addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ packages:
+ - swig
+ - valgrind
+ - g++-4.8
+
+install:
+ - pip install --user cpp-coveralls; export PATH=$HOME/.local/bin:$PATH
+ - wget --directory-prefix $PREFIX/include
+ https://raw.github.com/philsquared/Catch/master/single_include/catch.hpp
+
+before_script:
+ - if [ "$CC" = "gcc" ]; then export CC=gcc-4.8 CXX=g++-4.8; fi
# how to build
script:
- - cmake . && make -j && sudo make install
- - make test
- - cd skeleton-subsystem
- - cmake . && make && sudo make install
+ - ( mkdir build_debug && cd build_debug &&
+ cmake -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=ON .. &&
+ make -j &&
+ CTEST_OUTPUT_ON_FAILURE=1 make ExperimentalTest ExperimentalMemCheck )
+ - ( mkdir build && cd build &&
+ cmake -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_INSTALL_PREFIX=../install .. &&
+ make -j &&
+ CTEST_OUTPUT_ON_FAILURE=1 make test &&
+ make install)
+ - ( cd skeleton-subsystem &&
+ cmake -DCMAKE_INSTALL_PREFIX=../install . &&
+ make &&
+ make install )
+
+after_success:
+ # Push coverage info on coveralls.io.
+ # Ignore generated files, samples and tests
+ - coveralls
+ --exclude "build_debug/bindings/python"
+ --exclude "build_debug/CMakeFiles"
+ --exclude "build"
+ --exclude "skeleton-subsystem"
+ --exclude "test/test-subsystem"
+ --exclude "bindings/c/Test.cpp"
+ --exclude "test/tokenizer"
+ --gcov /usr/bin/gcov-4.8
+ --gcov-options '\--long-file-names --preserve-paths'
notifications:
- email:
- - david.wagner@intel.com
irc:
- "chat.freenode.net#parameter-framework"
-
-env:
- global:
- # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
- # via the "travis encrypt" command using the project repo's public key
- - secure: "Y+iKBg65e4dleuMwxAo1XSl/QkF4AtCe35ltu2DhPbeMJCywBmu0aeDb04oEaZJL+BxP+KMoRqRjeoGI3W/sh0gAq03iQ+P4C8KwRb9fdYPPVwH3NP3fyN27gFBH9GS8uMth68o2KP/oO/aqNwii/KbMZtubp7MhY/wnvz4DLCQ="
-
-addons:
- coverity_scan:
- project:
- name: "dawagner/parameter-framework"
- description: "Plugin-based and rule-based framework for managing parameters"
- notification_email: david.wagner@intel.com
- build_command_prepend: "cmake ."
- build_command: "make -j 12"
- branch_pattern: coverity_scan
diff --git a/Android.mk b/Android.mk
index 60fb3bd..5786156 100644
--- a/Android.mk
+++ b/Android.mk
@@ -13,6 +13,6 @@
# Recursive call sub-folder Android.mk
#
-
+ifeq ($(HOST_OS),linux)
include $(call all-subdir-makefiles)
-
+endif
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 696e4a0..66602d7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014, Intel Corporation
+# Copyright (c) 2014-2015, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
@@ -36,8 +36,24 @@
project(parameter-framework)
+# find and set the Parameter Framework's version
+execute_process(COMMAND git describe --tags --dirty
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+ OUTPUT_VARIABLE PARAMETER_FRAMEWORK_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra")
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+
+include(ctest/CMakeLists.txt)
+
+option(COVERAGE "Build with coverage support" OFF)
+if(COVERAGE)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
+endif()
+
add_subdirectory(xmlserializer)
add_subdirectory(parameter)
add_subdirectory(utility)
@@ -45,12 +61,16 @@
add_subdirectory(remote-process)
-enable_testing()
-add_subdirectory(test/test-platform)
-add_subdirectory(test/test-fixed-point-parameter)
+add_subdirectory(test)
-add_subdirectory(tools/bash_completion)
+option(BASH_COMPLETION "Install bash completion configuration" ON)
+if (BASH_COMPLETION)
+ add_subdirectory(tools/bash_completion)
+endif()
+
add_subdirectory(tools/xmlGenerator)
add_subdirectory(tools/xmlValidator)
add_subdirectory(bindings)
+
+add_subdirectory(doc)
diff --git a/COPYING b/COPYING
index d2f4e03..e99deeb 100644
--- a/COPYING
+++ b/COPYING
@@ -1,7 +1,7 @@
parameter-framework and associated libraries and tools are licensed under the
3-Clause BSD license:
-Copyright (c) 2011-2014, Intel Corporation
+Copyright (c) 2011-2015 Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
diff --git a/MODULE_LICENSE_BSD b/MODULE_LICENSE_BSD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_BSD
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..da6c5e6
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,31 @@
+parameter-framework and associated libraries and tools are licensed under the
+3-Clause BSD license:
+
+Copyright (c) 2011-2015, Intel Corporation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its contributors
+may be used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/README.md b/README.md
index f55aeaa..e041f89 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,7 @@
# parameter-framework
[![Build Status](https://travis-ci.org/01org/parameter-framework.svg?branch=master)](https://travis-ci.org/01org/parameter-framework)
+[![Coverage Status](https://coveralls.io/repos/01org/parameter-framework/badge.svg?branch=master)](https://coveralls.io/r/01org/parameter-framework)
## Introduction
diff --git a/Schemas/FileIncluder.xsd b/Schemas/FileIncluder.xsd
index 3278aea..62593b2 100644
--- a/Schemas/FileIncluder.xsd
+++ b/Schemas/FileIncluder.xsd
@@ -1,15 +1,15 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by Samuel Gravez (Siemens VDO S.A.S.) -->
-<xs:schema xmlns:html="http://www.w3.org/1999/xhtml" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
- <xs:complexType name="FileIncluderType">
- <xs:annotation>
- <xs:documentation>Element type used to import a root element from a file.</xs:documentation>
- </xs:annotation>
- <xs:attribute name="Path" type="xs:anyURI" use="required">
- <xs:annotation>
- <xs:documentation>Path to the file to import.
-This path may be absolute or relative to the path of the includer file.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- </xs:complexType>
-</xs:schema>
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by Samuel Gravez (Siemens VDO S.A.S.) -->
+<xs:schema xmlns:html="http://www.w3.org/1999/xhtml" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
+ <xs:complexType name="FileIncluderType">
+ <xs:annotation>
+ <xs:documentation>Element type used to import a root element from a file.</xs:documentation>
+ </xs:annotation>
+ <xs:attribute name="Path" type="xs:anyURI" use="required">
+ <xs:annotation>
+ <xs:documentation>Path to the file to import.
+This path may be absolute or relative to the path of the includer file.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+</xs:schema>
diff --git a/Schemas/Parameter.xsd b/Schemas/Parameter.xsd
index f174b6e..14f7629 100644
--- a/Schemas/Parameter.xsd
+++ b/Schemas/Parameter.xsd
@@ -1,190 +1,190 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
- <xs:attributeGroup name="Nameable">
- <xs:attribute name="Name" type="xs:NMTOKEN" use="required"/>
- <xs:attribute name="Description" type="xs:string" use="optional"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="TypedNameable">
- <xs:attributeGroup ref="Nameable"/>
- <xs:attribute name="Type" type="xs:NMTOKEN" use="required"/>
- </xs:attributeGroup>
- <xs:complexType name="ComponentInstance">
- <xs:attributeGroup ref="TypedNameable"/>
- <xs:attribute name="Mapping" use="optional"/>
- </xs:complexType>
- <xs:simpleType name="SizeType">
- <xs:restriction base="xs:positiveInteger">
- <xs:pattern value="8|16|32"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="SizeType64">
- <xs:restriction base="xs:positiveInteger">
- <xs:pattern value="8|16|32|64"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:attributeGroup name="IntegerParameterAttributes">
- <xs:attribute name="Size" type="SizeType" use="required"/>
- <xs:attribute name="Min" type="xs:integer" use="optional"/>
- <xs:attribute name="Max" type="xs:integer" use="optional"/>
- <xs:attribute name="Signed" type="xs:boolean" use="optional" default="false"/>
- </xs:attributeGroup>
- <xs:attributeGroup name="ArrayLengthAttribute">
- <xs:attribute name="ArrayLength" type="xs:nonNegativeInteger" use="optional" default="0"/>
- </xs:attributeGroup>
- <xs:complexType name="Adaptation">
- <xs:attribute name="Offset" type="xs:integer" default="0"/>
- </xs:complexType>
- <xs:complexType name="LinearAdaptationType">
- <xs:complexContent>
- <xs:extension base="Adaptation">
- <xs:attribute name="SlopeNumerator" type="xs:double" default="1"/>
- <xs:attribute name="SlopeDenominator" type="xs:double" default="1"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- <xs:element name="LinearAdaptation" type="LinearAdaptationType"/>
- <xs:element name="LogarithmicAdaptation">
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="LinearAdaptationType">
- <xs:attribute name="LogarithmBase" type="xs:double" default="10"/>
- <xs:attribute name="FloorValue" type="xs:double" default="-INF"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:complexType name="Parameter" abstract="true">
- <xs:attributeGroup ref="Nameable"/>
- <xs:attribute name="Mapping" type="xs:string" use="optional"/>
- <xs:attributeGroup ref="ArrayLengthAttribute"/>
- </xs:complexType>
- <xs:element name="BooleanParameter">
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="Parameter">
- <xs:attribute name="Size" fixed="8"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:complexType name="IntegerParameterType">
- <xs:complexContent>
- <xs:extension base="Parameter">
- <xs:choice minOccurs="0">
- <xs:element ref="LinearAdaptation"/>
- <xs:element ref="LogarithmicAdaptation"/>
- </xs:choice>
- <xs:attributeGroup ref="IntegerParameterAttributes"/>
- <xs:attribute name="Unit" type="xs:token" use="optional"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- <xs:element name="IntegerParameter" type="IntegerParameterType"/>
- <xs:complexType name="EnumParameterType">
- <xs:complexContent>
- <xs:extension base="Parameter">
- <xs:sequence>
- <xs:element name="ValuePair" maxOccurs="unbounded">
- <xs:complexType>
- <xs:attribute name="Literal" type="xs:string" use="required"/>
- <xs:attribute name="Numerical" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:pattern value="0|[+-]?[1-9][0-9]*"/>
- <xs:pattern value="0x[0-9a-fA-F]+"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="Size" type="SizeType" use="required"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- <xs:element name="EnumParameter" type="EnumParameterType">
- <xs:unique name="LiteralUniqueness">
- <xs:selector xpath="ValuePair"/>
- <xs:field xpath="@Literal"/>
- </xs:unique>
- <xs:unique name="NumericalUniqueness">
- <xs:selector xpath="ValuePair"/>
- <xs:field xpath="@Numerical"/>
- </xs:unique>
- </xs:element>
- <xs:complexType name="FixedPointParameterType">
- <xs:complexContent>
- <xs:extension base="Parameter">
- <xs:attribute name="Size" type="SizeType" use="required"/>
- <xs:attribute name="Integral" type="xs:nonNegativeInteger" use="required"/>
- <xs:attribute name="Fractional" type="xs:nonNegativeInteger" use="required"/>
- <xs:attribute name="Unit" type="xs:token" use="optional"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- <xs:element name="FixedPointParameter" type="FixedPointParameterType"/>
- <xs:complexType name="BitParameterType">
- <xs:attributeGroup ref="Nameable"/>
- <xs:attribute name="Size" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:positiveInteger">
- <xs:maxInclusive value="64"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="Pos" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:nonNegativeInteger">
- <xs:maxInclusive value="63"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="Max" type="xs:integer" use="optional"/>
- </xs:complexType>
- <xs:element name="BitParameterBlock">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="BitParameter" type="BitParameterType" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attributeGroup ref="Nameable"/>
- <xs:attribute name="Size" type="SizeType64" use="required"/>
- <xs:attribute name="Mapping" type="xs:string" use="optional"/>
- </xs:complexType>
- <xs:unique name="BitParameterBlockSubElementsUniqueness">
- <xs:selector xpath="*"/>
- <xs:field xpath="@Name"/>
- </xs:unique>
- </xs:element>
- <xs:element name="StringParameter">
- <xs:complexType>
- <xs:attributeGroup ref="Nameable"/>
- <xs:attribute name="Mapping" type="xs:string" use="optional"/>
- <xs:attribute name="MaxLength" type="xs:nonNegativeInteger" use="required"/>
- </xs:complexType>
- </xs:element>
- <xs:group name="ParameterBlockGroup">
- <xs:choice>
- <xs:element ref="BooleanParameter"/>
- <xs:element ref="IntegerParameter"/>
- <xs:element ref="EnumParameter"/>
- <xs:element ref="FixedPointParameter"/>
- <xs:element ref="BitParameterBlock"/>
- <xs:element ref="StringParameter"/>
- <xs:element name="Component" type="ComponentInstance"/>
- <xs:element name="ParameterBlock" type="ParameterBlockType">
- <xs:unique name="ParameterBlockSubElementsUniqueness">
- <xs:selector xpath="*"/>
- <xs:field xpath="@Name"/>
- </xs:unique>
- </xs:element>
- </xs:choice>
- </xs:group>
- <xs:complexType name="ParameterBlockType">
- <xs:sequence>
- <xs:group ref="ParameterBlockGroup" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attributeGroup ref="Nameable"/>
- <xs:attributeGroup ref="ArrayLengthAttribute"/>
- <xs:attribute name="Mapping" type="xs:string" use="optional"/>
- </xs:complexType>
-</xs:schema>
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
+ <xs:attributeGroup name="Nameable">
+ <xs:attribute name="Name" type="xs:NMTOKEN" use="required"/>
+ <xs:attribute name="Description" type="xs:string" use="optional"/>
+ </xs:attributeGroup>
+ <xs:attributeGroup name="TypedNameable">
+ <xs:attributeGroup ref="Nameable"/>
+ <xs:attribute name="Type" type="xs:NMTOKEN" use="required"/>
+ </xs:attributeGroup>
+ <xs:complexType name="ComponentInstance">
+ <xs:attributeGroup ref="TypedNameable"/>
+ <xs:attribute name="Mapping" use="optional"/>
+ </xs:complexType>
+ <xs:simpleType name="SizeType">
+ <xs:restriction base="xs:positiveInteger">
+ <xs:pattern value="8|16|32"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="SizeType64">
+ <xs:restriction base="xs:positiveInteger">
+ <xs:pattern value="8|16|32|64"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:attributeGroup name="IntegerParameterAttributes">
+ <xs:attribute name="Size" type="SizeType" use="required"/>
+ <xs:attribute name="Min" type="xs:integer" use="optional"/>
+ <xs:attribute name="Max" type="xs:integer" use="optional"/>
+ <xs:attribute name="Signed" type="xs:boolean" use="optional" default="false"/>
+ </xs:attributeGroup>
+ <xs:attributeGroup name="ArrayLengthAttribute">
+ <xs:attribute name="ArrayLength" type="xs:nonNegativeInteger" use="optional" default="0"/>
+ </xs:attributeGroup>
+ <xs:complexType name="Adaptation">
+ <xs:attribute name="Offset" type="xs:integer" default="0"/>
+ </xs:complexType>
+ <xs:complexType name="LinearAdaptationType">
+ <xs:complexContent>
+ <xs:extension base="Adaptation">
+ <xs:attribute name="SlopeNumerator" type="xs:double" default="1"/>
+ <xs:attribute name="SlopeDenominator" type="xs:double" default="1"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="LinearAdaptation" type="LinearAdaptationType"/>
+ <xs:element name="LogarithmicAdaptation">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="LinearAdaptationType">
+ <xs:attribute name="LogarithmBase" type="xs:double" default="10"/>
+ <xs:attribute name="FloorValue" type="xs:double" default="-INF"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name="Parameter" abstract="true">
+ <xs:attributeGroup ref="Nameable"/>
+ <xs:attribute name="Mapping" type="xs:string" use="optional"/>
+ <xs:attributeGroup ref="ArrayLengthAttribute"/>
+ </xs:complexType>
+ <xs:element name="BooleanParameter">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="Parameter">
+ <xs:attribute name="Size" fixed="8"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name="IntegerParameterType">
+ <xs:complexContent>
+ <xs:extension base="Parameter">
+ <xs:choice minOccurs="0">
+ <xs:element ref="LinearAdaptation"/>
+ <xs:element ref="LogarithmicAdaptation"/>
+ </xs:choice>
+ <xs:attributeGroup ref="IntegerParameterAttributes"/>
+ <xs:attribute name="Unit" type="xs:token" use="optional"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="IntegerParameter" type="IntegerParameterType"/>
+ <xs:complexType name="EnumParameterType">
+ <xs:complexContent>
+ <xs:extension base="Parameter">
+ <xs:sequence>
+ <xs:element name="ValuePair" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="Literal" type="xs:string" use="required"/>
+ <xs:attribute name="Numerical" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:pattern value="0|[+-]?[1-9][0-9]*"/>
+ <xs:pattern value="0x[0-9a-fA-F]+"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="Size" type="SizeType" use="required"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="EnumParameter" type="EnumParameterType">
+ <xs:unique name="LiteralUniqueness">
+ <xs:selector xpath="ValuePair"/>
+ <xs:field xpath="@Literal"/>
+ </xs:unique>
+ <xs:unique name="NumericalUniqueness">
+ <xs:selector xpath="ValuePair"/>
+ <xs:field xpath="@Numerical"/>
+ </xs:unique>
+ </xs:element>
+ <xs:complexType name="FixedPointParameterType">
+ <xs:complexContent>
+ <xs:extension base="Parameter">
+ <xs:attribute name="Size" type="SizeType" use="required"/>
+ <xs:attribute name="Integral" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="Fractional" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="Unit" type="xs:token" use="optional"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ <xs:element name="FixedPointParameter" type="FixedPointParameterType"/>
+ <xs:complexType name="BitParameterType">
+ <xs:attributeGroup ref="Nameable"/>
+ <xs:attribute name="Size" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:positiveInteger">
+ <xs:maxInclusive value="64"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="Pos" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:nonNegativeInteger">
+ <xs:maxInclusive value="63"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="Max" type="xs:integer" use="optional"/>
+ </xs:complexType>
+ <xs:element name="BitParameterBlock">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="BitParameter" type="BitParameterType" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="Nameable"/>
+ <xs:attribute name="Size" type="SizeType64" use="required"/>
+ <xs:attribute name="Mapping" type="xs:string" use="optional"/>
+ </xs:complexType>
+ <xs:unique name="BitParameterBlockSubElementsUniqueness">
+ <xs:selector xpath="*"/>
+ <xs:field xpath="@Name"/>
+ </xs:unique>
+ </xs:element>
+ <xs:element name="StringParameter">
+ <xs:complexType>
+ <xs:attributeGroup ref="Nameable"/>
+ <xs:attribute name="Mapping" type="xs:string" use="optional"/>
+ <xs:attribute name="MaxLength" type="xs:nonNegativeInteger" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:group name="ParameterBlockGroup">
+ <xs:choice>
+ <xs:element ref="BooleanParameter"/>
+ <xs:element ref="IntegerParameter"/>
+ <xs:element ref="EnumParameter"/>
+ <xs:element ref="FixedPointParameter"/>
+ <xs:element ref="BitParameterBlock"/>
+ <xs:element ref="StringParameter"/>
+ <xs:element name="Component" type="ComponentInstance"/>
+ <xs:element name="ParameterBlock" type="ParameterBlockType">
+ <xs:unique name="ParameterBlockSubElementsUniqueness">
+ <xs:selector xpath="*"/>
+ <xs:field xpath="@Name"/>
+ </xs:unique>
+ </xs:element>
+ </xs:choice>
+ </xs:group>
+ <xs:complexType name="ParameterBlockType">
+ <xs:sequence>
+ <xs:group ref="ParameterBlockGroup" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="Nameable"/>
+ <xs:attributeGroup ref="ArrayLengthAttribute"/>
+ <xs:attribute name="Mapping" type="xs:string" use="optional"/>
+ </xs:complexType>
+</xs:schema>
diff --git a/Schemas/ParameterSettings.xsd b/Schemas/ParameterSettings.xsd
index 9943d8e..5ebe495 100644
--- a/Schemas/ParameterSettings.xsd
+++ b/Schemas/ParameterSettings.xsd
@@ -1,92 +1,92 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
- <xs:complexType name="ParameterType" abstract="true">
- <xs:simpleContent>
- <xs:extension base="xs:string">
- <xs:attribute name="Name" type="xs:NMTOKEN" use="required"/>
- <xs:attribute name="ValueSpace" use="optional">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="Raw"/>
- <xs:enumeration value="Real"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- <xs:complexType name="BooleanParameterType">
- <xs:simpleContent>
- <xs:restriction base="ParameterType">
- <xs:pattern value="([01][\s]*)+"/>
- <xs:pattern value="((0x0|0x1)[\s]*)+"/>
- <xs:attribute name="ValueSpace" use="prohibited"/>
- </xs:restriction>
- </xs:simpleContent>
- </xs:complexType>
- <xs:complexType name="IntegerParameterType">
- <xs:simpleContent>
- <xs:restriction base="ParameterType">
- <xs:pattern value="(0|([+-]?[1-9][0-9]*))(\s+(0|([+-]?[1-9][0-9]*)))*"/>
- <xs:pattern value="(0x[0-9a-fA-F]+)(\s+(0x[0-9a-fA-F]+))*"/>
- <xs:attribute name="ValueSpace" use="prohibited"/>
- </xs:restriction>
- </xs:simpleContent>
- </xs:complexType>
- <xs:complexType name="EnumParameterType">
- <xs:simpleContent>
- <xs:restriction base="ParameterType">
- <xs:attribute name="ValueSpace" use="prohibited"/>
- </xs:restriction>
- </xs:simpleContent>
- </xs:complexType>
- <xs:complexType name="FixedPointParameterType">
- <xs:simpleContent>
- <xs:restriction base="ParameterType">
- <xs:pattern value="((0|[+-]?0\.[0-9]+|(([+-]?[1-9][0-9]*)(\.[0-9]+)?))(e[+-]?[0-9]+)?)(\s+(0|[+-]?0\.[0-9]+|(([+-]?[1-9][0-9]*)(\.[0-9]+)?))(e[+-]?[0-9]+)?)*"/>
- <xs:pattern value="(0x[0-9a-fA-F]+)(\s+(0x[0-9a-fA-F]+))*"/>
- </xs:restriction>
- </xs:simpleContent>
- </xs:complexType>
- <xs:complexType name="BitParameterBlockType">
- <xs:sequence>
- <xs:element name="BitParameter" maxOccurs="unbounded" type="IntegerParameterType"/>
- </xs:sequence>
- <xs:attribute name="Name" type="xs:NMTOKEN" use="required"/>
- </xs:complexType>
- <xs:complexType name="StringParameterType">
- <xs:simpleContent>
- <xs:extension base="xs:string">
- <xs:attribute name="Name" type="xs:NMTOKEN" use="required"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- <xs:group name="ParameterBlockGroup">
- <xs:choice>
- <xs:element name="BooleanParameter" type="BooleanParameterType"/>
- <xs:element name="IntegerParameter" type="IntegerParameterType"/>
- <xs:element name="EnumParameter" type="EnumParameterType"/>
- <xs:element name="FixedPointParameter" type="FixedPointParameterType"/>
- <xs:element name="BitParameterBlock" type="BitParameterBlockType">
- <xs:unique name="BitParameterBlockSubElementsUniqueness">
- <xs:selector xpath="*"/>
- <xs:field xpath="@Name"/>
- </xs:unique>
- </xs:element>
- <xs:element name="StringParameter" type="StringParameterType"/>
- <xs:element name="Component" type="ParameterBlockType"/>
- <xs:element name="ParameterBlock" type="ParameterBlockType">
- <xs:unique name="ParameterBlockSubElementsUniqueness">
- <xs:selector xpath="*"/>
- <xs:field xpath="@Name"/>
- </xs:unique>
- </xs:element>
- </xs:choice>
- </xs:group>
- <xs:complexType name="ParameterBlockType">
- <xs:sequence>
- <xs:group ref="ParameterBlockGroup" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="Name" type="xs:NMTOKEN" use="required"/>
- </xs:complexType>
-</xs:schema>
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
+ <xs:complexType name="ParameterType" abstract="true">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Name" type="xs:NMTOKEN" use="required"/>
+ <xs:attribute name="ValueSpace" use="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="Raw"/>
+ <xs:enumeration value="Real"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:complexType name="BooleanParameterType">
+ <xs:simpleContent>
+ <xs:restriction base="ParameterType">
+ <xs:pattern value="([01][\s]*)+"/>
+ <xs:pattern value="((0x0|0x1)[\s]*)+"/>
+ <xs:attribute name="ValueSpace" use="prohibited"/>
+ </xs:restriction>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:complexType name="IntegerParameterType">
+ <xs:simpleContent>
+ <xs:restriction base="ParameterType">
+ <xs:pattern value="(0|([+-]?[1-9][0-9]*))(\s+(0|([+-]?[1-9][0-9]*)))*"/>
+ <xs:pattern value="(0x[0-9a-fA-F]+)(\s+(0x[0-9a-fA-F]+))*"/>
+ <xs:attribute name="ValueSpace" use="prohibited"/>
+ </xs:restriction>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:complexType name="EnumParameterType">
+ <xs:simpleContent>
+ <xs:restriction base="ParameterType">
+ <xs:attribute name="ValueSpace" use="prohibited"/>
+ </xs:restriction>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:complexType name="FixedPointParameterType">
+ <xs:simpleContent>
+ <xs:restriction base="ParameterType">
+ <xs:pattern value="((0|[+-]?0\.[0-9]+|(([+-]?[1-9][0-9]*)(\.[0-9]+)?))(e[+-]?[0-9]+)?)(\s+(0|[+-]?0\.[0-9]+|(([+-]?[1-9][0-9]*)(\.[0-9]+)?))(e[+-]?[0-9]+)?)*"/>
+ <xs:pattern value="(0x[0-9a-fA-F]+)(\s+(0x[0-9a-fA-F]+))*"/>
+ </xs:restriction>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:complexType name="BitParameterBlockType">
+ <xs:sequence>
+ <xs:element name="BitParameter" maxOccurs="unbounded" type="IntegerParameterType"/>
+ </xs:sequence>
+ <xs:attribute name="Name" type="xs:NMTOKEN" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="StringParameterType">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Name" type="xs:NMTOKEN" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:group name="ParameterBlockGroup">
+ <xs:choice>
+ <xs:element name="BooleanParameter" type="BooleanParameterType"/>
+ <xs:element name="IntegerParameter" type="IntegerParameterType"/>
+ <xs:element name="EnumParameter" type="EnumParameterType"/>
+ <xs:element name="FixedPointParameter" type="FixedPointParameterType"/>
+ <xs:element name="BitParameterBlock" type="BitParameterBlockType">
+ <xs:unique name="BitParameterBlockSubElementsUniqueness">
+ <xs:selector xpath="*"/>
+ <xs:field xpath="@Name"/>
+ </xs:unique>
+ </xs:element>
+ <xs:element name="StringParameter" type="StringParameterType"/>
+ <xs:element name="Component" type="ParameterBlockType"/>
+ <xs:element name="ParameterBlock" type="ParameterBlockType">
+ <xs:unique name="ParameterBlockSubElementsUniqueness">
+ <xs:selector xpath="*"/>
+ <xs:field xpath="@Name"/>
+ </xs:unique>
+ </xs:element>
+ </xs:choice>
+ </xs:group>
+ <xs:complexType name="ParameterBlockType">
+ <xs:sequence>
+ <xs:group ref="ParameterBlockGroup" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="Name" type="xs:NMTOKEN" use="required"/>
+ </xs:complexType>
+</xs:schema>
diff --git a/Schemas/Subsystem.xsd b/Schemas/Subsystem.xsd
index e803175..d418af7 100644
--- a/Schemas/Subsystem.xsd
+++ b/Schemas/Subsystem.xsd
@@ -1,40 +1,40 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--W3C Schema generated by XMLSpy v2007 (http://www.altova.com)-->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:include schemaLocation="ComponentLibrary.xsd"/>
- <xs:complexType name="SubsystemType">
- <xs:sequence>
- <xs:element ref="ComponentLibrary"/>
- <xs:element name="InstanceDefinition">
- <xs:complexType>
- <xs:sequence>
- <xs:sequence maxOccurs="unbounded">
- <xs:group ref="ParameterBlockGroup"/>
- </xs:sequence>
- </xs:sequence>
- </xs:complexType>
- <xs:unique name="InstanceDefintionSubElementsUniqueness">
- <xs:selector xpath="*"/>
- <xs:field xpath="@Name"/>
- </xs:unique>
- </xs:element>
- </xs:sequence>
- <xs:attributeGroup ref="Nameable"/>
- <xs:attribute name="Endianness" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="Little"/>
- <xs:enumeration value="Big"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="Type" use="required"/>
- <xs:attribute name="Mapping" use="optional"/>
- </xs:complexType>
- <xs:element name="Subsystem" type="SubsystemType">
- <xs:keyref name="InstanceDefinitionComponentTypeNotFound" refer="ComponentTypeUniqueness">
- <xs:selector xpath="InstanceDefinition/Component"/>
- <xs:field xpath="@Type"/>
- </xs:keyref>
- </xs:element>
-</xs:schema>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--W3C Schema generated by XMLSpy v2007 (http://www.altova.com)-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:include schemaLocation="ComponentLibrary.xsd"/>
+ <xs:complexType name="SubsystemType">
+ <xs:sequence>
+ <xs:element ref="ComponentLibrary"/>
+ <xs:element name="InstanceDefinition">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:sequence maxOccurs="unbounded">
+ <xs:group ref="ParameterBlockGroup"/>
+ </xs:sequence>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:unique name="InstanceDefintionSubElementsUniqueness">
+ <xs:selector xpath="*"/>
+ <xs:field xpath="@Name"/>
+ </xs:unique>
+ </xs:element>
+ </xs:sequence>
+ <xs:attributeGroup ref="Nameable"/>
+ <xs:attribute name="Endianness" use="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="Little"/>
+ <xs:enumeration value="Big"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="Type" use="required"/>
+ <xs:attribute name="Mapping" use="optional"/>
+ </xs:complexType>
+ <xs:element name="Subsystem" type="SubsystemType">
+ <xs:keyref name="InstanceDefinitionComponentTypeNotFound" refer="ComponentTypeUniqueness">
+ <xs:selector xpath="InstanceDefinition/Component"/>
+ <xs:field xpath="@Type"/>
+ </xs:keyref>
+ </xs:element>
+</xs:schema>
diff --git a/Schemas/SystemClass.xsd b/Schemas/SystemClass.xsd
index daf3cd7..5aa32db 100644
--- a/Schemas/SystemClass.xsd
+++ b/Schemas/SystemClass.xsd
@@ -1,17 +1,17 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--W3C Schema generated by XMLSpy v2007 (http://www.altova.com)-->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:include schemaLocation="FileIncluder.xsd"/>
- <xs:include schemaLocation="Subsystem.xsd"/>
- <xs:element name="SystemClass">
- <xs:complexType>
- <xs:sequence>
- <xs:choice maxOccurs="unbounded">
- <xs:element name="SubsystemInclude" type="FileIncluderType"/>
- <xs:element ref="Subsystem"/>
- </xs:choice>
- </xs:sequence>
- <xs:attribute name="Name" type="xs:NMTOKEN" use="required"/>
- </xs:complexType>
- </xs:element>
-</xs:schema>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--W3C Schema generated by XMLSpy v2007 (http://www.altova.com)-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:include schemaLocation="FileIncluder.xsd"/>
+ <xs:include schemaLocation="Subsystem.xsd"/>
+ <xs:element name="SystemClass">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element name="SubsystemInclude" type="FileIncluderType"/>
+ <xs:element ref="Subsystem"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="Name" type="xs:NMTOKEN" use="required"/>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt
index 3208d54..446b52f 100644
--- a/bindings/CMakeLists.txt
+++ b/bindings/CMakeLists.txt
@@ -26,4 +26,12 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-add_subdirectory(python)
+option(PYTHON_BINDINGS "Python library to use the pfw from python" ON)
+if(PYTHON_BINDINGS)
+ add_subdirectory(python)
+endif()
+
+option(C_BINDINGS "Python library to use the pfw from python" ON)
+if(C_BINDINGS)
+ add_subdirectory(c)
+endif()
diff --git a/bindings/c/CMakeLists.txt b/bindings/c/CMakeLists.txt
new file mode 100644
index 0000000..3f00434
--- /dev/null
+++ b/bindings/c/CMakeLists.txt
@@ -0,0 +1,67 @@
+# Copyright (c) 2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+add_library(cparameter SHARED ParameterFramework.cpp)
+
+include_directories("${PROJECT_SOURCE_DIR}/parameter/include")
+
+install(FILES ParameterFramework.h
+ DESTINATION "include/parameter/c")
+
+target_link_libraries(cparameter parameter)
+
+install(TARGETS cparameter LIBRARY DESTINATION lib)
+
+if(BUILD_TESTING)
+ # Add catch unit test framework
+ # TODO Use gtest as it is the team recommendation
+ # Unfortunately gtest is very hard to setup as not binary distributed
+ # catch is only one header so it is very easy
+ # Catch can be downloaded from:
+ # https://raw.github.com/philsquared/Catch/master/single_include/catch.hpp
+ # Then append the download folder to the CMAKE_INCLUDE_PATH variable or
+ # copy it in a standard location (/usr/include on most linux distribution).
+ find_path(CATCH_HEADER catch.hpp)
+ include_directories(${CATCH_HEADER})
+ include_directories("${PROJECT_SOURCE_DIR}/utility")
+
+ # Add unit test
+ add_executable(cparameterUnitTest Test.cpp)
+ # Do not warn about passing a null pointer for arguments marked as requiring
+ # a non-null value by the "nonnull" function attribute.
+ # This is done as the unit tests check that invalid api use result in
+ # proper failure.
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nonnull")
+
+ target_link_libraries(cparameterUnitTest cparameter pfw_utility)
+ add_test(NAME cparameterUnitTest
+ COMMAND cparameterUnitTest)
+
+ # Custom function defined in the top-level CMakeLists
+ set_test_env(cparameterUnitTest)
+endif()
diff --git a/bindings/c/ParameterFramework.cpp b/bindings/c/ParameterFramework.cpp
new file mode 100644
index 0000000..efc7d99
--- /dev/null
+++ b/bindings/c/ParameterFramework.cpp
@@ -0,0 +1,397 @@
+/*
+ * Copyright (c) 2015, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "ParameterFramework.h"
+#include <ParameterMgrPlatformConnector.h>
+
+#include <iostream>
+#include <limits>
+#include <string>
+#include <map>
+
+#include <cassert>
+#include <cstring>
+#include <cstdlib>
+
+using std::string;
+
+/** Rename long pfw types to short ones in pfw namespace. */
+namespace pfw
+{
+ typedef ISelectionCriterionInterface Criterion;
+ typedef std::map<string, Criterion *> Criteria;
+ typedef CParameterMgrPlatformConnector Pfw;
+}
+
+/** Class to abstract the boolean+string status api. */
+class Status
+{
+public:
+ /** Fail without an instance of status. */
+ static bool failure() { return false; }
+ /** Fail with the given error msg. */
+ bool failure(const string &msg) { mMsg = msg; return false; }
+ /** Success (no error message). */
+ bool success() { mMsg.clear(); return true; }
+
+ /** Forward a status operation.
+ * @param success[in] the operaton status to forward
+ * or forward a previous failure if omitted
+ */
+ bool forward(bool success = false) {
+ if (success) { mMsg.clear(); }
+ return success;
+ }
+ /** Error message accessors.
+ *
+ * Pfw api requires to provide a reference to a string in order
+ * for it to log. This function provide a reference to a string that
+ * will be added to the error message on failure.
+ */
+ string &msg() { return mMsg; }
+private:
+ string mMsg;
+};
+
+///////////////////////////////
+///////////// Log /////////////
+///////////////////////////////
+
+/** Default log callback. Log to cout or cerr depending on level. */
+static void defaultLogCb(void *, PfwLogLevel level, const char *logLine) {
+ switch (level) {
+ case pfwLogInfo:
+ std::cout << logLine << std::endl;
+ break;
+ case pfwLogWarning:
+ std::cerr << logLine << std::endl;
+ break;
+ };
+}
+
+static PfwLogger defaultLogger = { NULL, &defaultLogCb };
+
+class LogWrapper : public CParameterMgrPlatformConnector::ILogger
+{
+public:
+ LogWrapper(const PfwLogger &logger) : mLogger(logger) {}
+ LogWrapper() : mLogger() {}
+ virtual ~LogWrapper() {}
+private:
+ virtual void log(bool bIsWarning, const string &strLog)
+ {
+ // A LogWrapper should NOT be register to the pfw (thus log called)
+ // if logCb is NULL.
+ assert(mLogger.logCb != NULL);
+ mLogger.logCb(mLogger.userCtx,
+ bIsWarning ? pfwLogWarning : pfwLogInfo,
+ strLog.c_str());
+ }
+ PfwLogger mLogger;
+};
+
+///////////////////////////////
+///////////// Core ////////////
+///////////////////////////////
+
+struct PfwHandler_
+{
+ void setLogger(const PfwLogger *logger);
+ bool createCriteria(const PfwCriterion criteria[], size_t criterionNb);
+
+ pfw::Criteria criteria;
+ pfw::Pfw *pfw;
+ /** Status of the last called function.
+ * Is mutable because even a const function can fail.
+ */
+ mutable Status lastStatus;
+private:
+ LogWrapper mLogger;
+};
+
+
+PfwHandler *pfwCreate()
+{
+ return new PfwHandler();
+}
+
+void pfwDestroy(PfwHandler *handle)
+{
+ if(handle != NULL and handle->pfw != NULL) {
+ delete handle->pfw;
+ }
+ delete handle;
+}
+
+void PfwHandler::setLogger(const PfwLogger *logger)
+{
+ if (logger != NULL and logger->logCb == NULL) {
+ return; // There is no callback, do not log => do not add a logger
+ }
+ mLogger = logger != NULL ? *logger : defaultLogger;
+ pfw->setLogger(&mLogger);
+}
+
+
+bool PfwHandler::createCriteria(const PfwCriterion criteriaArray[], size_t criterionNb)
+{
+ Status &status = lastStatus;
+ // Add criteria
+ for (size_t criterionIndex = 0; criterionIndex < criterionNb; ++criterionIndex) {
+ const PfwCriterion &criterion = criteriaArray[criterionIndex];
+ if (criterion.name == NULL) {
+ return status.failure("Criterion name is NULL");
+ }
+ if (criterion.values == NULL) {
+ return status.failure("Criterion values is NULL");
+ }
+ // Check that the criterion does not exist
+ if (criteria.find(criterion.name) != criteria.end()) {
+ return status.failure("Criterion \"" + string(criterion.name) +
+ "\" already exist");
+ }
+
+ // Create criterion type
+ ISelectionCriterionTypeInterface *type =
+ pfw->createSelectionCriterionType(criterion.inclusive);
+ assert(type != NULL);
+ // Add criterion values
+ for (size_t valueIndex = 0; criterion.values[valueIndex] != NULL; ++valueIndex) {
+ int value;
+ if (criterion.inclusive) {
+ // Check that (int)1 << valueIndex would not overflow (UB)
+ if(std::numeric_limits<int>::max() >> valueIndex == 0) {
+ return status.failure("Too many values for criterion " +
+ string(criterion.name));
+ }
+ value = 1 << valueIndex;
+ } else {
+ value = valueIndex;
+ }
+ const char * valueName = criterion.values[valueIndex];
+ if(not type->addValuePair(value, valueName)) {
+ return status.failure("Could not add value " + string(valueName) +
+ " to criterion " + criterion.name);
+ }
+ }
+ // Create criterion and add it to the pfw
+ criteria[criterion.name] = pfw->createSelectionCriterion(criterion.name, type);
+ }
+ return status.success();
+}
+
+
+bool pfwStart(PfwHandler *handle, const char *configPath,
+ const PfwCriterion criteria[], size_t criterionNb,
+ const PfwLogger *logger)
+{
+ // Check that the api is correctly used
+ if (handle == NULL) { return Status::failure(); }
+ Status &status = handle->lastStatus;
+
+ if (handle->pfw != NULL) {
+ return status.failure("Can not start an already started parameter framework");
+ }
+ if (configPath == NULL) {
+ return status.failure("char *configPath is NULL, "
+ "while starting the parameter framework");
+ }
+ if (criteria == NULL) {
+ return status.failure("char *criteria is NULL, "
+ "while starting the parameter framework "
+ "(config path is " + string(configPath) + ")");
+ }
+ // Create a pfw
+ handle->pfw = new CParameterMgrPlatformConnector(configPath);
+
+ handle->setLogger(logger);
+
+ if (not handle->createCriteria(criteria, criterionNb)) {
+ return status.failure();
+ }
+
+ return status.forward(handle->pfw->start(status.msg()));
+}
+
+const char *pfwGetLastError(const PfwHandler *handle)
+{
+ return handle == NULL ? NULL : handle->lastStatus.msg().c_str();
+}
+
+static pfw::Criterion *getCriterion(const pfw::Criteria &criteria,
+ const string &name)
+{
+ pfw::Criteria::const_iterator it = criteria.find(name);
+ return it == criteria.end() ? NULL : it->second;
+}
+
+bool pfwSetCriterion(PfwHandler *handle, const char name[], int value)
+{
+ if (handle == NULL) { return Status::failure(); }
+ Status &status = handle->lastStatus;
+ if (name == NULL) {
+ return status.failure("char *name of the criterion is NULL, "
+ "while setting a criterion.");
+ }
+ if (handle->pfw == NULL) {
+ return status.failure("Can not set criterion \"" + string(name) +
+ "\" as the parameter framework is not started.");
+ }
+ pfw::Criterion *criterion = getCriterion(handle->criteria, name);
+ if (criterion == NULL) {
+ return status.failure("Can not set criterion " + string(name) + " as does not exist");
+ }
+ criterion->setCriterionState(value);
+ return status.success();
+}
+bool pfwGetCriterion(const PfwHandler *handle, const char name[], int *value)
+{
+ if (handle == NULL) { return Status::failure(); }
+ Status &status = handle->lastStatus;
+ if (name == NULL) {
+ return status.failure("char *name of the criterion is NULL, "
+ "while getting a criterion.");
+ }
+ if (handle->pfw == NULL) {
+ return status.failure("Can not get criterion \"" + string(name) +
+ "\" as the parameter framework is not started.");
+ }
+ if (value == NULL) {
+ return status.failure("Can not get criterion \"" + string(name) +
+ "\" as the out value is NULL.");
+ }
+ pfw::Criterion *criterion = getCriterion(handle->criteria, name);
+ if (criterion == NULL) {
+ return status.failure("Can not get criterion " + string(name) + " as it does not exist");
+ }
+ *value = criterion->getCriterionState();
+ return status.success();
+}
+
+bool pfwApplyConfigurations(const PfwHandler *handle)
+{
+ if (handle == NULL) { return Status::failure(); }
+ Status &status = handle->lastStatus;
+ if (handle->pfw == NULL) {
+ return status.failure("Can not commit criteria "
+ "as the parameter framework is not started.");
+ }
+ handle->pfw->applyConfigurations();
+ return status.success();
+}
+
+///////////////////////////////
+/////// Parameter access //////
+///////////////////////////////
+
+struct PfwParameterHandler_
+{
+ PfwHandler &pfw;
+ CParameterHandle ¶meter;
+};
+
+PfwParameterHandler *pfwBindParameter(PfwHandler *handle, const char path[])
+{
+ if (handle == NULL) { return NULL; }
+ Status &status = handle->lastStatus;
+ if (path == NULL) {
+ status.failure("Can not bind a parameter without its path");
+ return NULL;
+ }
+ if (handle->pfw == NULL) {
+ status.failure("The parameter framework is not started, "
+ "while trying to bind parameter \"" + string(path) + "\")");
+ return NULL;
+ }
+
+ CParameterHandle *paramHandle;
+ paramHandle = handle->pfw->createParameterHandle(path, status.msg());
+ if (paramHandle == NULL) {
+ return NULL;
+ }
+
+ status.success();
+ PfwParameterHandler publicHandle = {*handle, *paramHandle};
+ return new PfwParameterHandler(publicHandle);
+}
+
+void pfwUnbindParameter(PfwParameterHandler *handle)
+{
+ if (handle == NULL) { return; }
+ delete &handle->parameter;
+ delete handle;
+}
+
+
+bool pfwGetIntParameter(const PfwParameterHandler *handle, int32_t *value)
+{
+ if (handle == NULL) { return Status::failure(); }
+ Status &status = handle->pfw.lastStatus;
+ if (value == NULL) {
+ return status.failure("int32_t *value is NULL, "
+ "while trying to get parameter \"" +
+ handle->parameter.getPath() + "\" value as int)");
+ }
+ return status.forward(handle->parameter.getAsSignedInteger(*value, status.msg()));
+}
+bool pfwSetIntParameter(PfwParameterHandler *handle, int32_t value)
+{
+ if (handle == NULL) { return Status::failure(); }
+ Status &status = handle->pfw.lastStatus;
+ return status.forward(handle->parameter.setAsSignedInteger(value, status.msg()));
+}
+
+bool pfwGetStringParameter(const PfwParameterHandler *handle, const char *value[])
+{
+ if (handle == NULL) { return Status::failure(); }
+ Status &status = handle->pfw.lastStatus;
+ if (value == NULL) {
+ return status.failure("char **value is NULL, "
+ "while trying to get parameter \"" +
+ handle->parameter.getPath() + "\" value as string)");
+ }
+ *value = NULL;
+ string retValue;
+ bool success = handle->parameter.getAsString(retValue, status.msg());
+ if (not success) { return status.forward(); }
+
+ *value = strdup(retValue.c_str());
+ return status.success();
+}
+
+bool pfwSetStringParameter(PfwParameterHandler *handle, const char value[])
+{
+ if (handle == NULL) { return Status::failure(); }
+ Status &status = handle->pfw.lastStatus;
+ return status.forward(handle->parameter.setAsString(value, status.msg()));
+}
+
+void pfwFree(void *ptr) { std::free(ptr); }
+
diff --git a/bindings/c/ParameterFramework.h b/bindings/c/ParameterFramework.h
new file mode 100644
index 0000000..20cc820
--- /dev/null
+++ b/bindings/c/ParameterFramework.h
@@ -0,0 +1,265 @@
+/** @copyright
+ * Copyright (c) 2015, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @file Simplified parameter framework C API.
+ * This API does not target a perfect one/one mapping with the c++ one,
+ * but rather aim ease of use and type safety (as far as possible in c).
+ * All function are reentrant and function call on a pfw (PfwHandle)
+ * does not impact any other pfw.
+ * Ie. There is no shared resources between pfw instances.
+ */
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <stddef.h>
+
+/** Lots of function in this API require non null pointer parameter.
+ * Such arguments are marked NONNULL.
+ */
+#define NONNULL __attribute__((nonnull))
+#define NONNULL_(...) __attribute__((nonnull (__VA_ARGS__)))
+#define USERESULT __attribute__((warn_unused_result))
+
+/** Private handle to a parameter framework.
+ * A PfwHandler* is valid if:
+ * - it was created by pfwCreate
+ * - it has not been destroyed by pfwDestroyParameter
+ * - is not NULL
+ * A valid handle MUST be provided to all pfw related method.
+ * A valid handler MUST be destroyed with pfwDestroy before programme
+ * termination.
+ * @note Forward declaration to break header dependency.
+ */
+struct PfwHandler_;
+/** Typedef for use ease. @see PfwHandler_. */
+typedef struct PfwHandler_ PfwHandler;
+
+///////////////////////////////
+///////////// Log /////////////
+///////////////////////////////
+/** Pfw log level for the callback. */
+typedef enum {
+ pfwLogInfo = 55, //< Random value to avoid unfortunate mismatch.
+ pfwLogWarning
+} PfwLogLevel;
+
+/** Type of the parameter framework log callback.
+ * @param userCtx[in] Arbitrary context provided during callback registration.
+ * @param level[in] Log level of the log line.
+ * @param logLine[in] Log line (without end line control character like '\n')
+ * to be logged. The pointer is invalidate after function
+ * return or if any pfw function is called.
+ */
+typedef void PfwLogCb(void *userCtx, PfwLogLevel level, const char *logLine);
+
+/** Logger containing a callback method and its context. */
+typedef struct {
+ /** User defined arbitrary value that will be provided to all logCb call. */
+ void *userCtx;
+ /** Callback that will be called.
+ * If NULL nothing will be logged.
+ */
+ PfwLogCb *logCb;
+} PfwLogger;
+
+///////////////////////////////
+///////////// Core ////////////
+///////////////////////////////
+
+/** Structure of a parameter framework criterion. */
+typedef struct {
+ /** Name of the criterion in the pfw configuration rules. */
+ const char *name; //< Must not be null.
+ bool inclusive; //< True if the criterion is inclusive, false if exclusive.
+ /** Null terminated list of criterion value names.
+ * @example { "Red", "Green", "Blue", NULL }
+ *
+ * For an exclusive criterion, the list must not contain more elements then
+ * INT_MAX.
+ * For an inclusive criterion, the list must not contain more elements then
+ * sizeof(int) * BIT_CHAR - 1.
+ * Ie: (int)1 << n must *not* overflow (UB),
+ * were n is the number of element in the
+ * list. @see pfwSetCriterion
+ */
+ const char **values; //< Must not be null.
+} PfwCriterion;
+
+
+/** Create a parameter framework instance.
+ * Can not fail except for memory allocation.
+ */
+PfwHandler *pfwCreate() USERESULT;
+
+/** Destroy a parameter framework. Can not fail. */
+void pfwDestroy(PfwHandler *handle) NONNULL;
+
+/** Start a parameter framework.
+ * @param handle[in] @see PfwHandler
+ * @param configPath[in] Path to the file containing the pfw configuration.
+ * @param criteria[in] An array of PfwCriterion.
+ * @param criterionNb[in] The number of PfwCriterion in criteria.
+ * @param logger[in] the logger to use for all operation.
+ * If NULL, log infos to standard output and
+ * errors to standard error.
+ * @return true on success, false on failure.
+ */
+bool pfwStart(PfwHandler *handle, const char *configPath,
+ const PfwCriterion criteria[], size_t criterionNb,
+ const PfwLogger *loggger) NONNULL_(1, 2, 3) USERESULT;
+
+/** @return a string describing the last call result.
+ * If the last pfw function call succeeded, return an empty string.
+ * If the last pfw function call failed, return a message explaining the error cause.
+ * The return pointer is invalidated if any pfw method is called on the SAME
+ * PfwHandle.
+ *
+ * Each PfwHandle own it's last error message. It is not static nor TLS.
+ * As a result, calling a pfw function with a NULL PfwHandler will result in a
+ * failure WITHOUT updating the last error.
+ */
+const char *pfwGetLastError(const PfwHandler *handle) NONNULL;
+
+/** Set a criterion value given its name and value.
+ * @param handle[in] @see PfwHandler
+ * @param name[in] The name of the criterion that need to be changed.
+ * @param value If the criterion is exclusive, the index of the new value.
+ * If the criterion is inclusive, a bit field where each bit
+ * correspond to the value index.
+ * For an inclusive criterion defined as such: { "Red", "Green", "Blue", NULL }
+ * to set the value Green and Blue, value has to be 1<<1 | 1<<2 = 0b110 = 6.
+ * For an exclusive criterion defined as such: { "Car", "Boat", "Plane", NULL }
+ * to set the value Plane, value has to be 2.
+ *
+ * Criterion change do not have impact on the parameters value
+ * (no configuration applied) until the changes are committed using pfwApplyConfigurations.
+ *
+ * @return true on success and false on failure.
+ */
+bool pfwSetCriterion(PfwHandler *handle, const char name[], int value) NONNULL USERESULT;
+/** Get a criterion value given its name.
+ * Same usage as pfwSetCriterion except that value is an out param.
+ * Get criterion will return the last value setted with pfwSetCriterion independantly of pfwCommitCritenio.
+ */
+bool pfwGetCriterion(const PfwHandler *handle, const char name[], int *value) NONNULL USERESULT;
+
+/** Commit criteria change and change parameters according to the configurations.
+ * Criterion do not have impact on the parameters value when changed,
+ * instead they are staged and only feed to the rule engine
+ * (who then impact parameter values according to the configuration) when
+ * committed with this function.
+ *
+ * @param handle[in] @see PfwHandler
+ * @return true on success and false on failure.
+ */
+bool pfwApplyConfigurations(const PfwHandler *handle) NONNULL USERESULT;
+
+///////////////////////////////
+/////// Parameter access //////
+///////////////////////////////
+
+/** Handler to a pfw parameter.
+ * A PfwParameterHandler* is valid if:
+ * - it was created by pfwBindParameter
+ * - it has not been destroyed by pfwDestroyParameter
+ * - is not NULL
+ * - the pfwHandle used to created is still valid (ie. it must not outlive
+ * its parent pfw)
+ * A valid handle MUST be provided to all pfw parameter related method.
+ * Any created handle MUST be destroyed (with pfwDestroyParameter) before
+ * the PfwHandler that was used for its creation.
+ * @note Forward declaration to break header dependency.
+ */
+struct PfwParameterHandler_;
+typedef struct PfwParameterHandler_ PfwParameterHandler;
+
+/** Construct the handle to a parameter given its path.
+ * The PfwHandle MUST stay valid until PfwParameterHandler destruction.
+ * @return a PfwParameterHandler on success, NULL on error.
+ * @see pfwGetLastError for error detail.
+ */
+PfwParameterHandler *pfwBindParameter(PfwHandler *handle, const char path[]) NONNULL;
+/** Destroy a parameter handle. Can not fail. */
+void pfwUnbindParameter(PfwParameterHandler *handle) NONNULL;
+
+/** Access the value of a previously bind int parameter.
+ * @param handle[in] Handler to a valid parameter.
+ * @param value[in] Non null pointer to an integer that will
+ * hold the parameter value on success, undefined otherwise.
+ * return true of success, false on failure.
+ */
+bool pfwGetIntParameter(const PfwParameterHandler *handle, int32_t *value ) NONNULL USERESULT;
+
+/** Set the value of a previously bind int parameter.
+ * @param handle[in] Handler to a valid parameter.
+ * @param value[in] The parameter value to set.
+ * return true of success, false on failure.
+ */
+bool pfwSetIntParameter(PfwParameterHandler *handle, int32_t value) NONNULL USERESULT;
+
+/** Access the value of a previously bind string parameter.
+ * @param handle[in] Handler to a valid parameter.
+ * @param value[out] Non null pointer on a string.
+ * Will point on the parameter value string on success,
+ * NULL on failure.
+ * The callee MUST free the returned string using pfwFree after use.
+ * @return true on success, false on failure.
+ */
+bool pfwGetStringParameter(const PfwParameterHandler *handle, const char *value[]) NONNULL;
+
+/** Set the value of a previously bind string parameter.
+ * @param handle[in] Handler to a valid parameter
+ * @param value[in] Non null pointer to a null terminated string to set.
+ */
+bool pfwSetStringParameter(PfwParameterHandler *handle, const char value[]) NONNULL USERESULT;
+
+/** Frees the memory space pointed to by ptr,
+ * which must have been returned by a previous call to the pfw.
+ *
+ * @param ptr[in] pointer to the memory to free.
+ * @see man 3 free for usage.
+ * @note Wrapper around the standard free to avoid problems
+ * in case of a different pfw and client allocator.
+ */
+void pfwFree(void *ptr);
+
+#undef NONNULL
+#undef NONNULL_
+#undef USERESULT
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/bindings/c/Test.cpp b/bindings/c/Test.cpp
new file mode 100644
index 0000000..8cbaa90
--- /dev/null
+++ b/bindings/c/Test.cpp
@@ -0,0 +1,415 @@
+/*
+ * Copyright (c) 2015, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "ParameterFramework.h"
+#include "FullIo.hpp"
+
+#define CATCH_CONFIG_MAIN // This tells Catch to provide a main()
+#include <catch.hpp>
+
+#include <string>
+#include <memory>
+#include <vector>
+
+#include <cstring>
+#include <cerrno>
+#include <climits>
+extern "C"
+{
+#include <unistd.h>
+}
+
+struct Test
+{
+ /** @return true if str is empty. */
+ bool empty(const char *str)
+ {
+ REQUIRE(str != NULL);
+ return *str == '\0';
+ }
+
+ void REQUIRE_FAILURE(bool success)
+ {
+ THEN("It should be an error") {
+ INFO("Previous pfw log: \n" + logLines);
+ CAPTURE(pfwGetLastError(pfw));
+ CHECK(not success);
+ CHECK(not empty(pfwGetLastError(pfw)));
+ }
+ }
+
+ void REQUIRE_SUCCESS(bool success)
+ {
+ THEN("It should be a success") {
+ INFO("Previous pfw log: \n" + logLines);
+ CAPTURE(pfwGetLastError(pfw));
+ CHECK(success);
+ CHECK(empty(pfwGetLastError(pfw)));
+ }
+ }
+
+ /** Class to create a temporary file */
+ class TmpFile
+ {
+ public:
+ TmpFile(const std::string &content) {
+ char tmpName[] = "./tmpPfwUnitTestXXXXXX";
+ mFd = mkstemp(tmpName);
+ CAPTURE(errno);
+ REQUIRE(mFd != -1);
+ mPath = tmpName;
+ REQUIRE(utility::fullWrite(mFd, content.c_str(), content.length()));
+ }
+ ~TmpFile() {
+ CHECK(close(mFd) != -1);
+ unlink(mPath.c_str());
+ }
+ operator const char *() const { return mPath.c_str(); }
+ const std::string &path() const { return mPath; }
+ private:
+ std::string mPath;
+ int mFd;
+ };
+
+ /** Log in logLines. */
+ static void logCb(void *voidLogLines, PfwLogLevel level, const char *logLine)
+ {
+ std::string &logLines = *reinterpret_cast<std::string *>(voidLogLines);
+ switch(level) {
+ case pfwLogWarning:
+ logLines += "Warning: ";
+ break;
+ case pfwLogInfo:
+ logLines += "Info: ";
+ }
+ logLines += logLine;
+ logLines += '\n';
+ }
+
+ /** Log buffer, will only be display in case of failure */
+ std::string logLines;
+
+ /** Pfw handler used in the tests. */
+ PfwHandler *pfw;
+
+};
+
+TEST_CASE_METHOD(Test, "Parameter-framework c api use") {
+ // Create criteria
+ const char *letterList[] = {"a", "b", "c", NULL};
+ const char *numberList[] = {"1", "2", "3", NULL};
+ const PfwCriterion criteria[] = {
+ {"inclusiveCrit", true, letterList},
+ {"exclusiveCrit", false, numberList},
+ };
+ size_t criterionNb = sizeof(criteria)/sizeof(criteria[0]);
+ PfwLogger logger = {&logLines, logCb};
+
+ // Create valid pfw config file
+ const char *intParameterPath = "/test/system/integer";
+ const char *stringParameterPath = "/test/system/string";
+ TmpFile system("<?xml version='1.0' encoding='UTF-8'?>\
+ <Subsystem Name='system' Type='Virtual' Endianness='Little'>\
+ <ComponentLibrary/>\
+ <InstanceDefinition>\
+ <IntegerParameter Name='integer' Size='32' Signed='true' Max='100'/>\
+ <StringParameter Name='string' MaxLength='9'/>\
+ </InstanceDefinition>\
+ </Subsystem>");
+ TmpFile libraries("<?xml version='1.0' encoding='UTF-8'?>\
+ <SystemClass Name='test'>\
+ <SubsystemInclude Path='" + system.path() + "'/>\
+ </SystemClass>");
+ TmpFile config("<?xml version='1.0' encoding='UTF-8'?>\
+ <ParameterFrameworkConfiguration\
+ SystemClassName='test' TuningAllowed='false'>\
+ <SubsystemPlugins/>\
+ <StructureDescriptionFileLocation Path='" + libraries.path() + "'/>\
+ </ParameterFrameworkConfiguration>");
+
+ GIVEN("A created parameter framework") {
+ pfw = pfwCreate();
+ REQUIRE(pfw != NULL);
+
+ THEN("Error message should be empty") {
+ CHECK(empty(pfwGetLastError(pfw)));
+ }
+
+ WHEN("The pfw is started without an handler") {
+ CHECK(not pfwStart(NULL, config, criteria, criterionNb, &logger));
+ }
+ WHEN("The pfw is started without a config path") {
+ REQUIRE_FAILURE(pfwStart(pfw, NULL, criteria, criterionNb, &logger));
+ }
+ WHEN("The pfw is started without an existent file") {
+ REQUIRE_FAILURE(pfwStart(pfw, "/doNotExist", criteria, criterionNb, &logger));
+ }
+
+ WHEN("The pfw is started without a criteria list") {
+ REQUIRE_FAILURE(pfwStart(pfw, config, NULL, criterionNb, &logger));
+ }
+ WHEN("The pfw is started with duplicated criterion value") {
+ const PfwCriterion duplicatedCriteria[] = {
+ {"duplicated name", true, letterList},
+ {"duplicated name", false, numberList},
+ };
+ REQUIRE_FAILURE(pfwStart(pfw, config, duplicatedCriteria, 2, &logger));
+ }
+ WHEN("The pfw is started with duplicated criterion value state") {
+ const char * values[] = {"a", "a", NULL};
+ const PfwCriterion duplicatedCriteria[] = {{"name", true, values}};
+
+ WHEN("Using test logger") {
+ REQUIRE_FAILURE(pfwStart(pfw, config, duplicatedCriteria, 1, &logger));
+ }
+ WHEN("Using default logger") {
+ // Test coverage of default logger warning
+ REQUIRE_FAILURE(pfwStart(pfw, config, duplicatedCriteria, 1, NULL));
+ }
+ }
+ WHEN("The pfw is started with NULL name criterion") {
+ const PfwCriterion duplicatedCriteria[] = {{NULL, true, letterList}};
+ REQUIRE_FAILURE(pfwStart(pfw, config, duplicatedCriteria, 1, &logger));
+ }
+ WHEN("The pfw is started with NULL criterion state list") {
+ const PfwCriterion duplicatedCriteria[] = {{"name", true, NULL}};
+ REQUIRE_FAILURE(pfwStart(pfw, config, duplicatedCriteria, 1, &logger));
+ }
+ GIVEN("A criteria with lots of values")
+ {
+ // Build a criterion with as many value as there is bits in int.
+ std::vector<char> names(sizeof(int) * CHAR_BIT + 1, 'a');
+ names.back() = '\0';
+ std::vector<const char *> values(names.size());
+ for(size_t i = 0; i < values.size(); ++i) {
+ values[i] = &names[i];
+ }
+ values.back() = NULL;
+ /* The pfw c api requires criterion values to be a NULL terminated
+ * array of string. Each string is a pointer to a NULL terminated
+ * array of char. The pfw requires each string to be different
+ * from all others, ie strcmp(values[i], values[j]) != 0 for any
+ * i j.
+ *
+ * In order to generate easily an array of different strings,
+ * instantiate one string (names) big enough
+ * (@see PfwCriterion::values).
+ * Then instantiate an array of pointer (values),
+ * each pointing to a different position in the previously
+ * created string.
+ *
+ * Representation of the names and values vectors.
+ *
+ * n = number of bit in an int
+ * <--- n+1 elements --->
+ * names = |a|a|a|a|...|a|a|a|\0|
+ * ^ ^ ^
+ * values[0] = ´ | |
+ * values[1] = --´ |
+ * ... |
+ * values[n - 1] = -----------´
+ * values[n] = NULL
+ *
+ */
+ const PfwCriterion duplicatedCriteria[] = {{"name", true, &values[0]}};
+
+ WHEN("The pfw is started with a too long criterion state list") {
+ REQUIRE_FAILURE(pfwStart(pfw, config, duplicatedCriteria, 1, &logger));
+ }
+ WHEN("The pfw is started with max length criterion state list") {
+ values[values.size() - 2] = NULL; // Hide last value
+ REQUIRE_SUCCESS(pfwStart(pfw, config, duplicatedCriteria, 1, &logger));
+ }
+ }
+
+ WHEN("The pfw is started with zero criteria") {
+ REQUIRE_SUCCESS(pfwStart(pfw, config, criteria, 0, &logger));
+ }
+
+ WHEN("The pfw is started twice a pfw") {
+ REQUIRE_SUCCESS(pfwStart(pfw, config, criteria, criterionNb, &logger));
+ REQUIRE_FAILURE(pfwStart(pfw, config, criteria, criterionNb, &logger));
+ }
+
+ WHEN("The pfw is started without a logger callback") {
+ PfwLogger noLog = { NULL, NULL };
+ REQUIRE_SUCCESS(pfwStart(pfw, config, criteria, criterionNb, &noLog));
+ }
+ WHEN("The pfw is started with default logger") {
+ REQUIRE_SUCCESS(pfwStart(pfw, config, criteria, criterionNb, NULL));
+ }
+
+ WHEN("Get criterion of a stopped pfw") {
+ int value;
+ REQUIRE_FAILURE(pfwGetCriterion(pfw, criteria[0].name, &value));
+ }
+ WHEN("Set criterion of a stopped pfw") {
+ REQUIRE_FAILURE(pfwSetCriterion(pfw, criteria[0].name, 1));
+ }
+ WHEN("Commit criteria of a stopped pfw") {
+ REQUIRE_FAILURE(pfwApplyConfigurations(pfw));
+ }
+
+ WHEN("Bind parameter with a stopped pfw") {
+ REQUIRE(pfwBindParameter(pfw, intParameterPath) == NULL);
+ }
+
+ WHEN("The pfw is started correctly")
+ {
+ REQUIRE_SUCCESS(pfwStart(pfw, config, criteria, criterionNb, &logger));
+ int value;
+
+ WHEN("Get criterion without an handle") {
+ REQUIRE(not pfwGetCriterion(NULL, criteria[0].name, &value));
+ }
+ WHEN("Get criterion without a name") {
+ REQUIRE_FAILURE(pfwGetCriterion(pfw, NULL, &value));
+ }
+ WHEN("Get criterion without an output value") {
+ REQUIRE_FAILURE(pfwGetCriterion(pfw, criteria[0].name, NULL));
+ }
+ WHEN("Get not existing criterion") {
+ REQUIRE_FAILURE(pfwGetCriterion(pfw, "Do not exist", &value));
+ }
+ THEN("All criterion should value 0") {
+ for(size_t i = 0; i < criterionNb; ++i) {
+ const char *criterionName = criteria[i].name;
+ CAPTURE(criterionName);
+ REQUIRE_SUCCESS(pfwGetCriterion(pfw, criterionName, &value));
+ REQUIRE(value == 0);
+ }
+ }
+
+ WHEN("Set criterion without an handle") {
+ REQUIRE(not pfwSetCriterion(NULL, criteria[0].name, 1));
+ }
+ WHEN("Set criterion without a name") {
+ REQUIRE_FAILURE(pfwSetCriterion(pfw, NULL, 2));
+ }
+ WHEN("Set not existing criterion") {
+ REQUIRE_FAILURE(pfwSetCriterion(pfw, "Do not exist", 3));
+ }
+ WHEN("Set criterion value") {
+ for(size_t i = 0; i < criterionNb; ++i) {
+ const char *criterionName = criteria[i].name;
+ CAPTURE(criterionName);
+ REQUIRE_SUCCESS(pfwSetCriterion(pfw, criterionName, 3));
+ }
+ THEN("Get criterion value should return what was set") {
+ for(size_t i = 0; i < criterionNb; ++i) {
+ const char *criterionName = criteria[i].name;
+ CAPTURE(criterionName);
+ REQUIRE_SUCCESS(pfwGetCriterion(pfw, criterionName, &value));
+ REQUIRE(value == 3);
+ }
+ }
+ }
+ WHEN("Commit criteria without a pfw") {
+ REQUIRE(not pfwApplyConfigurations(NULL));
+ }
+ WHEN("Commit criteria of a started pfw") {
+ REQUIRE_SUCCESS(pfwApplyConfigurations(pfw));
+ }
+
+ WHEN("Bind parameter without a pfw") {
+ REQUIRE(pfwBindParameter(NULL, intParameterPath) == NULL);
+ }
+ WHEN("Bind parameter without a path") {
+ REQUIRE_FAILURE(pfwBindParameter(pfw, NULL) != NULL);
+ }
+ WHEN("Bind a non existing parameter") {
+ REQUIRE_FAILURE(pfwBindParameter(pfw, "do/not/exist") != NULL);
+ }
+
+ WHEN("Set an int parameter without a parameter handle") {
+ REQUIRE(not pfwSetIntParameter(NULL, value));
+ }
+ WHEN("Get an int parameter without a parameter handle") {
+ REQUIRE(not pfwGetIntParameter(NULL, &value));
+ }
+
+ GIVEN("An integer parameter handle") {
+ PfwParameterHandler *param = pfwBindParameter(pfw, intParameterPath);
+ REQUIRE_SUCCESS(param != NULL);
+
+ WHEN("Get an int parameter without an output value") {
+ REQUIRE_FAILURE(pfwGetIntParameter(param, NULL));
+ }
+
+ WHEN("Set parameter out of range") {
+ REQUIRE_FAILURE(pfwSetIntParameter(param, 101));
+ }
+
+ WHEN("Set parameter") {
+ REQUIRE_SUCCESS(pfwSetIntParameter(param, 11));
+ THEN("Get parameter should return what was set") {
+ REQUIRE_SUCCESS(pfwGetIntParameter(param, &value));
+ REQUIRE(value == 11);
+ }
+ }
+
+ pfwUnbindParameter(param);
+ }
+
+ GIVEN("An string parameter handle") {
+ PfwParameterHandler *param = pfwBindParameter(pfw, stringParameterPath);
+ REQUIRE_SUCCESS(param != NULL);
+
+ WHEN("Get an int parameter without an output value") {
+ REQUIRE_FAILURE(pfwGetStringParameter(param, NULL));
+ }
+
+ WHEN("Set parameter out of range") {
+ REQUIRE_FAILURE(pfwSetStringParameter(param, "ko_1234567"));
+ }
+
+ WHEN("Set parameter") {
+ const char *value;
+ REQUIRE_SUCCESS(pfwSetStringParameter(param, "ok"));
+ THEN("Get parameter should return what was set") {
+ REQUIRE_SUCCESS(pfwGetStringParameter(param, &value));
+ REQUIRE(value == std::string("ok"));
+ pfwFree((void *)value);
+ }
+ }
+
+ pfwUnbindParameter(param);
+ }
+ }
+
+ pfwDestroy(pfw);
+ }
+}
+
+SCENARIO("Get last error without a pfw") {
+ THEN("Should return NULL") {
+ CHECK(pfwGetLastError(NULL) == NULL);
+ }
+}
diff --git a/bindings/python/Android.mk b/bindings/python/Android.mk
index fa5b7b8..b4b6277 100644
--- a/bindings/python/Android.mk
+++ b/bindings/python/Android.mk
@@ -38,26 +38,25 @@
LOCAL_MODULE := _PyPfw
LOCAL_CPP_EXTENSION := .cxx
-# As long as the parameter-framework is compiled with gcc, we must avoid
-# compiling the bindings with clang and compile with gcc instead.
-LOCAL_CLANG := false
# Android only provides a 32bit version of python.
LOCAL_32_BIT_ONLY := true
-LOCAL_SHARED_LIBRARIES := libparameter_host
-LOCAL_STATIC_LIBRARIES := libxmlserializer_host
+LOCAL_SHARED_LIBRARIES := libxmlserializer_host libparameter_host
+
+# python is only available in 32bits for now, thus arch is forced to 32bits
+PYTHON_INSTALL_PATH := prebuilts/python/$(HOST_OS)-x86/2.7.5/
+PYTHON_INCLUDES_PATH := $(PYTHON_INSTALL_PATH)/include/python2.7
+PYTHON_BIN_PATH := $(PYTHON_INSTALL_PATH)/bin
LOCAL_C_INCLUDES := \
- prebuilts/python/$(HOST_PREBUILT_TAG)/2.7.5/include/python2.7 \
+ $(PYTHON_INCLUDES_PATH) \
$(HOST_OUT_HEADERS)/parameter
-# The 'unused-but-set-variable' warning must be disabled because SWIG generates
-# files that do not respect that constraint.
# '-DSWIG_PYTHON_SILENT_MEMLEAK' is needed because the "memleak" warning
# pollutes the standard output. At the time of writing, the only warning is
# spurious anyway, as it relates to "ILogger *" which is an abstract
# class/interface class and as such cannot be destroyed.
-LOCAL_CFLAGS := -Wno-unused-but-set-variable -fexceptions -DSWIG_PYTHON_SILENT_MEMLEAK
+LOCAL_CFLAGS := -fexceptions -DSWIG_PYTHON_SILENT_MEMLEAK
# Undefined symbols will be resolved at runtime
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
@@ -74,6 +73,26 @@
LOCAL_EXPORT_C_INCLUDE_DIRS := $(generated-sources-dir)
+# Get the interpreter ld options.
+ifeq ($(HOST_OS), darwin)
+ # Contrary to linux, on darwin, a python 64 bit executable is installed
+ # in the x86 prebuild directory,
+ # As all host libraries are 32 bit in android. We can not link and host
+ # python module against the prebuild python library.
+ #
+ # As a *dirty* workaround, use the system's python configuration and hope
+ # it will be compatible with the prebuild python interpreter used at runtime.
+ # To summarize the prebuild python (64 bit?) interpreter will load a
+ # python native module (32bit) linked with the host (32 bit ?) python library.
+ LOCAL_LDLIBS += $(shell python-config --ldflags)
+else
+ # Careful, we need to invoke the android python config not the host's one.
+ # Unfortunately, the internal install directory of python is hardcoded to a dummy value,
+ # As a workaround, we need to manually add the correct path to libs to the library list.
+ LOCAL_LDLIBS += $(shell $(PYTHON_BIN_PATH)/python $(PYTHON_BIN_PATH)/python-config --ldflags) \
+ -L $(PYTHON_INSTALL_PATH)/lib/
+endif
+
$(generated-sources-dir)/pfw_wrap.h: $(generated-sources-dir)/pfw_wrap.cxx
# The PyPfw.py file is generated in the directory given by -outdir switch, thus
diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
index c159d96..5663301 100644
--- a/bindings/python/CMakeLists.txt
+++ b/bindings/python/CMakeLists.txt
@@ -29,34 +29,51 @@
find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
-find_package(PythonLibs)
-include_directories(${PYTHON_INCLUDE_PATH})
+# Force usage of Python 2.7.x ...
+find_package(PythonInterp 2.7 REQUIRED)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+# ... and force the libs to be at the same version as the interpreter
+find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT REQUIRED)
+include_directories(${PYTHON_INCLUDE_DIRS})
+
+include_directories(${PROJECT_SOURCE_DIR}/parameter/include)
set_property(SOURCE pfw.i PROPERTY CPLUSPLUS ON)
set_property(SOURCE pfw.i PROPERTY SWIG_FLAGS "-Wall" "-Werror")
swig_add_module(PyPfw python pfw.i)
swig_link_libraries(PyPfw parameter ${PYTHON_LIBRARIES})
+# For convenience, the global library output directory
+# (CMAKE_LIBRARY_OUTPUT_DIRECTORY) is set to ${CMAKE_BINARY_DIR}/lib, so that
+# all libs are generated in the same folder. This help writing test targets
+# (add_test) that do not need "make install" to be run.
+# However, putting _PyPfw.so in that folder defeats the purpose described
+# above because when running tests using the python bindings, the PYTHONPATH
+# needs to contain both _PyPfw.so and PyPfw.py. Without the line below,
+# _PyPfw.so would be put in ${CMAKE_BINARY_DIR}/lib while PyPfw.py is put in
+# ${CMAKE_CURRENT_BINARY_DIR}.
+set_property(TARGET _PyPfw PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
-include(FindPythonLibs)
-if(NOT PYTHONLIBS_FOUND)
- message(SEND_ERROR "python librarires not found. please instal python
- development packages")
-endif()
-
-include_directories(${PROJECT_SOURCE_DIR}/parameter/include ${PYTHON_INCLUDE_DIRS})
-
-# The 'unused-but-set-variable' warning must be disabled because SWIG generates
-# files that do not respect that contraint.
# '-DSWIG_PYTHON_SILENT_MEMLEAK' is needed because the "memleak" warning
# pollutes the standard output. At the time of writing, the only warning is
# spurious anyway, as it relates to "ILogger *" which is an abstract
# class/interface class and as such cannot be destroyed.
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable -DSWIG_PYTHON_SILENT_MEMLEAK")
+# -Wno-error is set to prevent compilation failure in case of the code
+# generated by swig generates warnings
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSWIG_PYTHON_SILENT_MEMLEAK -Wno-error")
-install(TARGETS _PyPfw LIBRARY DESTINATION lib)
+
+# Find the python modules install path.
+# plat_specific is needed because we are installing a shared-library python
+# module and not only a pure python module.
+# prefix='' makes get_python_lib return a relative path.
+execute_process(COMMAND
+ ${PYTHON_EXECUTABLE} -c
+ "from distutils import sysconfig;\\
+ print(sysconfig.get_python_lib(plat_specific=True, prefix=''))"
+ OUTPUT_VARIABLE PYTHON_MODULE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+install(TARGETS _PyPfw LIBRARY DESTINATION ${PYTHON_MODULE_PATH})
# install the generated Python file as well
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PyPfw.py DESTINATION lib)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PyPfw.py DESTINATION ${PYTHON_MODULE_PATH})
diff --git a/bindings/python/pfw.i b/bindings/python/pfw.i
index 9dbccbd..bf1330b 100644
--- a/bindings/python/pfw.i
+++ b/bindings/python/pfw.i
@@ -32,7 +32,7 @@
// like derived C++ classes (calls to virtual methods will be properly
// forwarded to Python) - only on classes for which is it specified, see
// ILogger below..
-%module(directors="1") PyPfw
+%module(directors="1", threads="1") PyPfw
%feature("director:except") {
if ($error != NULL) {
@@ -159,6 +159,8 @@
std::string& strError);
bool importSingleDomainXml(const std::string& strXmlSource, bool bOverwrite,
std::string& strError);
+ bool importSingleDomainXml(const std::string& xmlSource, bool overwrite, bool withSettings,
+ bool fromFile, std::string& strError);
// Tells swig that "strXmlDest" in the two following methods are "inout"
// parameters
diff --git a/ctest/CMakeLists.txt b/ctest/CMakeLists.txt
new file mode 100644
index 0000000..bc74a93
--- /dev/null
+++ b/ctest/CMakeLists.txt
@@ -0,0 +1,58 @@
+# Copyright (c) 2014-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Ctest configuration variables must be set BEFORE include(Ctest)
+
+# Check process children and give detail for each leak
+set(MEMORYCHECK_COMMAND_OPTIONS
+ "${MEMORYCHECK_COMMAND_OPTIONS} --trace-children=yes --leak-check=full")
+
+# As dash is not used to submit results, there is no way to see valgrind result.
+# Force it to log to stderr and fail in case of leak or error.
+set(MEMORYCHECK_COMMAND_OPTIONS
+ "${MEMORYCHECK_COMMAND_OPTIONS} --error-exitcode=255 --log-fd=2")
+
+set(MEMORYCHECK_COMMAND_OPTIONS
+ "${MEMORYCHECK_COMMAND_OPTIONS} --suppressions=${CMAKE_CURRENT_LIST_DIR}/valgrind.supp")
+
+# Enable tests, coverage, memcheck, ...
+# See http://www.cmake.org/Wiki/CMake/Testing_With_CTest#Dashboard_Preparation
+include(CTest)
+
+# Ctest requires its configuration to be placed at the build root
+configure_file(${CMAKE_CURRENT_LIST_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR} COPYONLY)
+
+# Set environement variables so that executables and libraries can be find by tests.
+# (avoids a make install before make test)
+function(set_test_env TestName)
+ set_property(TEST ${TestName} PROPERTY ENVIRONMENT
+ PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}:$ENV{PATH}
+ LD_LIBRARY_PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}:$ENV{LD_LIBRARY_PATH}
+ PYTHONPATH=${CMAKE_BINARY_DIR}/bindings/python:$ENV{PYTHONPATH})
+endfunction()
+
diff --git a/ctest/CTestCustom.cmake b/ctest/CTestCustom.cmake
new file mode 100644
index 0000000..c0381a4
--- /dev/null
+++ b/ctest/CTestCustom.cmake
@@ -0,0 +1,7 @@
+SET(CTEST_CUSTOM_MEMCHECK_IGNORE
+ ${CTEST_CUSTOM_MEMCHECK_IGNORE}
+ # Python generates too many valgrind errors,
+ # runing python based tests would be long and useless.
+ fix_point_parameter
+ functional-test
+ )
diff --git a/ctest/valgrind.supp b/ctest/valgrind.supp
new file mode 100644
index 0000000..1de6188
--- /dev/null
+++ b/ctest/valgrind.supp
@@ -0,0 +1,11 @@
+# Ignore conditional jump in libz.
+# It is fixed in zlib1g v1.2.8 (ubuntu 14.04)
+# but not in v1.2.3 (ubuntu 12.04) which travis has.
+{
+ libz/inflateReset2/jump
+ Memcheck:Cond
+ fun:inflateReset2
+ fun:inflateInit2_
+ obj:/*/libz.so*
+}
+
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
new file mode 100644
index 0000000..06804bd
--- /dev/null
+++ b/doc/CMakeLists.txt
@@ -0,0 +1,60 @@
+# Copyright (c) 2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+option(DOXYGEN
+ "Enable doxygen generation (you still have to run 'make doc')"
+ OFF)
+
+include(CMakeDependentOption)
+# Only present DOXYGEN_GRAPHS if DOXYGEN is ON and if so, default to ON.
+# Else, set to OFF.
+cmake_dependent_option(DOXYGEN_GRAPHS
+ "Generate graphs in the doxygen documentation (you need the 'dot'
+ utility)"
+ ON
+ "DOXYGEN" OFF)
+
+if(DOXYGEN)
+ find_package(Doxygen REQUIRED)
+
+ if(DOXYGEN_GRAPHS AND (NOT DOXYGEN_DOT_FOUND))
+ message(SEND_ERROR "
+ The 'dot' utility was not found;"
+ " install it or deactivate graph generation (DOXYGEN_GRAPHS=OFF).")
+ endif()
+
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
+ ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+ @ONLY)
+ add_custom_target(doc
+ ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Generating documentation with Doxygen"
+ VERBATIM)
+endif()
diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in
new file mode 100644
index 0000000..34b80a5
--- /dev/null
+++ b/doc/Doxyfile.in
@@ -0,0 +1,2320 @@
+# Doxyfile 1.8.7
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all text
+# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
+# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
+# for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME = "parameter-framework"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER = @PARAMETER_FRAMEWORK_VERSION@
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF = "Plugin-based and rule-based framework for describing and controlling parameters"
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
+# the documentation. The maximum height of the logo should not exceed 55 pixels
+# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
+# to the output directory.
+
+PROJECT_LOGO =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = doxygen
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS = NO
+
+# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
+# characters to appear in the names of generated files. If set to NO, non-ASCII
+# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
+# U+3044.
+# The default value is: NO.
+
+ALLOW_UNICODE_NAMES = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC = YES
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES = YES
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF = YES
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF = Yes
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
+# new page for each member. If set to NO, the documentation of a member will be
+# part of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines.
+
+ALIASES =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
+# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
+# Fortran. In the later case the parser tries to guess whether the code is fixed
+# or free formatted code, this is the default for Fortran type files), VHDL. For
+# instance to make doxygen treat .inc files as Fortran files (default is PHP),
+# and .f files as C (default is Fortran), use: inc=Fortran f=C.
+#
+# Note For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT = YES
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by by putting a % sign in front of the word
+# or globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO these classes will be included in the various overviews. This option has
+# no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING = NO
+
+# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
+# todo list. This list is created by putting \todo commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
+# test list. This list is created by putting \test commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES the list
+# will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. Do not use file names with spaces, bibtex cannot handle them. See
+# also \cite for info how to create references.
+
+CITE_BIB_FILES =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO doxygen will only warn about wrong or incomplete parameter
+# documentation, but not about the absence of documentation.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces.
+# Note: If this tag is empty the current directory is searched.
+
+INPUT = @PROJECT_SOURCE_DIR@ \
+ @PROJECT_SOURCE_DIR@/bindings \
+ @PROJECT_SOURCE_DIR@/parameter \
+ @PROJECT_SOURCE_DIR@/remote-process \
+ @PROJECT_SOURCE_DIR@/remote-processor \
+ @PROJECT_SOURCE_DIR@/Schemas
+ @PROJECT_SOURCE_DIR@/test/test-platform \
+ @PROJECT_SOURCE_DIR@/utility \
+ @PROJECT_SOURCE_DIR@/xmlserializer \
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: http://www.gnu.org/software/libiconv) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank the
+# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
+# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
+# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
+# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
+# *.qsf, *.as and *.js.
+
+FILE_PATTERNS =
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER ) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE = README.md
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# function all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see http://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX = 4
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
+# defined cascading style sheet that is included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefor more robust against future updates.
+# Doxygen will copy the style sheet file to the output directory. For an example
+# see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the stylesheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, see
+# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP = NO
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: http://developer.apple.com/tools/xcode/), introduced with
+# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler ( hhc.exe). If non-empty
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated (
+# YES) or that it should be included in the master .chm file ( NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated (
+# YES) or a normal table of contents ( NO) in the .chm file. Furthermore it
+# enables the Previous and Next buttons.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# http://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using prerendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from http://www.mathjax.org before deployment.
+# The default value is: http://cdn.mathjax.org/mathjax/latest.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH = http://www.mathjax.org/mathjax
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
+# setting. When disabled, doxygen will generate a PHP script for searching and
+# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
+# and searching needs to be provided by external tools. See the section
+# "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when enabling USE_PDFLATEX this option is only used for generating
+# bitmaps for formulas in the HTML output, but not in the Makefile that is
+# written to the output directory.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. To get the times font for
+# instance you can specify
+# EXTRA_PACKAGES=times
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
+# replace them by respectively the title of the page, the current date and time,
+# only the current date, the version number of doxygen, the project name (see
+# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS = YES
+
+# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE = plain
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's config
+# file, i.e. a series of assignments. You only have to provide replacements,
+# missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION = .3
+
+# The MAN_SUBDIR tag determines the name of the directory created within
+# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
+# MAN_EXTENSION with the initial . removed.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_SUBDIR =
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT = xml
+
+# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT = docbook
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
+# Definitions (see http://autogen.sf.net) file that captures the structure of
+# the code including all documentation. Note that this feature is still
+# experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
+# in the source code. If set to NO only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES the includes files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all references to function-like macros that are alone on a line, have
+# an all uppercase name, and do not end with a semicolon. Such function macros
+# are typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have a unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
+# class index. If set to NO only the inherited external classes will be listed.
+# The default value is: NO.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
+# the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS = YES
+
+# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of 'which perl').
+# The default file (with absolute path) is: /usr/bin/perl.
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS = NO
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see:
+# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: YES.
+
+HAVE_DOT = @DOXYGEN_DOT_FOUND@
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS = 0
+
+# When you want a differently looking font n the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME = Verdana
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH = NO
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS = 0
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS = YES
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH = YES
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH = YES
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot.
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd,
+# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo,
+# gif:cairo:gd, gif:gd, gif:gd:gd and svg.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT = svg
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH = @DOXYGEN_DOT_PATH@
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS =
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES = 100
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND = NO
+
+# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP = YES
diff --git a/parameter/Android.mk b/parameter/Android.mk
index 86623be..7fa83fc 100644
--- a/parameter/Android.mk
+++ b/parameter/Android.mk
@@ -126,16 +126,13 @@
-Werror \
-Wextra \
-Wno-unused-parameter \
- -Wno-maybe-uninitialized \
+ -Wno-maybe-uninitialized
common_c_includes := \
$(LOCAL_PATH)/include/ \
$(LOCAL_PATH)/../utility/ \
- $(LOCAL_PATH)/../xmlserializer/ \
$(LOCAL_PATH)/../remote-processor/
-common_shared_libraries := libicuuc
-
#############################
# Target build
@@ -144,6 +141,8 @@
LOCAL_COPY_HEADERS_TO := $(common_copy_headers_to)
LOCAL_COPY_HEADERS := $(common_copy_headers)
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+
LOCAL_CFLAGS := $(common_cflags)
LOCAL_SRC_FILES := $(common_src_files)
@@ -154,13 +153,11 @@
LOCAL_C_INCLUDES := $(common_c_includes)
-LOCAL_SHARED_LIBRARIES := $(common_shared_libraries) libdl
-LOCAL_STATIC_LIBRARIES := libxmlserializer libpfw_utility libxml2
+LOCAL_SHARED_LIBRARIES := libxmlserializer libdl
+LOCAL_STATIC_LIBRARIES := libpfw_utility
LOCAL_REQUIRED_MODULES := libremote-processor
-LOCAL_CLANG := false
-
ifeq ($(INCLUDE_STLPORT), true)
include external/stlport/libstlport.mk
endif
@@ -175,6 +172,8 @@
LOCAL_COPY_HEADERS_TO := $(common_copy_headers_to)
LOCAL_COPY_HEADERS := $(common_copy_headers)
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+
LOCAL_CFLAGS := $(common_cflags) -O0 -ggdb
LOCAL_SRC_FILES := $(common_src_files)
@@ -186,44 +185,9 @@
LOCAL_C_INCLUDES += \
$(common_c_includes)
-LOCAL_SHARED_LIBRARIES := $(common_shared_libraries)-host
-LOCAL_STATIC_LIBRARIES := libxmlserializer_host libpfw_utility_host libxml2
+LOCAL_SHARED_LIBRARIES := libxmlserializer_host
+LOCAL_STATIC_LIBRARIES := libpfw_utility_host libxml2
LOCAL_LDLIBS += -ldl
-LOCAL_CLANG := false
include $(BUILD_HOST_SHARED_LIBRARY)
-
-################################
-# Export includes for plugins (Target build)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := $(common_module)_includes
-LOCAL_MODULE_OWNER := intel
-
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-
-LOCAL_STATIC_LIBRARIES := \
- libxmlserializer \
- libpfw_utility \
- libxml2
-
-include $(BUILD_STATIC_LIBRARY)
-
-################################
-# Export includes for plugins (Host build)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := $(common_module)_includes_host
-LOCAL_MODULE_OWNER := intel
-
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-
-LOCAL_STATIC_LIBRARIES := \
- libxmlserializer_host \
- libpfw_utility_host \
- libxml2
-
-include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/parameter/ArrayParameter.cpp b/parameter/ArrayParameter.cpp
index c946392..291b6a1 100644
--- a/parameter/ArrayParameter.cpp
+++ b/parameter/ArrayParameter.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -34,6 +34,7 @@
#include "ParameterAccessContext.h"
#include "ConfigurationAccessContext.h"
#include "ParameterBlackboard.h"
+#include "Utility.h"
#include <assert.h>
#define base CParameter
@@ -62,7 +63,7 @@
// Array length
strResult += "Array length: ";
- strResult += toString(getArrayLength());
+ strResult += CUtility::toString(getArrayLength());
strResult += "\n";
}
@@ -257,10 +258,10 @@
bool CArrayParameter::setValues(uint32_t uiStartIndex, uint32_t uiBaseOffset, const string& strValue, CParameterAccessContext& parameterAccessContext) const
{
// Deal with value(s)
- Tokenizer tok(strValue, DEFAULT_DELIMITER + ",");
+ Tokenizer tok(strValue, Tokenizer::defaultDelimiters + ",");
std::vector<string> astrValues = tok.split();
- uint32_t uiNbValues = astrValues.size();
+ size_t uiNbValues = astrValues.size();
// Check number of provided values
if (uiNbValues + uiStartIndex > getArrayLength()) {
@@ -281,7 +282,8 @@
if (!doSetValue(astrValues[uiValueIndex], uiOffset, parameterAccessContext)) {
// Append parameter path to error
- parameterAccessContext.appendToError(" " + getPath() + "/" + toString(uiValueIndex + uiStartIndex));
+ parameterAccessContext.appendToError(" " + getPath() + "/" +
+ CUtility::toString(uiValueIndex + uiStartIndex));
return false;
}
diff --git a/parameter/BinarySerializableElement.cpp b/parameter/BinarySerializableElement.cpp
index 5beed15..744d140 100644
--- a/parameter/BinarySerializableElement.cpp
+++ b/parameter/BinarySerializableElement.cpp
@@ -41,8 +41,8 @@
void CBinarySerializableElement::binarySerialize(CBinaryStream& binaryStream)
{
// Propagate
- uint32_t uiNbChildren = getNbChildren();
- uint32_t uiChild;
+ size_t uiNbChildren = getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
@@ -53,12 +53,12 @@
}
// Data size
-uint32_t CBinarySerializableElement::getDataSize() const
+size_t CBinarySerializableElement::getDataSize() const
{
// Propagate
- uint32_t uiDataSize = 0;
- uint32_t uiNbChildren = getNbChildren();
- uint32_t uiChild;
+ size_t uiDataSize = 0;
+ size_t uiNbChildren = getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
diff --git a/parameter/BinarySerializableElement.h b/parameter/BinarySerializableElement.h
index 58f5d1f..222b8e9 100644
--- a/parameter/BinarySerializableElement.h
+++ b/parameter/BinarySerializableElement.h
@@ -43,6 +43,6 @@
virtual void binarySerialize(CBinaryStream& binaryStream);
// Data size
- virtual uint32_t getDataSize() const;
+ virtual size_t getDataSize() const;
protected:
};
diff --git a/parameter/BinaryStream.cpp b/parameter/BinaryStream.cpp
index 701e9b8..2dc3380 100644
--- a/parameter/BinaryStream.cpp
+++ b/parameter/BinaryStream.cpp
@@ -33,7 +33,7 @@
using namespace std;
-CBinaryStream::CBinaryStream(const string& strFileName, bool bOut, uint32_t uiDataSize, uint8_t uiStructureChecksum) :
+CBinaryStream::CBinaryStream(const string& strFileName, bool bOut, size_t uiDataSize, uint8_t uiStructureChecksum) :
_strFileName(strFileName),
_bOut(bOut),
_uiDataSize(uiDataSize),
@@ -69,10 +69,10 @@
if (!_bOut) {
// Get file size
- ifstream::pos_type uiFileSize = _fileStream.tellg();
+ size_t uiFileSize = _fileStream.tellg();
// Validate file size
- if (_uiDataSize + sizeof(_uiStructureChecksum) != (uint32_t)uiFileSize) {
+ if (_uiDataSize + sizeof(_uiStructureChecksum) != uiFileSize) {
// Size different from expected
strError = "Unexpected file size";
@@ -136,7 +136,7 @@
_uiPos = 0;
}
-void CBinaryStream::write(const uint8_t* puiData, uint32_t uiSize)
+void CBinaryStream::write(const uint8_t* puiData, size_t uiSize)
{
assert(_uiPos + uiSize <= _uiDataSize);
@@ -145,7 +145,7 @@
_uiPos += uiSize;
}
-void CBinaryStream::read(uint8_t* puiData, uint32_t uiSize)
+void CBinaryStream::read(uint8_t* puiData, size_t uiSize)
{
assert(_uiPos + uiSize <= _uiDataSize);
diff --git a/parameter/BinaryStream.h b/parameter/BinaryStream.h
index a9a0447..6df777c 100644
--- a/parameter/BinaryStream.h
+++ b/parameter/BinaryStream.h
@@ -36,7 +36,7 @@
class CBinaryStream
{
public:
- CBinaryStream(const std::string& strFileName, bool bOut, uint32_t uiDataSize, uint8_t uiStructureChecksum);
+ CBinaryStream(const std::string& strFileName, bool bOut, size_t uiDataSize, uint8_t uiStructureChecksum);
~CBinaryStream();
// Open close
@@ -47,8 +47,8 @@
void reset();
// Read/Write
- void write(const uint8_t* puiData, uint32_t uiSize);
- void read(uint8_t* puiData, uint32_t uiSize);
+ void write(const uint8_t* puiData, size_t uiSize);
+ void read(uint8_t* puiData, size_t uiSize);
// Direction
bool isOut() const;
@@ -63,7 +63,7 @@
// Serialization direction
bool _bOut;
// Data size
- uint32_t _uiDataSize;
+ size_t _uiDataSize;
// System structure checksum
uint8_t _uiStructureChecksum;
// Read/Write data
@@ -71,7 +71,7 @@
// File
std::fstream _fileStream;
// Ops in faile
- uint32_t _uiPos;
+ size_t _uiPos;
// File state
bool _bOpen;
};
diff --git a/parameter/BitParameter.cpp b/parameter/BitParameter.cpp
index fb853e4..2a53afd 100644
--- a/parameter/BitParameter.cpp
+++ b/parameter/BitParameter.cpp
@@ -87,7 +87,7 @@
}
// Rely on integer access
- uint64_t uiValue;
+ uint32_t uiValue;
if (bSet) {
@@ -108,7 +108,7 @@
}
// Integer Access
-bool CBitParameter::accessAsInteger(uint64_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const
+bool CBitParameter::accessAsInteger(uint32_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const
{
uint32_t uiOffset = getOffset();
diff --git a/parameter/BitParameter.h b/parameter/BitParameter.h
index 436f321..f9e2b9d 100644
--- a/parameter/BitParameter.h
+++ b/parameter/BitParameter.h
@@ -49,7 +49,7 @@
virtual bool accessAsBoolean(bool& bValue, bool bSet, CParameterAccessContext& parameterAccessContext) const;
// Integer Access
- virtual bool accessAsInteger(uint64_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const;
+ virtual bool accessAsInteger(uint32_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const;
// AreaConfiguration creation
virtual CAreaConfiguration* createAreaConfiguration(const CSyncerSet* pSyncerSet) const;
diff --git a/parameter/BitParameterBlockType.cpp b/parameter/BitParameterBlockType.cpp
index 2016b3b..0d344f2 100644
--- a/parameter/BitParameterBlockType.cpp
+++ b/parameter/BitParameterBlockType.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -29,6 +29,7 @@
*/
#include "BitParameterBlockType.h"
#include "BitParameterBlock.h"
+#include "Utility.h"
#define base CTypeElement
@@ -74,7 +75,7 @@
void CBitParameterBlockType::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
// Size
- xmlElement.setAttributeString("Size", toString(_uiSize * 8));
+ xmlElement.setAttributeString("Size", CUtility::toString(_uiSize * 8));
base::toXml(xmlElement, serializingContext);
}
diff --git a/parameter/BitParameterType.cpp b/parameter/BitParameterType.cpp
index 2a400d4..14fe901 100644
--- a/parameter/BitParameterType.cpp
+++ b/parameter/BitParameterType.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -33,6 +33,7 @@
#include <sstream>
#include "ParameterAccessContext.h"
#include "BitParameterBlockType.h"
+#include "Utility.h"
#define base CTypeElement
@@ -55,17 +56,17 @@
// Bit Pos
strResult += "Bit pos: ";
- strResult += toString(_uiBitPos);
+ strResult += CUtility::toString(_uiBitPos);
strResult += "\n";
// Bit size
strResult += "Bit size: ";
- strResult += toString(_uiBitSize);
+ strResult += CUtility::toString(_uiBitSize);
strResult += "\n";
// Max
strResult += "Max: ";
- strResult += toString(_uiMax);
+ strResult += CUtility::toString(_uiMax);
strResult += "\n";
}
@@ -191,7 +192,7 @@
return true;
}
-void CBitParameterType::fromBlackboard(uint64_t& uiUserValue, uint64_t uiValue, CParameterAccessContext& parameterAccessContext) const
+void CBitParameterType::fromBlackboard(uint32_t& uiUserValue, uint64_t uiValue, CParameterAccessContext& parameterAccessContext) const
{
(void)parameterAccessContext;
@@ -245,13 +246,13 @@
void CBitParameterType::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
// Position
- xmlElement.setAttributeString("Pos", toString(_uiBitPos));
+ xmlElement.setAttributeString("Pos", CUtility::toString(_uiBitPos));
// Size
- xmlElement.setAttributeString("Size", toString(_uiBitSize));
+ xmlElement.setAttributeString("Size", CUtility::toString(_uiBitSize));
// Maximum
- xmlElement.setAttributeString("Max", toString(_uiMax));
+ xmlElement.setAttributeString("Max", CUtility::toString(_uiMax));
base::toXml(xmlElement, serializingContext);
diff --git a/parameter/BitParameterType.h b/parameter/BitParameterType.h
index 8f147e6..4c91a1a 100644
--- a/parameter/BitParameterType.h
+++ b/parameter/BitParameterType.h
@@ -53,7 +53,7 @@
void fromBlackboard(std::string& strValue, const uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const;
// Integer
bool toBlackboard(uint64_t uiUserValue, uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const;
- void fromBlackboard(uint64_t& uiUserValue, uint64_t uiValue, CParameterAccessContext& parameterAccessContext) const;
+ void fromBlackboard(uint32_t& uiUserValue, uint64_t uiValue, CParameterAccessContext& parameterAccessContext) const;
// Access from area configuration
uint64_t merge(uint64_t uiOriginData, uint64_t uiNewData) const;
diff --git a/parameter/CompoundRule.cpp b/parameter/CompoundRule.cpp
index 9fc2674..addb31c 100644
--- a/parameter/CompoundRule.cpp
+++ b/parameter/CompoundRule.cpp
@@ -96,8 +96,8 @@
strResult += "{";
// Children
- uint32_t uiChild;
- uint32_t uiNbChildren = getNbChildren();
+ size_t uiChild;
+ size_t uiNbChildren = getNbChildren();
bool bFirst = true;
for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
@@ -121,8 +121,8 @@
// Rule check
bool CCompoundRule::matches() const
{
- uint32_t uiChild;
- uint32_t uiNbChildren = getNbChildren();
+ size_t uiChild;
+ size_t uiNbChildren = getNbChildren();
for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
diff --git a/parameter/ConfigurableDomain.cpp b/parameter/ConfigurableDomain.cpp
index 35acb9c..346b1f9 100644
--- a/parameter/ConfigurableDomain.cpp
+++ b/parameter/ConfigurableDomain.cpp
@@ -190,8 +190,8 @@
xmlElement.createChild(xmlSettingsElement, "Settings");
// Serialize out all configurations settings
- uint32_t uiNbConfigurations = getNbChildren();
- uint32_t uiChildConfiguration;
+ size_t uiNbConfigurations = getNbChildren();
+ size_t uiChildConfiguration;
for (uiChildConfiguration = 0; uiChildConfiguration < uiNbConfigurations; uiChildConfiguration++) {
@@ -466,7 +466,7 @@
log_info("Splitting configurable element \"%s\" domain \"%s\"", pConfigurableElement->getPath().c_str(), getName().c_str());
// Create sub domain areas for all configurable element's children
- uint32_t uiNbConfigurableElementChildren = pConfigurableElement->getNbChildren();
+ size_t uiNbConfigurableElementChildren = pConfigurableElement->getNbChildren();
if (!uiNbConfigurableElementChildren) {
@@ -475,7 +475,7 @@
return false;
}
- uint32_t uiChild;
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbConfigurableElementChildren; uiChild++) {
@@ -485,7 +485,7 @@
}
// Delegate to configurations
- uint32_t uiNbConfigurations = getNbChildren();
+ size_t uiNbConfigurations = getNbChildren();
for (uiChild = 0; uiChild < uiNbConfigurations; uiChild++) {
@@ -833,8 +833,8 @@
{
// Propagate
- uint32_t uiNbConfigurations = getNbChildren();
- uint32_t uiChild;
+ size_t uiNbConfigurations = getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbConfigurations; uiChild++) {
@@ -847,11 +847,11 @@
// Ensure validity on areas related to configurable element
void CConfigurableDomain::validateAreas(const CConfigurableElement* pConfigurableElement, const CParameterBlackboard* pMainBlackboard)
{
- log_info("Validating domain \"" + getName() + "\" against main blackboard for configurable element \"" + pConfigurableElement->getPath() + "\"");
+ log_info("Validating domain \"%s\" against main blackboard for configurable element \"%s\"", getName().c_str(), pConfigurableElement->getPath().c_str());
// Propagate
- uint32_t uiNbConfigurations = getNbChildren();
- uint32_t uiChild;
+ size_t uiNbConfigurations = getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbConfigurations; uiChild++) {
@@ -890,8 +890,8 @@
}
// Validate all other configurations against found one, if any
- uint32_t uiNbConfigurations = getNbChildren();
- uint32_t uiChild;
+ size_t uiNbConfigurations = getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbConfigurations; uiChild++) {
@@ -908,8 +908,8 @@
bool CConfigurableDomain::autoValidateConfiguration(CDomainConfiguration* pDomainConfiguration)
{
// Find another configuration than this one, that ought to be valid!
- uint32_t uiNbConfigurations = getNbChildren();
- uint32_t uiChild;
+ size_t uiNbConfigurations = getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbConfigurations; uiChild++) {
@@ -929,8 +929,8 @@
// Search for a valid configuration for given configurable element
const CDomainConfiguration* CConfigurableDomain::findValidDomainConfiguration(const CConfigurableElement* pConfigurableElement) const
{
- uint32_t uiNbConfigurations = getNbChildren();
- uint32_t uiChild;
+ size_t uiNbConfigurations = getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbConfigurations; uiChild++) {
@@ -947,8 +947,8 @@
// Search for an applicable configuration
const CDomainConfiguration* CConfigurableDomain::findApplicableDomainConfiguration() const
{
- uint32_t uiNbConfigurations = getNbChildren();
- uint32_t uiChild;
+ size_t uiNbConfigurations = getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbConfigurations; uiChild++) {
@@ -1023,8 +1023,8 @@
void CConfigurableDomain::mergeConfigurations(CConfigurableElement* pToConfigurableElement, CConfigurableElement* pFromConfigurableElement)
{
// Propagate to domain configurations
- uint32_t uiNbConfigurations = getNbChildren();
- uint32_t uiChild;
+ size_t uiNbConfigurations = getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbConfigurations; uiChild++) {
@@ -1054,8 +1054,8 @@
_syncerSet += *pSyncerSet;
// Inform configurations
- uint32_t uiNbConfigurations = getNbChildren();
- uint32_t uiChild;
+ size_t uiNbConfigurations = getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbConfigurations; uiChild++) {
@@ -1094,8 +1094,8 @@
pConfigurableElement->removeAttachedConfigurableDomain(this);
// Inform configurations
- uint32_t uiNbConfigurations = getNbChildren();
- uint32_t uiChild;
+ size_t uiNbConfigurations = getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbConfigurations; uiChild++) {
diff --git a/parameter/ConfigurableDomains.cpp b/parameter/ConfigurableDomains.cpp
index b77e2aa..bfa9271 100644
--- a/parameter/ConfigurableDomains.cpp
+++ b/parameter/ConfigurableDomains.cpp
@@ -56,8 +56,8 @@
void CConfigurableDomains::validate(const CParameterBlackboard* pMainBlackboard)
{
// Delegate to domains
- uint32_t uiChild;
- uint32_t uiNbConfigurableDomains = getNbChildren();
+ size_t uiChild;
+ size_t uiNbConfigurableDomains = getNbChildren();
for (uiChild = 0; uiChild < uiNbConfigurableDomains; uiChild++) {
@@ -75,8 +75,8 @@
/// Delegate to domains
// Start with domains that can be synchronized all at once (with passed syncer set)
- uint32_t uiChild;
- uint32_t uiNbConfigurableDomains = getNbChildren();
+ size_t uiChild;
+ size_t uiNbConfigurableDomains = getNbChildren();
for (uiChild = 0; uiChild < uiNbConfigurableDomains; uiChild++) {
@@ -145,7 +145,7 @@
deleteDomain(*pExistingDomain);
}
- log_info("Adding configurable domain \"" + strDomainName + "\"");
+ log_info("Adding configurable domain \"%s\"", strDomainName.c_str());
addChild(&domain);
@@ -154,7 +154,7 @@
void CConfigurableDomains::deleteDomain(CConfigurableDomain& configurableDomain)
{
- log_info("Deleting configurable domain \"" + configurableDomain.getName() + "\"");
+ log_info("Deleting configurable domain \"%s\"", configurableDomain.getName().c_str() );
removeChild(&configurableDomain);
@@ -364,8 +364,8 @@
strResult = "\n";
// List domains
- uint32_t uiChild;
- uint32_t uiNbConfigurableDomains = getNbChildren();
+ size_t uiChild;
+ size_t uiNbConfigurableDomains = getNbChildren();
for (uiChild = 0; uiChild < uiNbConfigurableDomains; uiChild++) {
@@ -387,8 +387,8 @@
void CConfigurableDomains::gatherAllOwnedConfigurableElements(std::set<const CConfigurableElement*>& configurableElementSet) const
{
// Delegate to domains
- uint32_t uiChild;
- uint32_t uiNbConfigurableDomains = getNbChildren();
+ size_t uiChild;
+ size_t uiNbConfigurableDomains = getNbChildren();
for (uiChild = 0; uiChild < uiNbConfigurableDomains; uiChild++) {
@@ -498,8 +498,8 @@
void CConfigurableDomains::listLastAppliedConfigurations(string& strResult) const
{
// Browse domains
- uint32_t uiChild;
- uint32_t uiNbConfigurableDomains = getNbChildren();
+ size_t uiChild;
+ size_t uiNbConfigurableDomains = getNbChildren();
for (uiChild = 0; uiChild < uiNbConfigurableDomains; uiChild++) {
diff --git a/parameter/ConfigurableElement.cpp b/parameter/ConfigurableElement.cpp
index eb66dd8..08a0122 100644
--- a/parameter/ConfigurableElement.cpp
+++ b/parameter/ConfigurableElement.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -34,6 +34,7 @@
#include "ConfigurationAccessContext.h"
#include "ConfigurableElementAggregator.h"
#include "AreaConfiguration.h"
+#include "Utility.h"
#include <assert.h>
#define base CElement
@@ -49,8 +50,8 @@
// XML configuration settings parsing
bool CConfigurableElement::serializeXmlSettings(CXmlElement& xmlConfigurationSettingsElementContent, CConfigurationAccessContext& configurationAccessContext) const
{
- uint32_t uiIndex;
- uint32_t uiNbChildren = getNbChildren();
+ size_t uiIndex;
+ size_t uiNbChildren = getNbChildren();
if (!configurationAccessContext.serializeOut()) {
// Just do basic checks and propagate to children
@@ -174,8 +175,8 @@
void CConfigurableElement::setDefaultValues(CParameterAccessContext& parameterAccessContext) const
{
// Propagate to children
- uint32_t uiIndex;
- uint32_t uiNbChildren = getNbChildren();
+ size_t uiIndex;
+ size_t uiNbChildren = getNbChildren();
for (uiIndex = 0; uiIndex < uiNbChildren; uiIndex++) {
@@ -200,8 +201,8 @@
_uiOffset = uiOffset;
// Propagate to children
- uint32_t uiIndex;
- uint32_t uiNbChildren = getNbChildren();
+ size_t uiIndex;
+ size_t uiNbChildren = getNbChildren();
for (uiIndex = 0; uiIndex < uiNbChildren; uiIndex++) {
@@ -222,8 +223,8 @@
uint32_t CConfigurableElement::getFootPrint() const
{
uint32_t uiSize = 0;
- uint32_t uiIndex;
- uint32_t uiNbChildren = getNbChildren();
+ size_t uiIndex;
+ size_t uiNbChildren = getNbChildren();
for (uiIndex = 0; uiIndex < uiNbChildren; uiIndex++) {
@@ -270,8 +271,8 @@
void CConfigurableElement::fillSyncerSetFromDescendant(CSyncerSet& syncerSet) const
{
// Dig
- uint32_t uiIndex;
- uint32_t uiNbChildren = getNbChildren();
+ size_t uiIndex;
+ size_t uiNbChildren = getNbChildren();
for (uiIndex = 0; uiIndex < uiNbChildren; uiIndex++) {
@@ -360,7 +361,7 @@
std::string CConfigurableElement::getFootprintAsString() const
{
// Get size as string
- return toString(getFootPrint()) + " byte(s)";
+ return CUtility::toString(getFootPrint()) + " byte(s)";
}
// Matching check for no domain association
@@ -401,7 +402,7 @@
listDomains(_configurableDomainList, strResult, bVertical);
}
-uint32_t CConfigurableElement::getBelongingDomainCount() const
+size_t CConfigurableElement::getBelongingDomainCount() const
{
// Get belonging domain list
std::list<const CConfigurableDomain*> configurableDomainList;
diff --git a/parameter/ConfigurableElement.h b/parameter/ConfigurableElement.h
index cce2227..18256cf 100644
--- a/parameter/ConfigurableElement.h
+++ b/parameter/ConfigurableElement.h
@@ -74,7 +74,7 @@
// Owning domains
void listAssociatedDomains(std::string& strResult, bool bVertical = true) const;
- uint32_t getBelongingDomainCount() const;
+ size_t getBelongingDomainCount() const;
// Elements with no domains
void listRogueElements(std::string& strResult) const;
diff --git a/parameter/ConfigurableElementAggregator.cpp b/parameter/ConfigurableElementAggregator.cpp
index 228db26..75bce4b 100644
--- a/parameter/ConfigurableElementAggregator.cpp
+++ b/parameter/ConfigurableElementAggregator.cpp
@@ -52,9 +52,9 @@
// Check children
std::list<const CConfigurableElement*> childAggregateElementList;
- uint32_t uiIndex;
- uint32_t uiNbChildren = pConfigurableElement->getNbChildren();
- uint32_t uiNbMatchingChildren = 0;
+ size_t uiIndex;
+ size_t uiNbChildren = pConfigurableElement->getNbChildren();
+ size_t uiNbMatchingChildren = 0;
for (uiIndex = 0; uiIndex < uiNbChildren; uiIndex++) {
diff --git a/parameter/ConfigurableElementAggregator.h b/parameter/ConfigurableElementAggregator.h
index 2164688..4c1119b 100644
--- a/parameter/ConfigurableElementAggregator.h
+++ b/parameter/ConfigurableElementAggregator.h
@@ -29,10 +29,10 @@
*/
#pragma once
+#include "ConfigurableElement.h"
#include <list>
#include <string>
-class CConfigurableElement;
class CConfigurableElementAggregator
{
diff --git a/parameter/DomainConfiguration.cpp b/parameter/DomainConfiguration.cpp
index 9c353ee..ebf3056 100644
--- a/parameter/DomainConfiguration.cpp
+++ b/parameter/DomainConfiguration.cpp
@@ -477,8 +477,8 @@
const CAreaConfiguration* pAreaConfigurationToSplitFrom = getAreaConfiguration(pFromConfigurableElement);
// Go through children areas to copy configuration data to them
- uint32_t uiNbConfigurableElementChildren = pFromConfigurableElement->getNbChildren();
- uint32_t uiChild;
+ size_t uiNbConfigurableElementChildren = pFromConfigurableElement->getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbConfigurableElementChildren; uiChild++) {
@@ -675,9 +675,9 @@
}
// Data size
-uint32_t CDomainConfiguration::getDataSize() const
+size_t CDomainConfiguration::getDataSize() const
{
- uint32_t uiDataSize;
+ size_t uiDataSize;
// Add necessary size to store area configurations order
uiDataSize = _areaConfigurationList.size() * sizeof(uint32_t);
diff --git a/parameter/DomainConfiguration.h b/parameter/DomainConfiguration.h
index bea8bb6..e8b41ef 100644
--- a/parameter/DomainConfiguration.h
+++ b/parameter/DomainConfiguration.h
@@ -96,7 +96,7 @@
virtual void binarySerialize(CBinaryStream& binaryStream);
// Data size
- virtual uint32_t getDataSize() const;
+ virtual size_t getDataSize() const;
// Class kind
virtual std::string getKind() const;
diff --git a/parameter/Element.cpp b/parameter/Element.cpp
old mode 100755
new mode 100644
index 4ccf149..afd1f33
--- a/parameter/Element.cpp
+++ b/parameter/Element.cpp
@@ -35,10 +35,11 @@
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
-#include <sstream>
using std::string;
+const std::string CElement::gDescriptionPropertyName = "Description";
+
CElement::CElement(const string& strName) : _strName(strName), _pParent(NULL)
{
}
@@ -49,14 +50,14 @@
}
// Logging
-void CElement::log_info(const string& strMessage, ...) const
+void CElement::log_info(const char* strMessage, ...) const
{
char *pacBuffer;
va_list listPointer;
va_start(listPointer, strMessage);
- vasprintf(&pacBuffer, strMessage.c_str(), listPointer);
+ vasprintf(&pacBuffer, strMessage, listPointer);
va_end(listPointer);
@@ -67,14 +68,14 @@
free(pacBuffer);
}
-void CElement::log_warning(const string& strMessage, ...) const
+void CElement::log_warning(const char* strMessage, ...) const
{
char *pacBuffer;
va_list listPointer;
va_start(listPointer, strMessage);
- vasprintf(&pacBuffer, strMessage.c_str(), listPointer);
+ vasprintf(&pacBuffer, strMessage, listPointer);
va_end(listPointer);
@@ -200,43 +201,14 @@
{
strResult = "\n";
strResult += "Kind: " + getKind() + "\n";
+ showDescriptionProperty(strResult);
}
-// Conversion utilities
-string CElement::toString(uint32_t uiValue)
+void CElement::showDescriptionProperty(std::string &strResult) const
{
- std::ostringstream ostr;
-
- ostr << uiValue;
-
- return ostr.str();
-}
-
-string CElement::toString(uint64_t uiValue)
-{
- std::ostringstream ostr;
-
- ostr << uiValue;
-
- return ostr.str();
-}
-
-string CElement::toString(int32_t iValue)
-{
- std::ostringstream ostr;
-
- ostr << iValue;
-
- return ostr.str();
-}
-
-string CElement::toString(double dValue)
-{
- std::ostringstream ostr;
-
- ostr << dValue;
-
- return ostr.str();
+ if (!getDescription().empty()) {
+ strResult += gDescriptionPropertyName + ": " + getDescription() + "\n";
+ }
}
// Content dumping
@@ -249,6 +221,8 @@
// From IXmlSink
bool CElement::fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext)
{
+ setDescription(getXmlDescriptionAttribute(xmlElement));
+
// Propagate through children
CXmlElement::CChildIterator childIterator(xmlElement);
@@ -296,8 +270,8 @@
CXmlSerializingContext& serializingContext) const
{
// Browse children and propagate
- uint32_t uiNbChildren = getNbChildren();
- uint32_t uiChild;
+ size_t uiNbChildren = getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
@@ -316,9 +290,23 @@
void CElement::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
setXmlNameAttribute(xmlElement);
+ setXmlDescriptionAttribute(xmlElement);
childrenToXml(xmlElement, serializingContext);
}
+void CElement::setXmlDescriptionAttribute(CXmlElement& xmlElement) const
+{
+ const string &description = getDescription();
+ if (!description.empty()) {
+ xmlElement.setAttributeString(gDescriptionPropertyName, description);
+ }
+}
+
+string CElement::getXmlDescriptionAttribute(const CXmlElement& xmlElement) const
+{
+ return xmlElement.getAttributeString(gDescriptionPropertyName);
+}
+
void CElement::setXmlNameAttribute(CXmlElement& xmlElement) const
{
// By default, set Name attribute if any
@@ -346,8 +334,8 @@
// Check for conflict with brotherhood if relevant
if (_pParent && _pParent->childrenAreDynamic()) {
- uint32_t uiParentChild;
- uint32_t uiParentNbChildren = _pParent->getNbChildren();
+ size_t uiParentChild;
+ size_t uiParentNbChildren = _pParent->getNbChildren();
for (uiParentChild = 0; uiParentChild < uiParentNbChildren; uiParentChild++) {
@@ -387,29 +375,20 @@
pChild->_pParent = this;
}
-CElement* CElement::getChild(uint32_t uiIndex)
+CElement* CElement::getChild(size_t uiIndex)
{
assert(uiIndex <= _childArray.size());
return _childArray[uiIndex];
}
-const CElement* CElement::getChild(uint32_t uiIndex) const
+const CElement* CElement::getChild(size_t uiIndex) const
{
assert(uiIndex <= _childArray.size());
return _childArray[uiIndex];
}
-CElement* CElement::getLastChild()
-{
- uint32_t uiNbChildren = getNbChildren();
-
- assert(uiNbChildren);
-
- return _childArray[uiNbChildren - 1];
-}
-
CElement* CElement::createChild(const CXmlElement& childElement,
CXmlSerializingContext& serializingContext)
{
@@ -456,8 +435,8 @@
strChildList = "\n";
// Get list of children names
- uint32_t uiNbChildren = getNbChildren();
- uint32_t uiChild;
+ size_t uiNbChildren = getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
@@ -469,7 +448,7 @@
string CElement::listQualifiedPaths(bool bDive, uint32_t uiLevel) const
{
- uint32_t uiNbChildren = getNbChildren();
+ size_t uiNbChildren = getNbChildren();
string strResult;
// Dive Will cause only leaf nodes to be printed
@@ -480,7 +459,7 @@
if (bDive || !uiLevel) {
// Get list of children paths
- uint32_t uiChild;
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
@@ -495,8 +474,8 @@
void CElement::listChildrenPaths(string& strChildList) const
{
// Get list of children paths
- uint32_t uiNbChildren = getNbChildren();
- uint32_t uiChild;
+ size_t uiNbChildren = getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
@@ -506,7 +485,7 @@
}
}
-uint32_t CElement::getNbChildren() const
+size_t CElement::getNbChildren() const
{
return _childArray.size();
}
@@ -600,20 +579,6 @@
return _pParent->isDescendantOf(pCandidateAscendant);
}
-CElement* CElement::findAscendantOfKind(const string& strKind)
-{
- if (!_pParent) {
-
- return NULL;
- }
-
- if (_pParent->getKind() == strKind) {
-
- return _pParent;
- }
- return _pParent->findAscendantOfKind(strKind);
-}
-
CElement* CElement::findChild(const string& strName)
{
uint32_t uiIndex;
@@ -682,24 +647,6 @@
return NULL;
}
-CElement* CElement::getRoot()
-{
- if (!_pParent) {
-
- return this;
- }
- return _pParent->getRoot();
-}
-
-const CElement* CElement::getRoot() const
-{
- if (!_pParent) {
-
- return this;
- }
- return _pParent->getRoot();
-}
-
string CElement::getPath() const
{
// Take out root element from the path
@@ -753,17 +700,3 @@
return uiChecksum;
}
-
-// Utility to underline
-void CElement::appendTitle(string& strTo, const string& strTitle)
-{
- strTo += "\n" + strTitle + "\n";
-
- uint32_t uiLength = strTitle.size();
-
- while (uiLength--) {
-
- strTo += "=";
- }
- strTo += "\n";
-}
diff --git a/parameter/Element.h b/parameter/Element.h
index 4636dbd..d3844e6 100644
--- a/parameter/Element.h
+++ b/parameter/Element.h
@@ -49,8 +49,8 @@
virtual ~CElement();
// Logging
- void log_info(const std::string& strMessage, ...) const;
- void log_warning(const std::string& strMessage, ...) const;
+ void log_info(const char* strMessage, ...) const;
+ void log_warning(const char* strMessage, ...) const;
void log_table(bool bIsWarning, const std::list<std::string> lstrMessage) const;
// Description
@@ -76,12 +76,31 @@
void listChildrenPaths(std::string& strChildPathList) const;
// Hierarchy query
- uint32_t getNbChildren() const;
+ size_t getNbChildren() const;
CElement* findChildOfKind(const std::string& strKind);
const CElement* findChildOfKind(const std::string& strKind) const;
const CElement* getParent() const;
- const CElement* getChild(uint32_t uiIndex) const;
- CElement* getChild(uint32_t uiIndex);
+
+ /**
+ * Get a child element (const)
+ *
+ * Note: this method will assert if given a wrong child index (>= number of children)
+ *
+ * @param[in] uiIndex the index of the child element from 0 to number of children - 1
+ * @return the child element
+ */
+ const CElement* getChild(size_t uiIndex) const;
+
+ /**
+ * Get a child element
+ *
+ * Note: this method will assert if given a wrong child index (>= number of children)
+ *
+ * @param[in] uiIndex the index of the child element from 0 to number of children - 1
+ * @return the child element
+ */
+ CElement* getChild(size_t uiIndex);
+
const CElement* findChild(const std::string& strName) const;
CElement* findChild(const std::string& strName);
const CElement* findDescendant(CPathNavigator& pathNavigator) const;
@@ -114,29 +133,41 @@
// Element properties
virtual void showProperties(std::string& strResult) const;
- // Conversion utilities
- static std::string toString(uint32_t uiValue);
- static std::string toString(uint64_t uiValue);
- static std::string toString(int32_t iValue);
- static std::string toString(double dValue);
-
// Checksum for integrity checks
uint8_t computeStructureChecksum() const;
// Class kind
virtual std::string getKind() const = 0;
+
+ /**
+ * Fill the Description field of the Xml Element during XML composing.
+ *
+ * @param[in,out] xmlElement to fill with the description
+ */
+ void setXmlDescriptionAttribute(CXmlElement& xmlElement) const;
+
+ /**
+ * Extract the Description field from the Xml Element during XML decomposing.
+ *
+ * @param[in] xmlElement to extract the description from.
+ *
+ * @return description represented as a string, empty if not found
+ */
+ std::string getXmlDescriptionAttribute(const CXmlElement &xmlElement) const;
+
+ /**
+ * Appends if found human readable description property.
+ *
+ * @param[out] strResult in which the description is wished to be appended.
+ */
+ void showDescriptionProperty(std::string &strResult) const;
+
protected:
// Content dumping
virtual void logValue(std::string& strValue, CErrorContext& errorContext) const;
- // Utility to underline
- static void appendTitle(std::string& strTo, const std::string& strTitle);
// Hierarchy
- CElement* getLastChild();
CElement* getParent();
- CElement* findAscendantOfKind(const std::string& strKind);
- CElement* getRoot();
- const CElement* getRoot() const;
/**
* Creates a child CElement from a child XML Element
@@ -178,4 +209,6 @@
std::vector<CElement*> _childArray;
// Parent
CElement* _pParent;
+
+ static const std::string gDescriptionPropertyName;
};
diff --git a/parameter/ElementBuilder.h b/parameter/ElementBuilder.h
index 5234130..819387f 100644
--- a/parameter/ElementBuilder.h
+++ b/parameter/ElementBuilder.h
@@ -34,7 +34,7 @@
class CElementBuilder
{
public:
- virtual ~CElementBuilder() {};
+ virtual ~CElementBuilder() {}
virtual CElement* createElement(const CXmlElement& xmlElement) const = 0;
};
diff --git a/parameter/EnumParameterType.cpp b/parameter/EnumParameterType.cpp
index 126a2a5..147ee95 100644
--- a/parameter/EnumParameterType.cpp
+++ b/parameter/EnumParameterType.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -35,6 +35,7 @@
#include <assert.h>
#include "ParameterAccessContext.h"
#include "EnumValuePair.h"
+#include "Utility.h"
#include <errno.h>
#define base CParameterType
@@ -63,8 +64,8 @@
strResult += "Value Pairs:\n";
// Show all value pairs
- uint32_t uiChild;
- uint32_t uiNbChildren = getNbChildren();
+ size_t uiChild;
+ size_t uiNbChildren = getNbChildren();
for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
@@ -281,8 +282,8 @@
// Literal - numerical conversions
bool CEnumParameterType::getLiteral(int32_t iNumerical, string& strLiteral) const
{
- uint32_t uiChild;
- uint32_t uiNbChildren = getNbChildren();
+ size_t uiChild;
+ size_t uiNbChildren = getNbChildren();
for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
@@ -301,8 +302,8 @@
bool CEnumParameterType::getNumerical(const string& strLiteral, int& iNumerical) const
{
- uint32_t uiChild;
- uint32_t uiNbChildren = getNbChildren();
+ size_t uiChild;
+ size_t uiNbChildren = getNbChildren();
for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
@@ -323,8 +324,8 @@
bool CEnumParameterType::isValid(int iNumerical, CParameterAccessContext& parameterAccessContext) const
{
// Check that the value is part of the allowed values for this kind of enum
- uint32_t uiChild;
- uint32_t uiNbChildren = getNbChildren();
+ size_t uiChild;
+ size_t uiNbChildren = getNbChildren();
for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
@@ -344,7 +345,7 @@
void CEnumParameterType::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
// Size
- xmlElement.setAttributeString("Size", toString(getSize() * 8));
+ xmlElement.setAttributeString("Size", CUtility::toString(getSize() * 8));
base::toXml(xmlElement, serializingContext);
}
diff --git a/parameter/EnumValuePair.cpp b/parameter/EnumValuePair.cpp
index 81febdd..35f4cd2 100644
--- a/parameter/EnumValuePair.cpp
+++ b/parameter/EnumValuePair.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -28,6 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "EnumValuePair.h"
+#include "Utility.h"
#define base CElement
@@ -51,7 +52,7 @@
string CEnumValuePair::getNumericalAsString() const
{
- return toString(_iNumerical);
+ return CUtility::toString(_iNumerical);
}
// From IXmlSink
diff --git a/parameter/FixedPointParameterType.cpp b/parameter/FixedPointParameterType.cpp
index e7779a9..5189a07 100644
--- a/parameter/FixedPointParameterType.cpp
+++ b/parameter/FixedPointParameterType.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -36,6 +36,7 @@
#include "Parameter.h"
#include "ParameterAccessContext.h"
#include "ConfigurationAccessContext.h"
+#include "Utility.h"
#include <errno.h>
#include <convert.hpp>
@@ -59,9 +60,9 @@
// Notation
strResult += "Notation: Q";
- strResult += toString(_uiIntegral);
+ strResult += CUtility::toString(_uiIntegral);
strResult += ".";
- strResult += toString(_uiFractional);
+ strResult += CUtility::toString(_uiFractional);
strResult += "\n";
}
@@ -363,13 +364,13 @@
void CFixedPointParameterType::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
// Size
- xmlElement.setAttributeString("Size", toString(getSize() * 8));
+ xmlElement.setAttributeString("Size", CUtility::toString(getSize() * 8));
// Integral
- xmlElement.setAttributeString("Integral", toString(_uiIntegral));
+ xmlElement.setAttributeString("Integral", CUtility::toString(_uiIntegral));
// Fractional
- xmlElement.setAttributeString("Fractional", toString(_uiFractional));
+ xmlElement.setAttributeString("Fractional", CUtility::toString(_uiFractional));
base::toXml(xmlElement, serializingContext);
}
diff --git a/parameter/FormattedSubsystemObject.cpp b/parameter/FormattedSubsystemObject.cpp
index 2da7deb..591ef90 100644
--- a/parameter/FormattedSubsystemObject.cpp
+++ b/parameter/FormattedSubsystemObject.cpp
@@ -92,7 +92,7 @@
string strFormattedValue = strMappingValue;
// Search for amendment (only one supported for now)
- size_t uiPercentPos = strFormattedValue.find('%', 0);
+ string::size_type uiPercentPos = strFormattedValue.find('%', 0);
// Amendment limited to one digit (values from 1 to 9)
assert(isAmendKeyValid(uiNbAmendKeys));
diff --git a/parameter/InstanceConfigurableElement.cpp b/parameter/InstanceConfigurableElement.cpp
index bfa011c..b59cffd 100644
--- a/parameter/InstanceConfigurableElement.cpp
+++ b/parameter/InstanceConfigurableElement.cpp
@@ -82,8 +82,8 @@
if (bKeepDiving) {
// Map children
- uint32_t uiNbChildren = getNbChildren();
- uint32_t uiChild;
+ size_t uiNbChildren = getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
@@ -216,3 +216,10 @@
}
return true;
}
+
+void CInstanceConfigurableElement::toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const
+{
+ base::toXml(xmlElement, serializingContext);
+ // Since Description belongs to the Type of Element, delegate it to the type element.
+ getTypeElement()->setXmlDescriptionAttribute(xmlElement);
+}
diff --git a/parameter/InstanceConfigurableElement.h b/parameter/InstanceConfigurableElement.h
index b3cdf62..eea3df6 100644
--- a/parameter/InstanceConfigurableElement.h
+++ b/parameter/InstanceConfigurableElement.h
@@ -102,6 +102,9 @@
*/
virtual void getListOfElementsWithMapping(std::list<const CConfigurableElement*>&
configurableElementPath) const;
+
+ virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const;
+
protected:
// Syncer
virtual ISyncer* getSyncer() const;
diff --git a/parameter/IntegerParameterType.cpp b/parameter/IntegerParameterType.cpp
index edc3d46..2d48d53 100644
--- a/parameter/IntegerParameterType.cpp
+++ b/parameter/IntegerParameterType.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -34,6 +34,7 @@
#include "ParameterAccessContext.h"
#include <assert.h>
#include "ParameterAdaptation.h"
+#include "Utility.h"
#include <errno.h>
#define base CParameterType
@@ -69,12 +70,12 @@
// Min
strResult += "Min: ";
- strResult += _bSigned ? toString((int32_t)_uiMin) : toString(_uiMin);
+ strResult += _bSigned ? CUtility::toString((int32_t)_uiMin) : CUtility::toString(_uiMin);
strResult += "\n";
// Max
strResult += "Max: ";
- strResult += _bSigned ? toString((int32_t)_uiMax) : toString(_uiMax);
+ strResult += _bSigned ? CUtility::toString((int32_t)_uiMax) : CUtility::toString(_uiMax);
strResult += "\n";
// Check if there's an adaptation object available
@@ -439,22 +440,22 @@
if (_bSigned) {
// Mininmum
- xmlElement.setAttributeString("Min", toString((int32_t)_uiMin));
+ xmlElement.setAttributeString("Min", CUtility::toString((int32_t)_uiMin));
// Maximum
- xmlElement.setAttributeString("Max", toString((int32_t)_uiMax));
+ xmlElement.setAttributeString("Max", CUtility::toString((int32_t)_uiMax));
} else {
// Minimum
- xmlElement.setAttributeString("Min", toString(_uiMin));
+ xmlElement.setAttributeString("Min", CUtility::toString(_uiMin));
// Maximum
- xmlElement.setAttributeString("Max", toString(_uiMax));
+ xmlElement.setAttributeString("Max", CUtility::toString(_uiMax));
}
// Size
- xmlElement.setAttributeString("Size", toString(getSize() * 8));
+ xmlElement.setAttributeString("Size", CUtility::toString(getSize() * 8));
base::toXml(xmlElement, serializingContext);
diff --git a/parameter/LinearParameterAdaptation.cpp b/parameter/LinearParameterAdaptation.cpp
index ea833b3..ae925a7 100644
--- a/parameter/LinearParameterAdaptation.cpp
+++ b/parameter/LinearParameterAdaptation.cpp
@@ -28,6 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "LinearParameterAdaptation.h"
+#include "Utility.h"
#define base CParameterAdaptation
@@ -49,12 +50,12 @@
// SlopeNumerator
strResult += " - SlopeNumerator: ";
- strResult += toString(_dSlopeNumerator);
+ strResult += CUtility::toString(_dSlopeNumerator);
strResult += "\n";
// SlopeDenominator
strResult += " - SlopeDenominator: ";
- strResult += toString(_dSlopeDenominator);
+ strResult += CUtility::toString(_dSlopeDenominator);
strResult += "\n";
}
diff --git a/parameter/LogarithmicParameterAdaptation.cpp b/parameter/LogarithmicParameterAdaptation.cpp
index 688527d..bca4948 100644
--- a/parameter/LogarithmicParameterAdaptation.cpp
+++ b/parameter/LogarithmicParameterAdaptation.cpp
@@ -29,6 +29,7 @@
*/
#include "LogarithmicParameterAdaptation.h"
+#include "Utility.h"
#include <math.h>
#define base CLinearParameterAdaptation
@@ -45,10 +46,10 @@
base::showProperties(strResult);
strResult += " - LogarithmBase: ";
- strResult += toString(_dLogarithmBase);
+ strResult += CUtility::toString(_dLogarithmBase);
strResult += "\n";
strResult += " - FloorValue: ";
- strResult += toString(_dFloorValue);
+ strResult += CUtility::toString(_dFloorValue);
strResult += "\n";
}
diff --git a/parameter/MappingContext.cpp b/parameter/MappingContext.cpp
index b627051..045fbd7 100644
--- a/parameter/MappingContext.cpp
+++ b/parameter/MappingContext.cpp
@@ -34,7 +34,7 @@
using std::string;
-CMappingContext::CMappingContext(uint32_t uiNbItemTypes) : _pstItemArray(new CMappingContext::SItem[uiNbItemTypes]), _uiNbItemTypes(uiNbItemTypes)
+CMappingContext::CMappingContext(size_t uiNbItemTypes) : _pstItemArray(new CMappingContext::SItem[uiNbItemTypes]), _uiNbItemTypes(uiNbItemTypes)
{
// Clear items
memset(_pstItemArray, 0, sizeof(*_pstItemArray) * uiNbItemTypes);
@@ -76,7 +76,7 @@
// Item access
bool CMappingContext::setItem(uint32_t uiItemType, const string* pStrKey, const string* pStrItem)
{
- uint32_t uiIndex;
+ size_t uiIndex;
// Do some checks
for (uiIndex = 0; uiIndex < _uiNbItemTypes; uiIndex++) {
@@ -120,7 +120,7 @@
const string* CMappingContext::getItem(const string& strKey) const
{
- uint32_t uiItemType;
+ size_t uiItemType;
for (uiItemType = 0; uiItemType < _uiNbItemTypes; uiItemType++) {
diff --git a/parameter/MappingContext.h b/parameter/MappingContext.h
index 2ba8547..91fd1f4 100644
--- a/parameter/MappingContext.h
+++ b/parameter/MappingContext.h
@@ -43,7 +43,7 @@
public:
// Regular Constructor
- CMappingContext(uint32_t uiNbItemTypes);
+ CMappingContext(size_t uiNbItemTypes);
~CMappingContext();
// Copy constructor
@@ -79,6 +79,6 @@
// Item array
SItem* _pstItemArray;
// Items array size
- uint32_t _uiNbItemTypes;
+ size_t _uiNbItemTypes;
};
diff --git a/parameter/ParameterAdaptation.cpp b/parameter/ParameterAdaptation.cpp
index f1e73c1..99955f1 100644
--- a/parameter/ParameterAdaptation.cpp
+++ b/parameter/ParameterAdaptation.cpp
@@ -28,6 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "ParameterAdaptation.h"
+#include "Utility.h"
#define base CElement
@@ -58,7 +59,7 @@
// Offset
strResult += " - Offset: ";
- strResult += toString(_iOffset);
+ strResult += CUtility::toString(_iOffset);
strResult += "\n";
}
diff --git a/parameter/ParameterBlackboard.cpp b/parameter/ParameterBlackboard.cpp
index 3af9a1d..6001c77 100644
--- a/parameter/ParameterBlackboard.cpp
+++ b/parameter/ParameterBlackboard.cpp
@@ -99,14 +99,14 @@
}
}
-void CParameterBlackboard::writeString(const char* pcSrcData, uint32_t uiOffset)
+void CParameterBlackboard::writeString(const std::string &input, uint32_t uiOffset)
{
- strcpy((char*)_pucData + uiOffset, pcSrcData);
+ strcpy((char*)_pucData + uiOffset, input.c_str());
}
-void CParameterBlackboard::readString(char* pcDstData, uint32_t uiOffset) const
+void CParameterBlackboard::readString(std::string &output, uint32_t uiOffset) const
{
- strcpy(pcDstData, (const char*)_pucData + uiOffset);
+ output = std::string((const char*)_pucData + uiOffset);
}
// Access from/to subsystems
diff --git a/parameter/ParameterBlackboard.h b/parameter/ParameterBlackboard.h
index 111208a..bd48cc4 100644
--- a/parameter/ParameterBlackboard.h
+++ b/parameter/ParameterBlackboard.h
@@ -31,6 +31,7 @@
#include <stdint.h>
#include "BinaryStream.h"
+#include <string>
class CParameterBlackboard
{
@@ -45,8 +46,8 @@
// Single parameter access
void writeInteger(const void* pvSrcData, uint32_t uiSize, uint32_t uiOffset, bool bBigEndian);
void readInteger(void* pvDstData, uint32_t uiSize, uint32_t uiOffset, bool bBigEndian) const;
- void writeString(const char* pcSrcData, uint32_t uiOffset);
- void readString(char* pcDstData, uint32_t uiOffset) const;
+ void writeString(const std::string &input, uint32_t uiOffset);
+ void readString(std::string &output, uint32_t uiOffset) const;
// Access from/to subsystems
uint8_t* getLocation(uint32_t uiOffset);
diff --git a/parameter/ParameterBlockType.cpp b/parameter/ParameterBlockType.cpp
index 7c6bfd4..ad94888 100644
--- a/parameter/ParameterBlockType.cpp
+++ b/parameter/ParameterBlockType.cpp
@@ -29,6 +29,7 @@
*/
#include "ParameterBlockType.h"
#include "ParameterBlock.h"
+#include "Utility.h"
#define base CTypeElement
@@ -58,11 +59,12 @@
if (uiArrayLength) {
// Create child elements
- uint32_t uiChild;
+ size_t uiChild;
for (uiChild = 0; uiChild < uiArrayLength; uiChild++) {
- CParameterBlock* pChildParameterBlock = new CParameterBlock(toString(uiChild), this);
+ CParameterBlock* pChildParameterBlock = new CParameterBlock(CUtility::toString(uiChild),
+ this);
pElement->addChild(pChildParameterBlock);
diff --git a/parameter/ParameterBlockType.h b/parameter/ParameterBlockType.h
index 6061f78..2137a3e 100644
--- a/parameter/ParameterBlockType.h
+++ b/parameter/ParameterBlockType.h
@@ -47,6 +47,6 @@
// Population
virtual void populate(CElement* pElement) const;
// Creating sub blocks with indexes
- static std::string computeChildName(uint32_t uiChild);
+ static std::string computeChildName(size_t uiChild);
};
diff --git a/parameter/ParameterHandle.cpp b/parameter/ParameterHandle.cpp
index b513972..3bb6120 100644
--- a/parameter/ParameterHandle.cpp
+++ b/parameter/ParameterHandle.cpp
@@ -436,7 +436,7 @@
bool CParameterHandle::setAsStringArray(const std::vector<string>& astrValues, string& strError)
{
// Check operation validity
- if (!checkAccessValidity(true, astrValues.size(), strError)) {
+ if (!checkAccessValidity(true, (uint32_t)astrValues.size(), strError)) {
return false;
}
@@ -475,7 +475,7 @@
}
// Access validity
-bool CParameterHandle::checkAccessValidity(bool bSet, uint32_t uiArrayLength, string& strError) const
+bool CParameterHandle::checkAccessValidity(bool bSet, size_t uiArrayLength, string& strError) const
{
if (bSet && !isRogue()) {
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp
index fb09a7f..b42c7de 100644
--- a/parameter/ParameterMgr.cpp
+++ b/parameter/ParameterMgr.cpp
@@ -82,25 +82,35 @@
#include "LogarithmicParameterAdaptation.h"
#include "EnumValuePair.h"
#include "Subsystem.h"
-#include "XmlFileDocSink.h"
-#include "XmlFileDocSource.h"
-#include "XmlStringDocSink.h"
-#include "XmlStringDocSource.h"
+#include "XmlStreamDocSink.h"
#include "XmlMemoryDocSink.h"
+#include "XmlDocSource.h"
#include "XmlMemoryDocSource.h"
#include "SelectionCriteriaDefinition.h"
#include "Utility.h"
#include <sstream>
+#include <fstream>
#include <algorithm>
#include <ctype.h>
#include <memory>
#define base CElement
+#ifdef SIMULATION
+ // In simulation, back synchronization of the blackboard won't probably work
+ // We need to ensure though the blackboard is initialized with valid data
+ typedef CSimulatedBackSynchronizer BackSynchronizer;
+#else
+ // Real back synchronizer from subsystems
+ typedef CHardwareBackSynchronizer BackSynchronizer;
+#endif
+
using std::string;
using std::list;
using std::vector;
using std::ostringstream;
+using std::ofstream;
+using std::ifstream;
// Used for remote processor server creation
typedef IRemoteProcessorServerInterface* (*CreateRemoteProcessorServer)(uint16_t uiPort, IRemoteCommandHandler* pCommandHandler);
@@ -137,157 +147,173 @@
"Show current status" },
/// Tuning Mode
- { "setTuningMode", &CParameterMgr::setTuningModeCommmandProcess, 1,
+ { "setTuningMode", &CParameterMgr::setTuningModeCommandProcess, 1,
"on|off*", "Turn on or off Tuning Mode" },
- { "getTuningMode", &CParameterMgr::getTuningModeCommmandProcess, 0,
+ { "getTuningMode", &CParameterMgr::getTuningModeCommandProcess, 0,
"", "Show Tuning Mode" },
/// Value Space
- { "setValueSpace", &CParameterMgr::setValueSpaceCommmandProcess, 1,
+ { "setValueSpace", &CParameterMgr::setValueSpaceCommandProcess, 1,
"raw|real*", "Assigns Value Space used for parameter value interpretation" },
- { "getValueSpace", &CParameterMgr::getValueSpaceCommmandProcess, 0,
+ { "getValueSpace", &CParameterMgr::getValueSpaceCommandProcess, 0,
"", "Show Value Space" },
/// Output Raw Format
- { "setOutputRawFormat", &CParameterMgr::setOutputRawFormatCommmandProcess, 1,
+ { "setOutputRawFormat", &CParameterMgr::setOutputRawFormatCommandProcess, 1,
"dec*|hex", "Assigns format used to output parameter values when in raw Value Space" },
- { "getOutputRawFormat", &CParameterMgr::getOutputRawFormatCommmandProcess, 0,
+ { "getOutputRawFormat", &CParameterMgr::getOutputRawFormatCommandProcess, 0,
"", "Show Output Raw Format" },
/// Sync
- { "setAutoSync", &CParameterMgr::setAutoSyncCommmandProcess, 1,
+ { "setAutoSync", &CParameterMgr::setAutoSyncCommandProcess, 1,
"on*|off", "Turn on or off automatic synchronization to hardware while in Tuning Mode" },
- { "getAutoSync", &CParameterMgr::getAutoSyncCommmandProcess, 0,
+ { "getAutoSync", &CParameterMgr::getAutoSyncCommandProcess, 0,
"", "Show Auto Sync state" },
- { "sync", &CParameterMgr::syncCommmandProcess, 0,
+ { "sync", &CParameterMgr::syncCommandProcess, 0,
"", "Synchronize current settings to hardware while in Tuning Mode and Auto Sync off" },
/// Criteria
- { "listCriteria", &CParameterMgr::listCriteriaCommmandProcess, 0,
+ { "listCriteria", &CParameterMgr::listCriteriaCommandProcess, 0,
"[CSV|XML]", "List selection criteria" },
/// Domains
- { "listDomains", &CParameterMgr::listDomainsCommmandProcess, 0,
+ { "listDomains", &CParameterMgr::listDomainsCommandProcess, 0,
"", "List configurable domains" },
- { "dumpDomains", &CParameterMgr::dumpDomainsCommmandProcess, 0,
+ { "dumpDomains", &CParameterMgr::dumpDomainsCommandProcess, 0,
"", "Show all domains and configurations, including applicability conditions" },
- { "createDomain", &CParameterMgr::createDomainCommmandProcess, 1,
+ { "createDomain", &CParameterMgr::createDomainCommandProcess, 1,
"<domain>", "Create new configurable domain" },
- { "deleteDomain", &CParameterMgr::deleteDomainCommmandProcess, 1,
+ { "deleteDomain", &CParameterMgr::deleteDomainCommandProcess, 1,
"<domain>", "Delete configurable domain" },
- { "deleteAllDomains", &CParameterMgr::deleteAllDomainsCommmandProcess, 0,
+ { "deleteAllDomains", &CParameterMgr::deleteAllDomainsCommandProcess, 0,
"", "Delete all configurable domains" },
- { "renameDomain", &CParameterMgr::renameDomainCommmandProcess, 2,
+ { "renameDomain", &CParameterMgr::renameDomainCommandProcess, 2,
"<domain> <new name>", "Rename configurable domain" },
- { "setSequenceAwareness", &CParameterMgr::setSequenceAwarenessCommmandProcess, 1,
+ { "setSequenceAwareness", &CParameterMgr::setSequenceAwarenessCommandProcess, 1,
"<domain> true|false*", "Set configurable domain sequence awareness" },
- { "getSequenceAwareness", &CParameterMgr::getSequenceAwarenessCommmandProcess, 1,
+ { "getSequenceAwareness", &CParameterMgr::getSequenceAwarenessCommandProcess, 1,
"<domain>", "Get configurable domain sequence awareness" },
- { "listDomainElements", &CParameterMgr::listDomainElementsCommmandProcess, 1,
+ { "listDomainElements", &CParameterMgr::listDomainElementsCommandProcess, 1,
"<domain>", "List elements associated to configurable domain" },
- { "addElement", &CParameterMgr::addElementCommmandProcess, 2,
+ { "addElement", &CParameterMgr::addElementCommandProcess, 2,
"<domain> <elem path>", "Associate element at given path to configurable domain" },
- { "removeElement", &CParameterMgr::removeElementCommmandProcess, 2,
+ { "removeElement", &CParameterMgr::removeElementCommandProcess, 2,
"<domain> <elem path>", "Dissociate element at given path from configurable domain" },
- { "splitDomain", &CParameterMgr::splitDomainCommmandProcess, 2,
+ { "splitDomain", &CParameterMgr::splitDomainCommandProcess, 2,
"<domain> <elem path>", "Split configurable domain at given associated element path" },
/// Configurations
- { "listConfigurations", &CParameterMgr::listConfigurationsCommmandProcess, 1,
+ { "listConfigurations", &CParameterMgr::listConfigurationsCommandProcess, 1,
"<domain>", "List domain configurations" },
- { "createConfiguration", &CParameterMgr::createConfigurationCommmandProcess, 2,
+ { "createConfiguration", &CParameterMgr::createConfigurationCommandProcess, 2,
"<domain> <configuration>", "Create new domain configuration" },
- { "deleteConfiguration", &CParameterMgr::deleteConfigurationCommmandProcess, 2,
+ { "deleteConfiguration", &CParameterMgr::deleteConfigurationCommandProcess, 2,
"<domain> <configuration>", "Delete domain configuration" },
- { "renameConfiguration", &CParameterMgr::renameConfigurationCommmandProcess, 3,
+ { "renameConfiguration", &CParameterMgr::renameConfigurationCommandProcess, 3,
"<domain> <configuration> <new name>", "Rename domain configuration" },
- { "saveConfiguration", &CParameterMgr::saveConfigurationCommmandProcess, 2,
+ { "saveConfiguration", &CParameterMgr::saveConfigurationCommandProcess, 2,
"<domain> <configuration>", "Save current settings into configuration" },
- { "restoreConfiguration", &CParameterMgr::restoreConfigurationCommmandProcess, 2,
+ { "restoreConfiguration", &CParameterMgr::restoreConfigurationCommandProcess, 2,
"<domain> <configuration>", "Restore current settings from configuration" },
- { "setElementSequence", &CParameterMgr::setElementSequenceCommmandProcess, 3,
+ { "setElementSequence", &CParameterMgr::setElementSequenceCommandProcess, 3,
"<domain> <configuration> <elem path list>",
"Set element application order for configuration" },
- { "getElementSequence", &CParameterMgr::getElementSequenceCommmandProcess, 2,
+ { "getElementSequence", &CParameterMgr::getElementSequenceCommandProcess, 2,
"<domain> <configuration>", "Get element application order for configuration" },
- { "setRule", &CParameterMgr::setRuleCommmandProcess, 3,
+ { "setRule", &CParameterMgr::setRuleCommandProcess, 3,
"<domain> <configuration> <rule>", "Set configuration application rule" },
- { "clearRule", &CParameterMgr::clearRuleCommmandProcess, 2,
+ { "clearRule", &CParameterMgr::clearRuleCommandProcess, 2,
"<domain> <configuration>", "Clear configuration application rule" },
- { "getRule", &CParameterMgr::getRuleCommmandProcess, 2,
+ { "getRule", &CParameterMgr::getRuleCommandProcess, 2,
"<domain> <configuration>", "Get configuration application rule" },
/// Elements/Parameters
- { "listElements", &CParameterMgr::listElementsCommmandProcess, 1,
+ { "listElements", &CParameterMgr::listElementsCommandProcess, 1,
"<elem path>|/", "List elements under element at given path or root" },
- { "listParameters", &CParameterMgr::listParametersCommmandProcess, 1,
+ { "listParameters", &CParameterMgr::listParametersCommandProcess, 1,
"<elem path>|/", "List parameters under element at given path or root" },
- { "dumpElement", &CParameterMgr::dumpElementCommmandProcess, 1,
+ { "dumpElement", &CParameterMgr::dumpElementCommandProcess, 1,
"<elem path>", "Dump structure and content of element at given path" },
- { "getElementSize", &CParameterMgr::getElementSizeCommmandProcess, 1,
+ { "getElementSize", &CParameterMgr::getElementSizeCommandProcess, 1,
"<elem path>", "Show size of element at given path" },
- { "showProperties", &CParameterMgr::showPropertiesCommmandProcess, 1,
+ { "showProperties", &CParameterMgr::showPropertiesCommandProcess, 1,
"<elem path>", "Show properties of element at given path" },
- { "getParameter", &CParameterMgr::getParameterCommmandProcess, 1,
+ { "getParameter", &CParameterMgr::getParameterCommandProcess, 1,
"<param path>", "Get value for parameter at given path" },
- { "setParameter", &CParameterMgr::setParameterCommmandProcess, 2,
+ { "setParameter", &CParameterMgr::setParameterCommandProcess, 2,
"<param path> <value>", "Set value for parameter at given path" },
- { "listBelongingDomains", &CParameterMgr::listBelongingDomainsCommmandProcess, 1,
+ { "listBelongingDomains", &CParameterMgr::listBelongingDomainsCommandProcess, 1,
"<elem path>", "List domain(s) element at given path belongs to" },
- { "listAssociatedDomains", &CParameterMgr::listAssociatedDomainsCommmandProcess, 1,
+ { "listAssociatedDomains", &CParameterMgr::listAssociatedDomainsCommandProcess, 1,
"<elem path>", "List domain(s) element at given path is associated to" },
- { "getConfigurationParameter", &CParameterMgr::getConfigurationParameterCommmandProcess, 3,
+ { "getConfigurationParameter", &CParameterMgr::getConfigurationParameterCommandProcess, 3,
"<domain> <configuration> <param path>",
"Get value for parameter at given path from configuration" },
- { "setConfigurationParameter", &CParameterMgr::setConfigurationParameterCommmandProcess, 4,
+ { "setConfigurationParameter", &CParameterMgr::setConfigurationParameterCommandProcess, 4,
"<domain> <configuration> <param path> <value>",
"Set value for parameter at given path to configuration" },
- { "showMapping", &CParameterMgr::showMappingCommmandProcess, 1,
+ { "showMapping", &CParameterMgr::showMappingCommandProcess, 1,
"<elem path>", "Show mapping for an element at given path" },
/// Browse
- { "listAssociatedElements", &CParameterMgr::listAssociatedElementsCommmandProcess, 0,
+ { "listAssociatedElements", &CParameterMgr::listAssociatedElementsCommandProcess, 0,
"", "List element sub-trees associated to at least one configurable domain" },
- { "listConflictingElements", &CParameterMgr::listConflictingElementsCommmandProcess, 0,
+ { "listConflictingElements", &CParameterMgr::listConflictingElementsCommandProcess, 0,
"", "List element sub-trees contained in more than one configurable domain" },
- { "listRogueElements", &CParameterMgr::listRogueElementsCommmandProcess, 0,
+ { "listRogueElements", &CParameterMgr::listRogueElementsCommandProcess, 0,
"", "List element sub-trees owned by no configurable domain" },
/// Settings Import/Export
- { "exportDomainsXML", &CParameterMgr::exportConfigurableDomainsToXMLCommmandProcess, 1,
- "<file path> ", "Export domains to XML file" },
- { "importDomainsXML", &CParameterMgr::importConfigurableDomainsFromXMLCommmandProcess, 1,
- "<file path>", "Import domains from XML file" },
+ { "exportDomainsXML", &CParameterMgr::exportDomainsXMLCommandProcess, 1,
+ "<file path> ", "Export domains to an XML file (provide an absolute path or relative"
+ "to the client's working directory)" },
+ { "importDomainsXML", &CParameterMgr::importDomainsXMLCommandProcess, 1,
+ "<file path>", "Import domains from an XML file (provide an absolute path or relative"
+ "to the client's working directory)" },
{ "exportDomainsWithSettingsXML",
- &CParameterMgr::exportConfigurableDomainsWithSettingsToXMLCommmandProcess, 1,
- "<file path> ", "Export domains including settings to XML file" },
+ &CParameterMgr::exportDomainsWithSettingsXMLCommandProcess, 1,
+ "<file path> ", "Export domains including settings to XML file (provide an absolute path or relative"
+ "to the client's working directory)" },
+ { "exportDomainWithSettingsXML",
+ &CParameterMgr::exportDomainWithSettingsXMLCommandProcess, 2,
+ "<domain> <file path> ", "Export a single given domain including settings to XML file"
+ " (provide an absolute path or relative to the client's"
+ " working directory)" },
{ "importDomainsWithSettingsXML",
- &CParameterMgr::importConfigurableDomainsWithSettingsFromXMLCommmandProcess, 1,
- "<file path>", "Import domains including settings from XML file" },
+ &CParameterMgr::importDomainsWithSettingsXMLCommandProcess, 1,
+ "<file path>", "Import domains including settings from XML file (provide an absolute path or relative"
+ "to the client's working directory)" },
{ "importDomainWithSettingsXML",
- &CParameterMgr::importConfigurableDomainWithSettingsFromXMLCommmandProcess, 1,
+ &CParameterMgr::importDomainWithSettingsXMLCommandProcess, 1,
"<file path> [overwrite]", "Import a single domain including settings from XML file."
" Does not overwrite an existing domain unless 'overwrite' is passed as second"
- " argument" },
- { "exportSettings", &CParameterMgr::exportSettingsCommmandProcess, 1,
- "<file path>", "Export settings to binary file" },
- { "importSettings", &CParameterMgr::importSettingsCommmandProcess, 1,
- "<file path>", "Import settings from binary file" },
+ " argument. Provide an absolute path or relative to the client's working directory)" },
+ { "exportSettings", &CParameterMgr::exportSettingsCommandProcess, 1,
+ "<file path>", "Export settings to binary file (provide an absolute path or relative"
+ "to the client's working directory)" },
+ { "importSettings", &CParameterMgr::importSettingsCommandProcess, 1,
+ "<file path>", "Import settings from binary file (provide an absolute path or relative"
+ "to the client's working directory)" },
{ "getDomainsWithSettingsXML",
- &CParameterMgr::getConfigurableDomainsWithSettingsXMLCommmandProcess, 0,
+ &CParameterMgr::getDomainsWithSettingsXMLCommandProcess, 0,
"", "Print domains including settings as XML" },
{ "getDomainWithSettingsXML",
- &CParameterMgr::getConfigurableDomainWithSettingsXMLCommmandProcess, 1,
+ &CParameterMgr::getDomainWithSettingsXMLCommandProcess, 1,
"<domain>", "Print the given domain including settings as XML" },
{ "setDomainsWithSettingsXML",
- &CParameterMgr::setConfigurableDomainsWithSettingsXMLCommmandProcess, 1,
+ &CParameterMgr::setDomainsWithSettingsXMLCommandProcess, 1,
"<xml configurable domains>", "Import domains including settings from XML string" },
+ { "setDomainWithSettingsXML",
+ &CParameterMgr::setDomainWithSettingsXMLCommandProcess, 1,
+ "<xml configurable domain> [overwrite]", "Import domains including settings from XML"
+ " string. Does not overwrite an existing domain unless 'overwrite' is passed as second"
+ " argument" },
/// Structure Export
- { "getSystemClassXML", &CParameterMgr::getSystemClassXMLCommmandProcess, 0 ,
+ { "getSystemClassXML", &CParameterMgr::getSystemClassXMLCommandProcess, 0 ,
"", "Print parameter structure as XML" },
/// Deprecated Commands
{ "getDomainsXML",
- &CParameterMgr::getConfigurableDomainsWithSettingsXMLCommmandProcess, 0,
+ &CParameterMgr::getDomainsWithSettingsXMLCommandProcess, 0,
"", "DEPRECATED COMMAND, please use getDomainsWithSettingsXML" },
};
@@ -343,11 +369,13 @@
}
// Configuration file folder
- uint32_t uiSlashPos = _strXmlConfigurationFilePath.rfind('/', -1);
-
- assert(uiSlashPos != (uint32_t)-1);
-
- _strXmlConfigurationFolderPath = _strXmlConfigurationFilePath.substr(0, uiSlashPos);
+ std::string::size_type slashPos = _strXmlConfigurationFilePath.rfind('/', -1);
+ if(slashPos == std::string::npos) {
+ // Configuration folder is the current folder
+ _strXmlConfigurationFolderPath = '.';
+ } else {
+ _strXmlConfigurationFolderPath = _strXmlConfigurationFilePath.substr(0, slashPos);
+ }
// Schema absolute folder location
_strSchemaFolderLocation = _strXmlConfigurationFolderPath + "/" + gacSystemSchemasSubFolder;
@@ -419,11 +447,11 @@
string strVersion;
// Major
- strVersion = toString(guiEditionMajor) + ".";
+ strVersion = CUtility::toString(guiEditionMajor) + ".";
// Minor
- strVersion += toString(guiEditionMinor) + ".";
+ strVersion += CUtility::toString(guiEditionMinor) + ".";
// Revision
- strVersion += toString(guiRevision);
+ strVersion += CUtility::toString(guiRevision);
return strVersion;
}
@@ -465,17 +493,12 @@
return false;
}
- // Back synchronization for areas in parameter blackboard not covered by any domain
- CBackSynchronizer* pBackSynchronizer = createBackSynchronizer();
- // Back-synchronize
{
CAutoLog autoLog(this, "Main blackboard back synchronization");
- pBackSynchronizer->sync();
-
- // Get rid of back synchronizer
- delete pBackSynchronizer;
+ // Back synchronization for areas in parameter blackboard not covered by any domain
+ BackSynchronizer(getConstSystemClass(), _pMainParameterBlackboard).sync();
}
// We're done loading the settings and back synchronizing
@@ -513,7 +536,13 @@
// Parse Structure XML file
CXmlElementSerializingContext elementSerializingContext(strError);
- if (!xmlParse(elementSerializingContext, getFrameworkConfiguration(), _strXmlConfigurationFilePath, _strXmlConfigurationFolderPath, EFrameworkConfigurationLibrary)) {
+ _xmlDoc *doc = CXmlDocSource::mkXmlDoc(_strXmlConfigurationFilePath, true, true, strError);
+ if (doc == NULL) {
+ return false;
+ }
+
+ if (!xmlParse(elementSerializingContext, getFrameworkConfiguration(), doc,
+ _strXmlConfigurationFolderPath, EFrameworkConfigurationLibrary)) {
return false;
}
@@ -542,7 +571,7 @@
// Retrieve system to load structure to
CSystemClass* pSystemClass = getSystemClass();
- log_info("Loading " + pSystemClass->getName() + " system class structure");
+ log_info("Loading %s system class structure", pSystemClass->getName().c_str());
// Get structure description element
const CFrameworkConfigurationLocation* pStructureDescriptionFileLocation = static_cast<const CFrameworkConfigurationLocation*>(getConstFrameworkConfiguration()->findChildOfKind("StructureDescriptionFileLocation"));
@@ -565,7 +594,12 @@
CAutoLog autolog(pSystemClass, "Importing system structure from file " + strXmlStructureFilePath);
- if (!xmlParse(parameterBuildContext, pSystemClass, strXmlStructureFilePath, strXmlStructureFolder, EParameterCreationLibrary)) {
+ _xmlDoc *doc = CXmlDocSource::mkXmlDoc(strXmlStructureFilePath, true, true, strError);
+ if (doc == NULL) {
+ return false;
+ }
+
+ if (!xmlParse(parameterBuildContext, pSystemClass, doc, strXmlStructureFolder, EParameterCreationLibrary)) {
return false;
}
@@ -586,7 +620,7 @@
if (!success && !_bFailOnFailedSettingsLoad) {
// Load can not fail, ie continue but log the load errors
- log_info(strLoadError);
+ log_info("%s", strLoadError.c_str());
log_info("Failed to load settings, continue without domains.");
success = true;
}
@@ -654,8 +688,12 @@
log_info("Importing configurable domains from file %s %s settings", strXmlConfigurationDomainsFilePath.c_str(), pBinarySettingsFileLocation ? "without" : "with");
- // Do parse
- if (!xmlParse(xmlDomainImportContext, pConfigurableDomains, strXmlConfigurationDomainsFilePath, strXmlConfigurationDomainsFolder, EParameterConfigurationLibrary, "SystemClassName")) {
+ _xmlDoc *doc = CXmlDocSource::mkXmlDoc(strXmlConfigurationDomainsFilePath, true, true, strError);
+ if (doc == NULL) {
+ return false;
+ }
+
+ if (!xmlParse(xmlDomainImportContext, pConfigurableDomains, doc, strXmlConfigurationDomainsFolder, EParameterConfigurationLibrary, "SystemClassName")) {
return false;
}
@@ -672,40 +710,12 @@
return true;
}
-bool CParameterMgr::importDomainFromFile(const string& strXmlFilePath, bool bOverwrite,
- string& strError)
-{
- CXmlDomainImportContext xmlDomainImportContext(strError, true, *getSystemClass());
-
- // Selection criteria definition for rule creation
- xmlDomainImportContext.setSelectionCriteriaDefinition(
- getConstSelectionCriteria()->getSelectionCriteriaDefinition());
-
- // Auto validation of configurations
- xmlDomainImportContext.setAutoValidationRequired(true);
-
- // We initialize the domain with an empty name but since we have set the isDomainStandalone
- // context, the name will be retrieved during de-serialization
- std::auto_ptr<CConfigurableDomain> standaloneDomain(new CConfigurableDomain());
- bool bSuccess = xmlParse(xmlDomainImportContext, standaloneDomain.get(),
- strXmlFilePath, "", EParameterConfigurationLibrary, "");
-
- if (!bSuccess) {
- return false;
- }
-
- bSuccess = getConfigurableDomains()->addDomain(*standaloneDomain, bOverwrite, strError);
- if (!bSuccess) {
- return false;
- }
-
- // ownership has been transfered to the ConfigurableDomains object
- standaloneDomain.release();
- return true;
-}
-
// XML parsing
-bool CParameterMgr::xmlParse(CXmlElementSerializingContext& elementSerializingContext, CElement* pRootElement, const string& strXmlFilePath, const string& strXmlFolder, CParameterMgr::ElementLibrary eElementLibrary, const string& strNameAttrituteName)
+bool CParameterMgr::xmlParse(CXmlElementSerializingContext& elementSerializingContext,
+ CElement* pRootElement, _xmlDoc* doc,
+ const string& strXmlFolder,
+ CParameterMgr::ElementLibrary eElementLibrary,
+ const string& strNameAttributeName)
{
// Init serializing context
elementSerializingContext.set(_pElementLibrarySet->getElementLibrary(
@@ -714,25 +724,18 @@
// Get Schema file associated to root element
string strXmlSchemaFilePath = _strSchemaFolderLocation + "/" + pRootElement->getKind() + ".xsd";
- std::auto_ptr<CXmlFileDocSource> fileDocSource(NULL);
-
- if (strNameAttrituteName.empty()) {
- fileDocSource.reset(new CXmlFileDocSource(strXmlFilePath, strXmlSchemaFilePath,
- pRootElement->getKind(),
- _bValidateSchemasOnStart));
- } else {
- fileDocSource.reset(new CXmlFileDocSource(strXmlFilePath, strXmlSchemaFilePath,
- pRootElement->getKind(),
- pRootElement->getName(), strNameAttrituteName,
- _bValidateSchemasOnStart));
- }
+ CXmlDocSource docSource(doc, _bValidateSchemasOnStart,
+ strXmlSchemaFilePath,
+ pRootElement->getKind(),
+ pRootElement->getName(),
+ strNameAttributeName);
// Start clean
pRootElement->clean();
CXmlMemoryDocSink memorySink(pRootElement);
- if (!memorySink.process(*fileDocSource, elementSerializingContext)) {
+ if (!memorySink.process(docSource, elementSerializingContext)) {
//Cleanup
pRootElement->clean();
@@ -899,7 +902,7 @@
// Show status
/// General section
- appendTitle(strResult, "General:");
+ CUtility::appendTitle(strResult, "General:");
// System class
strResult += "System Class: ";
strResult += pSystemClass->getName();
@@ -926,19 +929,19 @@
strResult += "\n";
/// Subsystem list
- appendTitle(strResult, "Subsystems:");
+ CUtility::appendTitle(strResult, "Subsystems:");
string strSubsystemList;
pSystemClass->listChildrenPaths(strSubsystemList);
strResult += strSubsystemList;
/// Last applied configurations
- appendTitle(strResult, "Last Applied [Pending] Configurations:");
+ CUtility::appendTitle(strResult, "Last Applied [Pending] Configurations:");
string strLastAppliedConfigurations;
getConfigurableDomains()->listLastAppliedConfigurations(strLastAppliedConfigurations);
strResult += strLastAppliedConfigurations;
/// Criteria states
- appendTitle(strResult, "Selection Criteria:");
+ CUtility::appendTitle(strResult, "Selection Criteria:");
list<string> lstrSelectionCriteria;
getSelectionCriteria()->listSelectionCriteria(lstrSelectionCriteria, false, true);
// Concatenate the criterion list as the command result
@@ -950,7 +953,7 @@
}
/// Tuning Mode
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setTuningModeCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setTuningModeCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
if (remoteCommand.getArgument(0) == "on") {
@@ -971,7 +974,7 @@
return CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getTuningModeCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getTuningModeCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -981,7 +984,7 @@
}
/// Value Space
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setValueSpaceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setValueSpaceCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)strResult;
@@ -1004,7 +1007,7 @@
return CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getValueSpaceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getValueSpaceCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1014,7 +1017,7 @@
}
/// Output Raw Format
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setOutputRawFormatCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setOutputRawFormatCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)strResult;
@@ -1037,7 +1040,7 @@
return CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getOutputRawFormatCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getOutputRawFormatCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1047,7 +1050,7 @@
}
/// Sync
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setAutoSyncCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setAutoSyncCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
if (remoteCommand.getArgument(0) == "on") {
@@ -1068,7 +1071,7 @@
return CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getAutoSyncCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getAutoSyncCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1077,7 +1080,7 @@
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::syncCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::syncCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1085,7 +1088,7 @@
}
/// Criteria
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listCriteriaCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listCriteriaCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
if (remoteCommand.getArgumentCount() > 1) {
@@ -1137,7 +1140,7 @@
}
/// Domains
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listDomainsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1146,30 +1149,30 @@
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::createDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::createDomainCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return createDomain(remoteCommand.getArgument(0), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::deleteDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::deleteDomainCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return deleteDomain(remoteCommand.getArgument(0), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::deleteAllDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::deleteAllDomainsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
return deleteAllDomains(strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::renameDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::renameDomainCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return renameDomain(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ?
CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setSequenceAwarenessCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setSequenceAwarenessCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Set property
bool bSequenceAware;
@@ -1191,7 +1194,7 @@
CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getSequenceAwarenessCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getSequenceAwarenessCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Get property
bool bSequenceAware;
@@ -1206,33 +1209,33 @@
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listDomainElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listDomainElementsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return getConfigurableDomains()->listDomainElements(remoteCommand.getArgument(0), strResult) ? CCommandHandler::ESucceeded : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::addElementCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::addElementCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return addConfigurableElementToDomain(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::removeElementCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::removeElementCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return removeConfigurableElementFromDomain(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::splitDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::splitDomainCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return split(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
/// Configurations
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listConfigurationsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listConfigurationsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return getConstConfigurableDomains()->listConfigurations(remoteCommand.getArgument(0), strResult) ? CCommandHandler::ESucceeded : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::dumpDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::dumpDomainsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1246,29 +1249,29 @@
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::createConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::createConfigurationCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return createConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::deleteConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::deleteConfigurationCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return deleteConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::renameConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::renameConfigurationCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return renameConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1),
remoteCommand.getArgument(2), strResult) ?
CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::saveConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::saveConfigurationCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return saveConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::restoreConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::restoreConfigurationCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
list<string> lstrResult;
if (!restoreConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1), lstrResult)) {
@@ -1280,7 +1283,7 @@
return CCommandHandler::EDone;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setElementSequenceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setElementSequenceCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Build configurable element path list
std::vector<string> astrNewElementSequence;
@@ -1298,13 +1301,13 @@
CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getElementSequenceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getElementSequenceCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Delegate to configurable domains
return getConfigurableDomains()->getElementSequence(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::ESucceeded : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setRuleCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setRuleCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Delegate to configurable domains
return setApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1),
@@ -1312,7 +1315,7 @@
CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::clearRuleCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::clearRuleCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Delegate to configurable domains
return clearApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1),
@@ -1320,7 +1323,7 @@
CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getRuleCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getRuleCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Delegate to configurable domains
return getApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1),
@@ -1329,7 +1332,7 @@
}
/// Elements/Parameters
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listElementsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
CElementLocator elementLocator(getSystemClass(), false);
@@ -1357,7 +1360,7 @@
}
/// Elements/Parameters
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listParametersCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listParametersCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
CElementLocator elementLocator(getSystemClass(), false);
@@ -1384,7 +1387,7 @@
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::dumpElementCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::dumpElementCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
CElementLocator elementLocator(getSystemClass());
@@ -1405,7 +1408,7 @@
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getElementSizeCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getElementSizeCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
CElementLocator elementLocator(getSystemClass());
@@ -1425,7 +1428,7 @@
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::showPropertiesCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::showPropertiesCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
CElementLocator elementLocator(getSystemClass());
@@ -1445,7 +1448,7 @@
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getParameterCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
string strValue;
@@ -1459,7 +1462,7 @@
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setParameterCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Get value to set
string strValue = remoteCommand.packArguments(1, remoteCommand.getArgumentCount() - 1);
@@ -1467,7 +1470,7 @@
return accessParameterValue(remoteCommand.getArgument(0), strValue, true, strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listBelongingDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listBelongingDomainsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
CElementLocator elementLocator(getSystemClass());
@@ -1487,7 +1490,7 @@
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listAssociatedDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listAssociatedDomainsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
CElementLocator elementLocator(getSystemClass());
@@ -1507,7 +1510,7 @@
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listAssociatedElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listAssociatedElementsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1516,7 +1519,7 @@
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listConflictingElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listConflictingElementsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1525,7 +1528,7 @@
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listRogueElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listRogueElementsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1534,7 +1537,7 @@
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getConfigurationParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getConfigurationParameterCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
string strOutputValue;
string strError;
@@ -1550,7 +1553,7 @@
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setConfigurationParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setConfigurationParameterCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Get value to set
string strValue = remoteCommand.packArguments(3, remoteCommand.getArgumentCount() - 3);
@@ -1563,7 +1566,7 @@
return bSuccess ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::showMappingCommmandProcess(
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::showMappingCommandProcess(
const IRemoteCommand& remoteCommand,
string& strResult)
{
@@ -1577,7 +1580,7 @@
/// Settings Import/Export
CParameterMgr::CCommandHandler::CommandStatus
- CParameterMgr::exportConfigurableDomainsToXMLCommmandProcess(
+ CParameterMgr::exportDomainsXMLCommandProcess(
const IRemoteCommand& remoteCommand, string& strResult)
{
string strFileName = remoteCommand.getArgument(0);
@@ -1586,7 +1589,7 @@
}
CParameterMgr::CCommandHandler::CommandStatus
- CParameterMgr::importConfigurableDomainsFromXMLCommmandProcess(
+ CParameterMgr::importDomainsXMLCommandProcess(
const IRemoteCommand& remoteCommand, string& strResult)
{
return importDomainsXml(remoteCommand.getArgument(0), false, true, strResult) ?
@@ -1594,7 +1597,7 @@
}
CParameterMgr::CCommandHandler::CommandStatus
- CParameterMgr::exportConfigurableDomainsWithSettingsToXMLCommmandProcess(
+ CParameterMgr::exportDomainsWithSettingsXMLCommandProcess(
const IRemoteCommand& remoteCommand, string& strResult)
{
string strFileName = remoteCommand.getArgument(0);
@@ -1602,12 +1605,22 @@
CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::importConfigurableDomainsWithSettingsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus
+ CParameterMgr::exportDomainWithSettingsXMLCommandProcess(
+ const IRemoteCommand& remoteCommand, string& result)
+{
+ string domainName = remoteCommand.getArgument(0);
+ string fileName = remoteCommand.getArgument(1);
+ return exportSingleDomainXml(fileName, domainName, true, true, result) ?
+ CCommandHandler::EDone : CCommandHandler::EFailed;
+}
+
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::importDomainsWithSettingsXMLCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return importDomainsXml(remoteCommand.getArgument(0), true, true, strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::importConfigurableDomainWithSettingsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::importDomainWithSettingsXMLCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
bool bOverwrite = false;
@@ -1623,22 +1636,22 @@
}
}
- return importSingleDomainXml(remoteCommand.getArgument(0), bOverwrite, strResult) ?
+ return importSingleDomainXml(remoteCommand.getArgument(0), bOverwrite, true, true, strResult) ?
CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::exportSettingsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::exportSettingsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return exportDomainsBinary(remoteCommand.getArgument(0), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::importSettingsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::importSettingsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return importDomainsBinary(remoteCommand.getArgument(0), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
CParameterMgr::CCommandHandler::CommandStatus
- CParameterMgr::getConfigurableDomainsWithSettingsXMLCommmandProcess(
+ CParameterMgr::getDomainsWithSettingsXMLCommandProcess(
const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1652,7 +1665,7 @@
}
CParameterMgr::CCommandHandler::CommandStatus
- CParameterMgr::getConfigurableDomainWithSettingsXMLCommmandProcess(
+ CParameterMgr::getDomainWithSettingsXMLCommandProcess(
const IRemoteCommand& remoteCommand, string& strResult)
{
string strDomainName = remoteCommand.getArgument(0);
@@ -1662,7 +1675,7 @@
}
CParameterMgr::CCommandHandler::CommandStatus
- CParameterMgr::setConfigurableDomainsWithSettingsXMLCommmandProcess(
+ CParameterMgr::setDomainsWithSettingsXMLCommandProcess(
const IRemoteCommand& remoteCommand, string& strResult)
{
return importDomainsXml(remoteCommand.getArgument(0), true, false, strResult) ?
@@ -1670,7 +1683,28 @@
}
CParameterMgr::CCommandHandler::CommandStatus
- CParameterMgr::getSystemClassXMLCommmandProcess(
+ CParameterMgr::setDomainWithSettingsXMLCommandProcess(
+ const IRemoteCommand& remoteCommand, string& result)
+{
+ bool overwrite = false;
+
+ if (remoteCommand.getArgumentCount() > 1) {
+
+ if (remoteCommand.getArgument(1) == "overwrite") {
+
+ overwrite = true;
+ } else {
+ // Show usage
+ return CCommandHandler::EShowUsage;
+ }
+ }
+
+ return importSingleDomainXml(remoteCommand.getArgument(0), overwrite, true, false, result) ?
+ CCommandHandler::EDone : CCommandHandler::EFailed;
+}
+
+CParameterMgr::CCommandHandler::CommandStatus
+ CParameterMgr::getSystemClassXMLCommandProcess(
const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -2175,184 +2209,178 @@
return getConfigurableDomains()->clearApplicationRule(strDomain, strConfiguration, strError);
}
-bool CParameterMgr::importDomainsXml(const string& strXmlSource, bool bWithSettings,
- bool bFromFile, string& strError)
+bool CParameterMgr::importDomainsXml(const string& xmlSource, bool withSettings,
+ bool fromFile, string& errorMsg)
{
// Check tuning mode
- if (!checkTuningModeOn(strError)) {
+ if (!checkTuningModeOn(errorMsg)) {
return false;
}
- // check path is absolute
- if (bFromFile && strXmlSource[0] != '/') {
+ CAutoLog autoLog(this, string("Importing domains from ") +
+ (fromFile ? ("\"" + xmlSource + "\"") : "a user-provided buffer"));
- strError = "Please provide absolute path";
-
- return false;
- }
// Root element
CConfigurableDomains* pConfigurableDomains = getConfigurableDomains();
- // Context
- CXmlDomainImportContext xmlDomainImportContext(strError, bWithSettings, *getSystemClass());
+ bool importSuccess = wrapLegacyXmlImport(xmlSource, fromFile, withSettings,
+ *pConfigurableDomains, "SystemClassName", errorMsg);
+
+ if (importSuccess) {
+
+ // Validate domains after XML import
+ pConfigurableDomains->validate(_pMainParameterBlackboard);
+ }
+
+ return importSuccess;
+}
+
+bool CParameterMgr::importSingleDomainXml(const string& xmlSource, bool overwrite,
+ bool withSettings, bool fromFile, string& errorMsg)
+{
+ if (!checkTuningModeOn(errorMsg)) {
+
+ return false;
+ }
+
+ CAutoLog autoLog(this, string("Importing a single domain from ") +
+ (fromFile ? ("\"" + xmlSource + "\"") : "a user-provided buffer"));
+
+ // We initialize the domain with an empty name but since we have set the isDomainStandalone
+ // context, the name will be retrieved during de-serialization
+ std::auto_ptr<CConfigurableDomain> standaloneDomain(new CConfigurableDomain());
+
+ if (!wrapLegacyXmlImport(xmlSource, fromFile, withSettings, *standaloneDomain, "", errorMsg)) {
+ return false;
+ }
+
+ if (!getConfigurableDomains()->addDomain(*standaloneDomain, overwrite, errorMsg)) {
+ return false;
+ }
+
+ // ownership has been transfered to the ConfigurableDomains object
+ standaloneDomain.release();
+ return true;
+}
+
+bool CParameterMgr::wrapLegacyXmlImport(const string& xmlSource, bool fromFile,
+ bool withSettings, CElement& element,
+ const string& nameAttributeName, string& errorMsg)
+{
+ CXmlDomainImportContext xmlDomainImportContext(errorMsg, withSettings, *getSystemClass());
// Selection criteria definition for rule creation
xmlDomainImportContext.setSelectionCriteriaDefinition(
getConstSelectionCriteria()->getSelectionCriteriaDefinition());
- // Init serializing context
- xmlDomainImportContext.set(
- _pElementLibrarySet->getElementLibrary(EParameterConfigurationLibrary),
- "", _strSchemaFolderLocation);
-
- // Get Schema file associated to root element
- string strXmlSchemaFilePath = _strSchemaFolderLocation + "/" +
- pConfigurableDomains->getKind() + ".xsd";
-
- // Xml Source
- CXmlDocSource* pSource;
-
- if (bFromFile) {
-
- // when importing from a file strXmlSource is the file name
- pSource = new CXmlFileDocSource(strXmlSource, strXmlSchemaFilePath,
- pConfigurableDomains->getKind(),
- pConfigurableDomains->getName(), "SystemClassName",
- _bValidateSchemasOnStart);
-
- } else {
-
- // when importing from an xml string, strXmlSource contains the string
- pSource = new CXmlStringDocSource(strXmlSource, strXmlSchemaFilePath,
- pConfigurableDomains->getKind(),
- pConfigurableDomains->getName(), "SystemClassName",
- _bValidateSchemasOnStart);
-
- }
- // Start clean
- pConfigurableDomains->clean();
-
- // Use a doc sink that instantiate Configurable Domains from the given doc source
- CXmlMemoryDocSink memorySink(pConfigurableDomains);
-
- bool bProcessSuccess = memorySink.process(*pSource, xmlDomainImportContext);
-
- if (!bProcessSuccess) {
-
- //Cleanup
- pConfigurableDomains->clean();
-
- } else {
-
- // Validate domains after XML import
- pConfigurableDomains->validate(_pMainParameterBlackboard);
-
- }
-
- delete pSource;
-
- return bProcessSuccess;
-}
-
-bool CParameterMgr::importSingleDomainXml(const string& strXmlSource, bool bOverwrite,
- string& strError)
-{
- if (!checkTuningModeOn(strError)) {
-
+ // It doesn't make sense to resolve XIncludes on an imported file because
+ // we can't reliably decide of a "base url"
+ _xmlDoc *doc = CXmlDocSource::mkXmlDoc(xmlSource, fromFile, false, errorMsg);
+ if (doc == NULL) {
return false;
}
- // check path is absolute
- if (strXmlSource[0] != '/') {
-
- strError = "Please provide absolute path";
-
- return false;
- }
-
- return importDomainFromFile(strXmlSource, bOverwrite, strError);
+ return xmlParse(xmlDomainImportContext, &element, doc, "", EParameterConfigurationLibrary, nameAttributeName);
}
-bool CParameterMgr::serializeElement(string& strXmlDest,
- CXmlSerializingContext& xmlSerializingContext, bool bToFile,
- const CElement& element, string& strError) const
+bool CParameterMgr::serializeElement(std::ostream& output,
+ CXmlSerializingContext& xmlSerializingContext,
+ const CElement& element) const
{
- // check path is absolute
- if (bToFile && strXmlDest[0] != '/') {
-
- strError = "Please provide absolute path";
-
+ if (!output.good()) {
+ xmlSerializingContext.setError("Can't write XML: the output is in a bad state.");
return false;
}
// Get Schema file associated to root element
- string strXmlSchemaFilePath = _strSchemaFolderLocation + "/" +
+ string xmlSchemaFilePath = _strSchemaFolderLocation + "/" +
element.getKind() + ".xsd";
// Use a doc source by loading data from instantiated Configurable Domains
- CXmlMemoryDocSource memorySource(&element, element.getKind(),
- strXmlSchemaFilePath, "parameter-framework",
- getVersion(), _bValidateSchemasOnStart);
+ CXmlMemoryDocSource memorySource(&element, _bValidateSchemasOnStart,
+ element.getKind(),
+ xmlSchemaFilePath,
+ "parameter-framework",
+ getVersion());
- // Xml Sink
- CXmlDocSink* pSink;
+ // Use a doc sink to write the doc data in a stream
+ CXmlStreamDocSink sink(output);
- if (bToFile) {
+ bool processSuccess = sink.process(memorySource, xmlSerializingContext);
- // Use a doc sink to write the doc data in a file
- pSink = new CXmlFileDocSink(strXmlDest);
-
- } else {
-
- // Use a doc sink to write the doc data in a string
- // TODO: use a stream rather than a string
- pSink = new CXmlStringDocSink(strXmlDest);
- }
-
- bool bProcessSuccess = pSink->process(memorySource, xmlSerializingContext);
-
- delete pSink;
- return bProcessSuccess;
+ return processSuccess;
}
-bool CParameterMgr::exportDomainsXml(string& strXmlDest, bool bWithSettings, bool bToFile,
- string& strError) const
+bool CParameterMgr::exportDomainsXml(string& xmlDest, bool withSettings, bool toFile,
+ string& errorMsg) const
{
- const CConfigurableDomains* pConfigurableDomains = getConstConfigurableDomains();
+ CAutoLog autoLog(this, string("Exporting domains to ") +
+ (toFile ? ("\"" + xmlDest + "\"") : " a user-provided buffer"));
- CXmlDomainExportContext xmlDomainExportContext(strError, bWithSettings);
+ const CConfigurableDomains* configurableDomains = getConstConfigurableDomains();
- xmlDomainExportContext.setValueSpaceRaw(_bValueSpaceIsRaw);
-
- xmlDomainExportContext.setOutputRawFormat(_bOutputRawFormatIsHex);
-
-
- return serializeElement(strXmlDest, xmlDomainExportContext, bToFile,
- *pConfigurableDomains, strError);
+ return wrapLegacyXmlExport(xmlDest, toFile, withSettings, *configurableDomains, errorMsg);
}
-bool CParameterMgr::exportSingleDomainXml(string& strXmlDest, const string& strDomainName,
- bool bWithSettings, bool bToFile, string& strError) const
+bool CParameterMgr::exportSingleDomainXml(string& xmlDest, const string& domainName,
+ bool withSettings, bool toFile, string& errorMsg) const
{
- const CConfigurableDomains* pAllDomains = getConstConfigurableDomains();
+ CAutoLog autoLog(this, string("Exporting single domain '") + domainName + "' to " +
+ (toFile ? ("\"" + xmlDest + "\"") : " a user-provided buffer"));
// Element to be serialized
- const CConfigurableDomain* pRequestedDomain =
- pAllDomains->findConfigurableDomain(strDomainName, strError);
+ const CConfigurableDomain* requestedDomain =
+ getConstConfigurableDomains()->findConfigurableDomain(domainName, errorMsg);
- if (!pRequestedDomain) {
+ if (requestedDomain == NULL) {
return false;
}
- CXmlDomainExportContext xmlDomainExportContext(strError, bWithSettings);
+ return wrapLegacyXmlExport(xmlDest, toFile, withSettings, *requestedDomain, errorMsg);
+}
- xmlDomainExportContext.setValueSpaceRaw(_bValueSpaceIsRaw);
+bool CParameterMgr::wrapLegacyXmlExport(string& xmlDest, bool toFile, bool withSettings,
+ const CElement& element, string& errorMsg) const
+{
+ CXmlDomainExportContext context(errorMsg, withSettings, _bValueSpaceIsRaw,
+ _bOutputRawFormatIsHex);
- xmlDomainExportContext.setOutputRawFormat(_bOutputRawFormatIsHex);
+ if (toFile) {
+ return wrapLegacyXmlExportToFile(xmlDest, element, context);
+ } else {
+ return wrapLegacyXmlExportToString(xmlDest, element, context);
+ }
+}
- return serializeElement(strXmlDest, xmlDomainExportContext, bToFile,
- *pRequestedDomain, strError);
+bool CParameterMgr::wrapLegacyXmlExportToFile(string& xmlDest,
+ const CElement& element,
+ CXmlDomainExportContext &context) const
+{
+ std::ofstream output(xmlDest.c_str());
+
+ if (output.fail()) {
+ context.setError("Failed to open \"" + xmlDest + "\" for writing.");
+ return false;
+ }
+
+ return serializeElement(output, context, element);
+
+}
+
+bool CParameterMgr::wrapLegacyXmlExportToString(string& xmlDest,
+ const CElement& element,
+ CXmlDomainExportContext &context) const
+{
+ std::ostringstream output;
+
+ if (!serializeElement(output, context, element)) {
+ return false;
+ }
+
+ xmlDest = output.str();
+
+ return true;
}
// Binary Import/Export
@@ -2363,13 +2391,8 @@
return false;
}
- // check path is absolute
- if (strFileName[0] != '/') {
- strError = "Please provide absolute path";
-
- return false;
- }
+ CAutoLog autoLog(this, string("Importing domains from binary file \"") + strFileName + "\"");
// Root element
CConfigurableDomains* pConfigurableDomains = getConfigurableDomains();
@@ -2379,14 +2402,7 @@
bool CParameterMgr::exportDomainsBinary(const string& strFileName, string& strError)
{
- // check path is absolute
- if (strFileName[0] != '/') {
-
- strError = "Please provide absolute path";
-
- return false;
- }
-
+ CAutoLog autoLog(this, string("Exporting domains to binary file \"") + strFileName + "\"");
// Root element
CConfigurableDomains* pConfigurableDomains = getConfigurableDomains();
@@ -2525,12 +2541,12 @@
log_info("Starting remote processor server on port %d", getConstFrameworkConfiguration()->getServerPort());
// Start
- if (!_pRemoteProcessorServer->start()) {
+ if (!_pRemoteProcessorServer->start(strError)) {
ostringstream oss;
oss << "ParameterMgr: Unable to start remote processor server on port "
<< getConstFrameworkConfiguration()->getServerPort();
- strError = oss.str();
+ strError = oss.str() + ": " + strError;
return false;
}
@@ -2539,19 +2555,6 @@
return true;
}
-// Back synchronization
-CBackSynchronizer* CParameterMgr::createBackSynchronizer() const
-{
-#ifdef SIMULATION
- // In simulation, back synchronization of the blackboard won't probably work
- // We need to ensure though the blackboard is initialized with valid data
- return new CSimulatedBackSynchronizer(getConstSystemClass(), _pMainParameterBlackboard);
-#else
- // Real back synchronizer from subsystems
- return new CHardwareBackSynchronizer(getConstSystemClass(), _pMainParameterBlackboard);
-#endif
-}
-
// Children typwise access
CParameterFrameworkConfiguration* CParameterMgr::getFrameworkConfiguration()
{
@@ -2624,16 +2627,18 @@
CXmlSerializingContext xmlSerializingContext(strError);
// Use a doc source by loading data from instantiated Configurable Domains
- CXmlMemoryDocSource memorySource(pXmlSource, strRootElementType, false);
+ CXmlMemoryDocSource memorySource(pXmlSource, false, strRootElementType);
// Use a doc sink that write the doc data in a string
- CXmlStringDocSink stringSink(strResult);
+ ostringstream output;
+ CXmlStreamDocSink streamSink(output);
// Do the export
- bool bProcessSuccess = stringSink.process(memorySource, xmlSerializingContext);
+ bool bProcessSuccess = streamSink.process(memorySource, xmlSerializingContext);
- if (!bProcessSuccess) {
-
+ if (bProcessSuccess) {
+ strResult = output.str();
+ } else {
strResult = strError;
}
diff --git a/parameter/ParameterMgr.h b/parameter/ParameterMgr.h
index 4ae6fda..cd2f664 100644
--- a/parameter/ParameterMgr.h
+++ b/parameter/ParameterMgr.h
@@ -40,8 +40,11 @@
#include "Element.h"
#include "XmlDocSink.h"
#include "XmlDocSource.h"
+#include "XmlDomainExportContext.h"
#include <string>
+#include <ostream>
+#include <istream>
class CElementLibrarySet;
class CSubsystemLibrary;
@@ -52,7 +55,6 @@
class CParameterBlackboard;
class CConfigurableDomains;
class IRemoteProcessorServerInterface;
-class CBackSynchronizer;
class CParameterHandle;
class CSubsystemPlugins;
class CParameterAccessContext;
@@ -87,9 +89,9 @@
const char* _pcDescription;
};
// Version
- static const uint32_t guiEditionMajor = 0x2;
- static const uint32_t guiEditionMinor = 0x4;
- static const uint32_t guiRevision = 0x0;
+ static const uint32_t guiEditionMajor = 2;
+ static const uint32_t guiEditionMinor = 6;
+ static const uint32_t guiRevision = 0;
// Parameter handle friendship
friend class CParameterHandle;
@@ -276,63 +278,65 @@
/**
* Method that imports Configurable Domains from an Xml source.
*
- * @param[in] strXmlSource a std::string containing an xml description or a path to an xml file
- * @param[in] bWithSettings a boolean that determines if the settings should be used in the
+ * @param[in] xmlSource a std::string containing an xml description or a path to an xml file
+ * @param[in] withSettings a boolean that determines if the settings should be used in the
* xml description
- * @param[in] bFromFile a boolean that determines if the source is an xml description in
- * strXmlSource or contained in a file. In that case strXmlSource is just the file path.
- * @param[out] strError is used as the error output
+ * @param[in] fromFile a boolean that determines if the source is an xml description in
+ * xmlSource or contained in a file. In that case xmlSource is just the file path.
+ * @param[out] errorMsg is used as the error output
*
* @return false if any error occures
*/
- bool importDomainsXml(const std::string& strXmlSource, bool bWithSettings, bool bFromFile,
- std::string& strError);
+ bool importDomainsXml(const std::string& xmlSource, bool withSettings, bool fromFile,
+ std::string& errorMsg);
/**
* Method that imports a single Configurable Domain from an Xml source.
*
- * @param[in] strXmlSource a string containing an xml description or a path to an xml file
- * @param[in] bWithSettings a boolean that determines if the settings should be used in the
+ * @param[in] xmlSource a string containing an xml description or a path to an xml file
+ * @param[in] overwrite when importing an existing domain, allow
+ * overwriting or return an error
+ * @param[in] withSettings a boolean that determines if the settings should be used in the
* xml description
- * @param[in] bFromFile a boolean that determines if the source is an xml description in
- * strXmlSource or contained in a file. In that case strXmlSource is just the file path.
- * @param[out] strError is used as the error output
+ * @param[in] fromFile a boolean that determines if the source is an xml description in
+ * xmlSource or contained in a file. In that case xmlSource is just the file path.
+ * @param[out] errorMsg is used as the error output
*
* @return false if any error occurs
*/
- bool importSingleDomainXml(const std::string& strXmlSource, bool bOverwrite,
- std::string& strError);
+ bool importSingleDomainXml(const std::string& xmlSource, bool overwrite, bool withSettings,
+ bool fromFile, std::string& errorMsg);
/**
* Method that exports Configurable Domains to an Xml destination.
*
- * @param[in,out] strXmlDest a string containing an xml description or a path to an xml file
- * @param[in] bWithSettings a boolean that determines if the settings should be used in the
+ * @param[in,out] xmlDest a string containing an xml description or a path to an xml file
+ * @param[in] withSettings a boolean that determines if the settings should be used in the
* xml description
- * @param[in] bToFile a boolean that determines if the destination is an xml description in
- * strXmlDest or contained in a file. In that case strXmlDest is just the file path.
- * @param[out] strError is used as the error output
+ * @param[in] toFile a boolean that determines if the destination is an xml description in
+ * xmlDest or contained in a file. In that case xmlDest is just the file path.
+ * @param[out] errorMsg is used as the error output
*
* @return false if any error occurs, true otherwise.
*/
- bool exportDomainsXml(std::string& strXmlDest, bool bWithSettings, bool bToFile,
- std::string& strError) const;
+ bool exportDomainsXml(std::string& xmlDest, bool withSettings, bool toFile,
+ std::string& errorMsg) const;
/**
* Method that exports a given Configurable Domain to an Xml destination.
*
- * @param[in,out] strXmlDest a string containing an xml description or a path to an xml file
- * @param[in] strDomainName the name of the domain to be exported
- * @param[in] bWithSettings a boolean that determines if the settings should be used in the
+ * @param[in,out] xmlDest a string containing an xml description or a path to an xml file
+ * @param[in] domainName the name of the domain to be exported
+ * @param[in] withSettings a boolean that determines if the settings should be used in the
* xml description
- * @param[in] bToFile a boolean that determines if the destination is an xml description in
- * strXmlDest or contained in a file. In that case strXmlDest is just the file path.
- * @param[out] strError is used as the error output
+ * @param[in] toFile a boolean that determines if the destination is an xml description in
+ * xmlDest or contained in a file. In that case xmlDest is just the file path.
+ * @param[out] errorMsg is used as the error output
*
* @return false if any error occurs, true otherwise.
*/
- bool exportSingleDomainXml(std::string& strXmlDest, const std::string& strDomainName,
- bool bWithSettings, bool bToFile, std::string& strError) const;
+ bool exportSingleDomainXml(std::string& xmlDest, const std::string& domainName,
+ bool withSettings, bool toFile, std::string& errorMsg) const;
// Binary Import/Export
bool importDomainsBinary(const std::string& strFileName, std::string& strError);
@@ -375,74 +379,84 @@
/// Status
CCommandHandler::CommandStatus statusCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/// Tuning Mode
- CCommandHandler::CommandStatus setTuningModeCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getTuningModeCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus setTuningModeCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getTuningModeCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/// Value Space
- CCommandHandler::CommandStatus setValueSpaceCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getValueSpaceCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus setValueSpaceCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getValueSpaceCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/// Output Raw Format
- CCommandHandler::CommandStatus setOutputRawFormatCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getOutputRawFormatCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus setOutputRawFormatCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getOutputRawFormatCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/// Sync
- CCommandHandler::CommandStatus setAutoSyncCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getAutoSyncCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus syncCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus setAutoSyncCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getAutoSyncCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus syncCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/// Criteria
- CCommandHandler::CommandStatus listCriteriaCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listCriteriaCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/// Domains
- CCommandHandler::CommandStatus listDomainsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus createDomainCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus deleteDomainCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus deleteAllDomainsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus renameDomainCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus setSequenceAwarenessCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getSequenceAwarenessCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus listDomainElementsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus addElementCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus removeElementCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus splitDomainCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listDomainsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus createDomainCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus deleteDomainCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus deleteAllDomainsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus renameDomainCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus setSequenceAwarenessCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getSequenceAwarenessCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listDomainElementsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus addElementCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus removeElementCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus splitDomainCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/// Configurations
- CCommandHandler::CommandStatus listConfigurationsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus dumpDomainsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus createConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus deleteConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus renameConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus saveConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus restoreConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus setElementSequenceCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getElementSequenceCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus setRuleCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus clearRuleCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getRuleCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listConfigurationsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus dumpDomainsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus createConfigurationCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus deleteConfigurationCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus renameConfigurationCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus saveConfigurationCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus restoreConfigurationCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus setElementSequenceCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getElementSequenceCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus setRuleCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus clearRuleCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getRuleCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/// Elements/Parameters
- CCommandHandler::CommandStatus listElementsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus listParametersCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus dumpElementCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getElementSizeCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus showPropertiesCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getParameterCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus setParameterCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getConfigurationParameterCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus setConfigurationParameterCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus listBelongingDomainsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus listAssociatedDomainsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus showMappingCommmandProcess(const IRemoteCommand& remoteCommand,
+ CCommandHandler::CommandStatus listElementsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listParametersCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus dumpElementCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getElementSizeCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus showPropertiesCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getParameterCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus setParameterCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getConfigurationParameterCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus setConfigurationParameterCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listBelongingDomainsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listAssociatedDomainsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus showMappingCommandProcess(const IRemoteCommand& remoteCommand,
std::string& strResult);
/// Browse
- CCommandHandler::CommandStatus listAssociatedElementsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus listConflictingElementsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus listRogueElementsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listAssociatedElementsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listConflictingElementsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listRogueElementsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/// Settings Import/Export
- CCommandHandler::CommandStatus exportConfigurableDomainsToXMLCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus importConfigurableDomainsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus exportConfigurableDomainsWithSettingsToXMLCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus importConfigurableDomainsWithSettingsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus importConfigurableDomainWithSettingsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus exportSettingsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus importSettingsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus exportDomainsXMLCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus importDomainsXMLCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus exportDomainsWithSettingsXMLCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus importDomainsWithSettingsXMLCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ /**
+ * Command handler method for exportDomainWithSettingsXML command.
+ *
+ * @param[in] remoteCommand contains the arguments of the received command.
+ * @param[out] result a std::string containing the result of the command
+ *
+ * @return CCommandHandler::ESucceeded if command succeeded or CCommandHandler::EFailed
+ * in the other case
+ */
+ CCommandHandler::CommandStatus exportDomainWithSettingsXMLCommandProcess(const IRemoteCommand& remoteCommand, std::string& result);
+ CCommandHandler::CommandStatus importDomainWithSettingsXMLCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus exportSettingsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus importSettingsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/**
- * Command handler method for getConfigurableDomainsWithSettings command.
+ * Command handler method for getDomainsWithSettings command.
*
* @param[in] remoteCommand contains the arguments of the received command.
* @param[out] strResult a std::string containing the result of the command
@@ -450,11 +464,11 @@
* @return CCommandHandler::ESucceeded if command succeeded or CCommandHandler::EFailed
* in the other case
*/
- CCommandHandler::CommandStatus getConfigurableDomainsWithSettingsXMLCommmandProcess(
+ CCommandHandler::CommandStatus getDomainsWithSettingsXMLCommandProcess(
const IRemoteCommand& remoteCommand, std::string& strResult);
/**
- * Command handler method for getConfigurableDomainWithSettings command.
+ * Command handler method for getDomainWithSettings command.
*
* @param[in] remoteCommand contains the arguments of the received command.
* @param[out] strResult a string containing the result of the command
@@ -462,11 +476,11 @@
* @return CCommandHandler::ESucceeded if command succeeded or CCommandHandler::EFailed
* in the other case
*/
- CCommandHandler::CommandStatus getConfigurableDomainWithSettingsXMLCommmandProcess(
+ CCommandHandler::CommandStatus getDomainWithSettingsXMLCommandProcess(
const IRemoteCommand& remoteCommand, std::string& strResult);
/**
- * Command handler method for setConfigurableDomainWithSettings command.
+ * Command handler method for setDomainsWithSettings command.
*
* @param[in] remoteCommand contains the arguments of the received command.
* @param[out] strResult a std::string containing the result of the command
@@ -474,10 +488,22 @@
* @return CCommandHandler::ESucceeded if command succeeded or CCommandHandler::EFailed
* in the other case
*/
- CCommandHandler::CommandStatus setConfigurableDomainsWithSettingsXMLCommmandProcess(
+ CCommandHandler::CommandStatus setDomainsWithSettingsXMLCommandProcess(
const IRemoteCommand& remoteCommand, std::string& strResult);
/**
+ * Command handler method for setDomainWithSettings command.
+ *
+ * @param[in] remoteCommand contains the arguments of the received command.
+ * @param[out] result a std::string containing the result of the command
+ *
+ * @return CCommandHandler::ESucceeded if command succeeded or CCommandHandler::EFailed
+ * in the other case
+ */
+ CCommandHandler::CommandStatus setDomainWithSettingsXMLCommandProcess(
+ const IRemoteCommand& remoteCommand, std::string& result);
+
+ /**
* Command handler method for getSystemClass command.
*
* @param[in] remoteCommand contains the arguments of the received command.
@@ -486,7 +512,7 @@
* @return CCommandHandler::ESucceeded if command succeeded or CCommandHandler::EFailed
* in the other case
*/
- CCommandHandler::CommandStatus getSystemClassXMLCommmandProcess(
+ CCommandHandler::CommandStatus getSystemClassXMLCommandProcess(
const IRemoteCommand& remoteCommand, std::string& strResult);
// Max command usage length, use for formatting
@@ -516,35 +542,104 @@
bool loadSettings(std::string& strError);
bool loadSettingsFromConfigFile(std::string& strError);
- // Parse XML file into Root element
- bool xmlParse(CXmlElementSerializingContext& elementSerializingContext, CElement* pRootElement, const std::string& strXmlFilePath, const std::string& strXmlFolder, ElementLibrary eElementLibrary, const std::string& strNameAttrituteName = "Name");
+ /** Parse an XML stream into an element
+ *
+ * @param[in] elementSerializingContext serializing context
+ * @param[out] pRootElement the receiving element
+ * @param[in] input the input XML stream
+ * @param[in] strXmlFolder the folder containing the XML input file (if applicable) or ""
+ * @param[in] eElementLibrary which element library to be used
+ * @param[in] strNameAttributeName the name of the element's XML "name" attribute
+ *
+ * @returns true if parsing succeeded, false otherwise
+ */
+ bool xmlParse(CXmlElementSerializingContext& elementSerializingContext, CElement* pRootElement,
+ _xmlDoc* doc, const std::string& strXmlFolder,
+ ElementLibrary eElementLibrary, const std::string& strNameAttributeName = "Name");
+
+ /** Wrapper for converting public APIs semantics to internal API
+ *
+ * Public APIs have a string argument that can either contain:
+ * - a path to an XML file or;
+ * - an actual XML document.
+ * They also have a boolean argument specifying which of the two cases it
+ * is.
+ *
+ * Instead, the internal APIs only take an std::istream argument. This
+ * method opens the file as a stream if applicable or simply wrap the
+ * string in a stream. It then passes the stream to the internal methods.
+ *
+ * @param[in] xmlSource the XML source (either a path or an actual xml
+ * document)
+ * @param[in] fromFile specifies whether xmlSource is a path or an
+ * actual XML document
+ * @param[in] withSettings if false, only import the configurations
+ * applicability rules; if true, also import their settings
+ * @param[out] element the receiving element
+ * @param[in] nameAttributeName the name of the element's XML "name"
+ * attribute
+ * @param[out] errorMsg string used as output for any error message
+ *
+ * @returns true if the import succeeded, false otherwise
+ */
+ bool wrapLegacyXmlImport(const std::string& xmlSource, bool fromFile, bool withSettings,
+ CElement& element, const std::string& nameAttributeName,
+ std::string& errorMsg);
/**
* Export an element object to an Xml destination.
*
*
- * @param[in,out] strXmlDest a string containing an xml description or a path to an xml file.
+ * @param[out] output the stream to output the XML to
* @param[in] xmlSerializingContext the serializing context
- * @param[in] bToFile a boolean that determines if the destination is an xml description in
- * strXmlDest or contained in a file. In that case strXmlDest is just the file path.
* @param[in] element object to be serialized.
- * @param[out] strError is used as the error output.
*
* @return false if any error occurs, true otherwise.
*/
- bool serializeElement(std::string& strXmlDest, CXmlSerializingContext& xmlSerializingContext,
- bool bToFile, const CElement& element, std::string& strError) const;
+ bool serializeElement(std::ostream& output, CXmlSerializingContext& xmlSerializingContext,
+ const CElement& element) const;
- /**
- * Method that imports a single Configurable Domain, with settings, from an Xml file.
- *
- * @param[in] strXmlFilePath absolute path to the xml file containing the domain
- * @param[out] strError is used as the error output
- *
- * @return false if any error occurs
- */
- bool importDomainFromFile(const std::string& strXmlFilePath, bool bOverwrite,
- std::string& strError);
+ /** Wrapper for converting public APIs semantics to internal API
+ *
+ * Public APIs have a string argument that can either:
+ * - contain a path to an XML file or;
+ * - receive an actual XML document.
+ * They also have a boolean argument specifying which of the two cases it
+ * is.
+ *
+ * Instead, the internal APIs only take an std::ostream argument. This
+ * method opens the file as a stream if applicable or simply wrap the
+ * string in a stream. It then passes the stream to the internal methods.
+ *
+ * @param[in] xmlDest the XML sink (either a path or any string that
+ * will be filled)
+ * @param[in] toFile specifies whether xmlSource is a path or a
+ * string that will receive an actual XML document
+ * @param[in] withSettings if false, only export the configurations
+ * applicability rules; if true, also export their settings
+ * @param[out] element the element to be exported
+ * @param[out] errorMsg string used as output for any error message
+ *
+ * @returns true if the export succeeded, false otherwise
+ */
+ bool wrapLegacyXmlExport(std::string& xmlDest, bool toFile, bool withSettings,
+ const CElement& element, std::string& errorMsg) const;
+
+ /** Wrapper for converting public APIs semantics to internal API
+ *
+ * @see wrapLegacyXmlExport
+ */
+ bool wrapLegacyXmlExportToFile(std::string& xmlDest,
+ const CElement& element,
+ CXmlDomainExportContext &context) const;
+
+ /** Wrapper for converting public APIs semantics to internal API
+ *
+ * @see wrapLegacyXmlExport
+ */
+ bool wrapLegacyXmlExportToString(std::string& xmlDest,
+ const CElement& element,
+ CXmlDomainExportContext &context) const;
// Framework Configuration
@@ -573,9 +668,6 @@
// Remote Processor Server connection handling
bool handleRemoteProcessingInterface(std::string& strError);
- // Back synchronization
- CBackSynchronizer* createBackSynchronizer() const;
-
// Tuning
bool _bTuningModeIsOn;
diff --git a/parameter/ParameterMgrFullConnector.cpp b/parameter/ParameterMgrFullConnector.cpp
index 0991475..30d2780 100644
--- a/parameter/ParameterMgrFullConnector.cpp
+++ b/parameter/ParameterMgrFullConnector.cpp
@@ -349,10 +349,19 @@
return _pParameterMgr->exportDomainsXml(strXmlDest, bWithSettings, bToFile, strError);
}
+// deprecated, use the other version of importSingleDomainXml instead
bool CParameterMgrFullConnector::importSingleDomainXml(const string& strXmlSource, bool bOverwrite,
string& strError)
{
- return _pParameterMgr->importSingleDomainXml(strXmlSource, bOverwrite, strError);
+ return importSingleDomainXml(strXmlSource, bOverwrite, true, false, strError);
+}
+
+bool CParameterMgrFullConnector::importSingleDomainXml(const string& xmlSource, bool overwrite,
+ bool withSettings, bool fromFile,
+ string& errorMsg)
+{
+ return _pParameterMgr->importSingleDomainXml(xmlSource, overwrite, withSettings, fromFile,
+ errorMsg);
}
bool CParameterMgrFullConnector::exportSingleDomainXml(string& strXmlDest,
diff --git a/parameter/ParameterType.cpp b/parameter/ParameterType.cpp
index 01d94aa..eb9fd3d 100644
--- a/parameter/ParameterType.cpp
+++ b/parameter/ParameterType.cpp
@@ -31,11 +31,14 @@
#include "Parameter.h"
#include "ArrayParameter.h"
#include "ParameterAccessContext.h"
+#include "Utility.h"
#define base CTypeElement
using std::string;
+const std::string CParameterType::gUnitPropertyName = "Unit";
+
CParameterType::CParameterType(const string& strName) : base(strName), _uiSize(0)
{
}
@@ -68,15 +71,33 @@
return _strUnit;
}
+void CParameterType::setUnit(const std::string& strUnit)
+{
+ _strUnit = strUnit;
+}
+
// From IXmlSink
bool CParameterType::fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext)
{
- // Unit
- _strUnit = xmlElement.getAttributeString("Unit");
-
+ setUnit(xmlElement.getAttributeString(gUnitPropertyName));
return base::fromXml(xmlElement, serializingContext);
}
+// From IXmlSource
+void CParameterType::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
+{
+ base::toXml(xmlElement, serializingContext);
+ setXmlUnitAttribute(xmlElement);
+}
+
+void CParameterType::setXmlUnitAttribute(CXmlElement& xmlElement) const
+{
+ const string& unit = getUnit();
+ if (!unit.empty()) {
+ xmlElement.setAttributeString(gUnitPropertyName, unit);
+ }
+}
+
// XML Serialization value space handling
// Value space handling for configuration import/export
void CParameterType::handleValueSpaceAttribute(CXmlElement& xmlConfigurableElementSettingsElement, CConfigurationAccessContext& configurationAccessContext) const
@@ -91,14 +112,13 @@
{
base::showProperties(strResult);
- // Unit
- if (!_strUnit.empty()) {
-
- strResult += "Unit: " + _strUnit + "\n";
+ // Add Unit property if found
+ if (!getUnit().empty()) {
+ strResult += gUnitPropertyName + ": " + getUnit() + "\n";
}
// Scalar size
- strResult += "Scalar size: " + toString(getSize()) + " byte(s) \n";
+ strResult += "Scalar size: " + CUtility::toString(getSize()) + " byte(s) \n";
}
// Default value handling (simulation only)
diff --git a/parameter/ParameterType.h b/parameter/ParameterType.h
index 7d7caf7..cf58f7b 100644
--- a/parameter/ParameterType.h
+++ b/parameter/ParameterType.h
@@ -50,10 +50,14 @@
// Unit
std::string getUnit() const;
+ void setUnit(const std::string& strUnit);
// From IXmlSink
virtual bool fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext);
+ // From IXmlSource
+ virtual void toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const;
+
/// Conversions
// String
virtual bool toBlackboard(const std::string& strValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const = 0;
@@ -118,6 +122,8 @@
}
private:
+ void setXmlUnitAttribute(CXmlElement& xmlElement) const;
+
// Instantiation
virtual CInstanceConfigurableElement* doInstantiate() const;
// Generic Access
@@ -130,4 +136,6 @@
uint32_t _uiSize;
// Unit
std::string _strUnit;
+
+ static const std::string gUnitPropertyName;
};
diff --git a/parameter/RuleParser.cpp b/parameter/RuleParser.cpp
index d4ac87d..e77b3c8 100644
--- a/parameter/RuleParser.cpp
+++ b/parameter/RuleParser.cpp
@@ -148,26 +148,26 @@
// Iterate
bool CRuleParser::iterate(string& strError)
{
- string::size_type iDelimiter;
+ string::size_type delimiter;
assert(_uiCurrentPos <= _strApplicationRule.length());
// Consume spaces
- if ((iDelimiter = _strApplicationRule.find_first_not_of(" ", _uiCurrentPos)) != string::npos) {
+ if ((delimiter = _strApplicationRule.find_first_not_of(" ", _uiCurrentPos)) != string::npos) {
// New pos
- _uiCurrentPos = iDelimiter;
+ _uiCurrentPos = delimiter;
}
// Parse
- if ((_uiCurrentPos != _strApplicationRule.length()) && ((iDelimiter = _strApplicationRule.find_first_of(_acDelimiters[_eStatus], _uiCurrentPos)) != string::npos)) {
+ if ((_uiCurrentPos != _strApplicationRule.length()) && ((delimiter = _strApplicationRule.find_first_of(_acDelimiters[_eStatus], _uiCurrentPos)) != string::npos)) {
- switch(_strApplicationRule[iDelimiter]) {
+ switch(_strApplicationRule[delimiter]) {
case '{':
_eStatus = EBeginCompoundRule;
// Extract type
- _strRuleType = _strApplicationRule.substr(_uiCurrentPos, iDelimiter - _uiCurrentPos);
+ _strRuleType = _strApplicationRule.substr(_uiCurrentPos, delimiter - _uiCurrentPos);
_uiCurrentDeepness++;
break;
case '}':
@@ -183,14 +183,14 @@
case ' ':
_eStatus = ECriterionRule;
// Extract type
- _strRuleType = _strApplicationRule.substr(_uiCurrentPos, iDelimiter - _uiCurrentPos);
+ _strRuleType = _strApplicationRule.substr(_uiCurrentPos, delimiter - _uiCurrentPos);
break;
case ',':
_eStatus = EContinue;
break;
}
// New pos
- _uiCurrentPos = iDelimiter + 1;
+ _uiCurrentPos = delimiter + 1;
} else {
if (_uiCurrentDeepness) {
@@ -240,26 +240,26 @@
// Next word
bool CRuleParser::next(string& strNext, string& strError)
{
- string::size_type iDelimiter;
+ string::size_type delimiter;
// Consume spaces
- if ((iDelimiter = _strApplicationRule.find_first_not_of(" ", _uiCurrentPos)) != string::npos) {
+ if ((delimiter = _strApplicationRule.find_first_not_of(" ", _uiCurrentPos)) != string::npos) {
// New pos
- _uiCurrentPos = iDelimiter;
+ _uiCurrentPos = delimiter;
}
- if ((iDelimiter = _strApplicationRule.find_first_of("{} ,", _uiCurrentPos)) == string::npos) {
+ if ((delimiter = _strApplicationRule.find_first_of("{} ,", _uiCurrentPos)) == string::npos) {
strError = "Syntax error";
return false;
}
- strNext = _strApplicationRule.substr(_uiCurrentPos, iDelimiter - _uiCurrentPos);
+ strNext = _strApplicationRule.substr(_uiCurrentPos, delimiter - _uiCurrentPos);
// New pos
- _uiCurrentPos = iDelimiter;
+ _uiCurrentPos = delimiter;
return true;
}
diff --git a/parameter/RuleParser.h b/parameter/RuleParser.h
index f701d76..803ea3e 100644
--- a/parameter/RuleParser.h
+++ b/parameter/RuleParser.h
@@ -78,8 +78,8 @@
std::string _strApplicationRule;
// Criteria defintion
const CSelectionCriteriaDefinition* _pSelectionCriteriaDefinition;
- // Iterator
- uint32_t _uiCurrentPos;
+ /** String iterator */
+ std::string::size_type _uiCurrentPos;
// Deepness
uint32_t _uiCurrentDeepness;
// Current Type
diff --git a/parameter/SelectionCriteriaDefinition.cpp b/parameter/SelectionCriteriaDefinition.cpp
index f14aad8..d7c4228 100644
--- a/parameter/SelectionCriteriaDefinition.cpp
+++ b/parameter/SelectionCriteriaDefinition.cpp
@@ -64,8 +64,8 @@
void CSelectionCriteriaDefinition::listSelectionCriteria(std::list<std::string>& lstrResult, bool bWithTypeInfo, bool bHumanReadable) const
{
// Propagate
- uint32_t uiNbChildren = getNbChildren();
- uint32_t uiChild;
+ size_t uiNbChildren = getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
@@ -79,8 +79,8 @@
void CSelectionCriteriaDefinition::resetModifiedStatus()
{
// Propagate
- uint32_t uiNbChildren = getNbChildren();
- uint32_t uiChild;
+ size_t uiNbChildren = getNbChildren();
+ size_t uiChild;
CSelectionCriterion* pSelectionCriterion;
for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
diff --git a/parameter/SelectionCriterion.cpp b/parameter/SelectionCriterion.cpp
index 7818924..e45c993 100644
--- a/parameter/SelectionCriterion.cpp
+++ b/parameter/SelectionCriterion.cpp
@@ -30,6 +30,7 @@
#include "SelectionCriterion.h"
#include "AutoLog.h"
+#include "Utility.h"
#define base CElement
@@ -125,7 +126,7 @@
if (bWithTypeInfo) {
// Display type info
- appendTitle(strFormattedDescription, getName() + ":");
+ CUtility::appendTitle(strFormattedDescription, getName() + ":");
// States
strFormattedDescription += "Possible states ";
diff --git a/parameter/SelectionCriterionType.cpp b/parameter/SelectionCriterionType.cpp
index 2f17379..ce633c6 100644
--- a/parameter/SelectionCriterionType.cpp
+++ b/parameter/SelectionCriterionType.cpp
@@ -77,9 +77,9 @@
Tokenizer tok(strValue, _strDelimiter);
std::vector<std::string> astrValues = tok.split();
- uint32_t uiNbValues = astrValues.size();
+ size_t uiNbValues = astrValues.size();
int iResult = 0;
- uint32_t uiValueIndex;
+ size_t uiValueIndex;
iValue = 0;
// Looping on each std::string delimited by "|" token and adding the associated value
@@ -179,7 +179,10 @@
// Simple translation
std::string strSingleValue;
- getLiteralValue(iSingleBitValue, strSingleValue);
+ if (!getLiteralValue(iSingleBitValue, strSingleValue)) {
+ // Numeric value not part supported values for this criterion type.
+ continue;
+ }
if (bFirst) {
diff --git a/parameter/StringParameter.cpp b/parameter/StringParameter.cpp
index cb13e9b..8ba5b16 100644
--- a/parameter/StringParameter.cpp
+++ b/parameter/StringParameter.cpp
@@ -32,7 +32,6 @@
#include "ParameterAccessContext.h"
#include "ConfigurationAccessContext.h"
#include "ParameterBlackboard.h"
-#include <alloca.h>
#define base CBaseParameter
@@ -79,19 +78,12 @@
// Write blackboard
CParameterBlackboard* pBlackboard = parameterAccessContext.getParameterBlackboard();
- pBlackboard->writeString(strValue.c_str(), uiOffset);
+ pBlackboard->writeString(strValue, uiOffset);
return true;
}
void CStringParameter::doGetValue(string& strValue, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const
{
- char* pcValue = (char*)alloca(getSize());
-
- // Read blackboard
- const CParameterBlackboard* pBlackboard = parameterAccessContext.getParameterBlackboard();
-
- pBlackboard->readString(pcValue, uiOffset);
-
- strValue = pcValue;
+ parameterAccessContext.getParameterBlackboard()->readString(strValue, uiOffset);
}
diff --git a/parameter/StringParameterType.cpp b/parameter/StringParameterType.cpp
index d47895d..321dc97 100644
--- a/parameter/StringParameterType.cpp
+++ b/parameter/StringParameterType.cpp
@@ -29,6 +29,7 @@
*/
#include "StringParameterType.h"
#include "StringParameter.h"
+#include "Utility.h"
#define base CTypeElement
@@ -51,7 +52,7 @@
// Max length
strResult += "Max length: ";
- strResult += toString(_uiMaxLength);
+ strResult += CUtility::toString(_uiMaxLength);
strResult += "\n";
}
diff --git a/parameter/Subsystem.cpp b/parameter/Subsystem.cpp
index fc54695..6b0264b 100644
--- a/parameter/Subsystem.cpp
+++ b/parameter/Subsystem.cpp
@@ -35,6 +35,7 @@
#include "ConfigurationAccessContext.h"
#include "SubsystemObjectCreator.h"
#include "MappingData.h"
+#include "Utility.h"
#include <assert.h>
#include <sstream>
@@ -104,6 +105,10 @@
// From IXmlSink
bool CSubsystem::fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext)
{
+ // Subsystem class does not rely on generic fromXml algorithm of Element class.
+ // So, setting here the description if found as XML attribute.
+ setDescription(getXmlDescriptionAttribute(xmlElement));
+
// Context
CXmlParameterSerializingContext& parameterBuildContext = static_cast<CXmlParameterSerializingContext&>(serializingContext);
@@ -175,8 +180,8 @@
_contextStack.push(context);
// Map all instantiated subelements in subsystem
- uint32_t uiNbChildren = getNbChildren();
- uint32_t uiChild;
+ size_t uiNbChildren = getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
@@ -440,7 +445,8 @@
pSubsystemObjectCreator->getMaxConfigurableElementSize()) {
string strSizeError = "Size should not exceed " +
- toString(pSubsystemObjectCreator->getMaxConfigurableElementSize());
+ CUtility::toString(
+ pSubsystemObjectCreator->getMaxConfigurableElementSize());
strError = getMappingError(strKey, strSizeError, pInstanceConfigurableElement);
diff --git a/parameter/SubsystemObject.cpp b/parameter/SubsystemObject.cpp
index 76b9549..e6b7b44 100644
--- a/parameter/SubsystemObject.cpp
+++ b/parameter/SubsystemObject.cpp
@@ -149,7 +149,7 @@
strError = string("Unable to ") + (bBack ? "back" : "forward") + " synchronize configurable element " +
_pInstanceConfigurableElement->getPath() + ": " + strError;
- log_warning(strError);
+ log_warning("%s", strError.c_str());
// Fall back to parameter default initialization
if (bBack) {
@@ -213,37 +213,37 @@
}
// Logging
-void CSubsystemObject::log_info(const string& strMessage, ...) const
+void CSubsystemObject::log_info(std::string strMessage, ...) const
{
char *pacBuffer;
va_list listPointer;
va_start(listPointer, strMessage);
- vasprintf(&pacBuffer, strMessage.c_str(), listPointer);
+ vasprintf(&pacBuffer, strMessage.c_str(), listPointer);
va_end(listPointer);
if (pacBuffer != NULL) {
- _pInstanceConfigurableElement->log_info(pacBuffer);
+ _pInstanceConfigurableElement->log_info("%s", pacBuffer);
}
free(pacBuffer);
}
-void CSubsystemObject::log_warning(const string& strMessage, ...) const
+void CSubsystemObject::log_warning(std::string strMessage, ...) const
{
char *pacBuffer;
va_list listPointer;
va_start(listPointer, strMessage);
- vasprintf(&pacBuffer, strMessage.c_str(), listPointer);
+ vasprintf(&pacBuffer, strMessage.c_str(), listPointer);
va_end(listPointer);
if (pacBuffer != NULL) {
- _pInstanceConfigurableElement->log_warning(pacBuffer);
+ _pInstanceConfigurableElement->log_warning("%s", pacBuffer);
}
free(pacBuffer);
diff --git a/parameter/SubsystemObject.h b/parameter/SubsystemObject.h
index ab085bc..2ba2123 100644
--- a/parameter/SubsystemObject.h
+++ b/parameter/SubsystemObject.h
@@ -83,8 +83,12 @@
void blackboardRead(void* pvData, uint32_t uiSize);
void blackboardWrite(const void* pvData, uint32_t uiSize);
// Logging
- void log_info(const std::string& strMessage, ...) const;
- void log_warning(const std::string& strMessage, ...) const;
+ // Copy the string format because:
+ // - passing char * would break compatibility
+ // - passing a const std::string & in forbiden by the c++ standard
+ // as va_start second argument must not be a reference.
+ void log_info(std::string strMessage, ...) const;
+ void log_warning(std::string strMessage, ...) const;
// Belonging Subsystem retrieval
const CSubsystem* getSubsystem() const;
diff --git a/parameter/SystemClass.cpp b/parameter/SystemClass.cpp
index cc51112..ae4f747 100644
--- a/parameter/SystemClass.cpp
+++ b/parameter/SystemClass.cpp
@@ -279,8 +279,8 @@
void CSystemClass::checkForSubsystemsToResync(CSyncerSet& syncerSet)
{
- uint32_t uiNbChildren = getNbChildren();
- uint32_t uiChild;
+ size_t uiNbChildren = getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
@@ -298,8 +298,8 @@
void CSystemClass::cleanSubsystemsNeedToResync()
{
- uint32_t uiNbChildren = getNbChildren();
- uint32_t uiChild;
+ size_t uiNbChildren = getNbChildren();
+ size_t uiChild;
for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
diff --git a/parameter/TypeElement.cpp b/parameter/TypeElement.cpp
index 7e58c75..01b7137 100644
--- a/parameter/TypeElement.cpp
+++ b/parameter/TypeElement.cpp
@@ -76,15 +76,18 @@
// Element properties
void CTypeElement::showProperties(std::string& strResult) const
{
- (void)strResult;
- // Prevent base from being called in that context!
+ // The description attribute may be found in the type and not from instance.
+ showDescriptionProperty(strResult);
+ // Prevent base from being called from the Parameter Type context as
+ // it would lead to duplicate the name attribute (duplicated in the type and instance
+ // which have a common base Element)
}
void CTypeElement::populate(CElement* pElement) const
{
// Populate children
- uint32_t uiChild;
- uint32_t uiNbChildren = getNbChildren();
+ size_t uiChild;
+ size_t uiNbChildren = getNbChildren();
for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
diff --git a/parameter/XmlDomainExportContext.h b/parameter/XmlDomainExportContext.h
index 6a95d97..22ad995 100644
--- a/parameter/XmlDomainExportContext.h
+++ b/parameter/XmlDomainExportContext.h
@@ -35,8 +35,14 @@
class CXmlDomainExportContext : public CXmlDomainSerializingContext
{
public:
- CXmlDomainExportContext(std::string& strError, bool bWithSettings):
- base(strError, bWithSettings) {}
+ CXmlDomainExportContext(std::string& strError,
+ bool bWithSettings = true,
+ bool bValueSpaceIsRaw = true,
+ bool bOutputRawFormatIsHex = true):
+ base(strError, bWithSettings),
+ _bValueSpaceIsRaw(bValueSpaceIsRaw),
+ _bOutputRawFormatIsHex(bOutputRawFormatIsHex)
+ {}
// Value interpretation as Real or Raw
void setValueSpaceRaw(bool bIsRaw)
diff --git a/parameter/XmlFileIncluderElement.cpp b/parameter/XmlFileIncluderElement.cpp
index e9b95cd..d20a624 100644
--- a/parameter/XmlFileIncluderElement.cpp
+++ b/parameter/XmlFileIncluderElement.cpp
@@ -28,20 +28,20 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "XmlFileIncluderElement.h"
-#include "XmlFileDocSource.h"
+#include "XmlDocSource.h"
#include "XmlMemoryDocSink.h"
#include "XmlElementSerializingContext.h"
#include "ElementLibrary.h"
#include "AutoLog.h"
#include <assert.h>
+#include <fstream>
#define base CKindElement
CXmlFileIncluderElement::CXmlFileIncluderElement(const std::string& strName,
const std::string& strKind,
- bool bValidateWithSchemas) : base(strName,
- strKind)
+ bool bValidateWithSchemas)
+ : base(strName, strKind), _bValidateSchemasOnStart(bValidateWithSchemas)
{
- _bValidateSchemasOnStart = bValidateWithSchemas;
}
// From IXmlSink
@@ -69,12 +69,20 @@
std::string strPathToXsdFile = elementSerializingContext.getXmlSchemaPathFolder() + "/" +
strIncludedElementType + ".xsd";
- CXmlFileDocSource fileDocSource(strPath,
- strPathToXsdFile,
- strIncludedElementType,
- _bValidateSchemasOnStart);
+ std::string xmlErrorMsg;
+ _xmlDoc *doc = CXmlDocSource::mkXmlDoc(strPath, true, true, xmlErrorMsg);
+ if (doc == NULL) {
+ elementSerializingContext.setError(xmlErrorMsg);
+ return false;
+ }
- if (!fileDocSource.isParsable(elementSerializingContext)) {
+ CXmlDocSource docSource(doc, _bValidateSchemasOnStart,
+ strPathToXsdFile,
+ strIncludedElementType);
+
+ if (!docSource.isParsable()) {
+
+ elementSerializingContext.setError("Could not parse document \"" + strPath + "\"");
return false;
}
@@ -82,7 +90,7 @@
// Get top level element
CXmlElement childElement;
- fileDocSource.getRootElement(childElement);
+ docSource.getRootElement(childElement);
// Create child element
CElement* pChild = elementSerializingContext.getElementLibrary()->createElement(childElement);
@@ -101,7 +109,7 @@
// Use a doc sink that instantiate the structure from the doc source
CXmlMemoryDocSink memorySink(pChild);
- if (!memorySink.process(fileDocSource, elementSerializingContext)) {
+ if (!memorySink.process(docSource, elementSerializingContext)) {
return false;
}
@@ -120,9 +128,9 @@
{
std::string strKind = getKind();
- int iPosToRemoveFrom = strKind.rfind("Include", -1);
+ std::string::size_type pos = strKind.rfind("Include", std::string::npos);
- assert(iPosToRemoveFrom != -1);
+ assert(pos != std::string::npos);
- return strKind.substr(0, iPosToRemoveFrom);
+ return strKind.substr(0, pos);
}
diff --git a/parameter/include/ParameterHandle.h b/parameter/include/ParameterHandle.h
index 745c31b..7dd9fcb 100644
--- a/parameter/include/ParameterHandle.h
+++ b/parameter/include/ParameterHandle.h
@@ -92,7 +92,7 @@
private:
// Access validity
- bool checkAccessValidity(bool bSet, uint32_t uiArrayLength, std::string& strError) const;
+ bool checkAccessValidity(bool bSet, size_t uiArrayLength, std::string& strError) const;
// Accessed parameter instance
const CBaseParameter* _pBaseParameter;
diff --git a/parameter/include/ParameterMgrFullConnector.h b/parameter/include/ParameterMgrFullConnector.h
index 31022a6..4ee3b4f 100644
--- a/parameter/include/ParameterMgrFullConnector.h
+++ b/parameter/include/ParameterMgrFullConnector.h
@@ -215,11 +215,28 @@
/**
* Method that imports a single Configurable Domain from an Xml source.
*
- * @param[in] strXmlSource a string containing an xml description or a path to an xml file
- * @param[in] bWithSettings a boolean that determines if the settings should be used in the
+ * @param[in] xmlSource a string containing an xml description or a path to an xml file
+ * @param[in] overwrite when importing an existing domain, allow overwriting or return an
+ * error
+ * @param[in] withSettings a boolean that determines if the settings should be used in the
* xml description
- * @param[in] bFromFile a boolean that determines if the source is an xml description in
+ * @param[in] fromFile a boolean that determines if the source is an xml description in
* strXmlSource or contained in a file. In that case strXmlSource is just the file path.
+ * @param[out] errorMsg is used as the error output
+ *
+ * @return false if any error occurs
+ */
+ bool importSingleDomainXml(const std::string& xmlSource, bool overwrite, bool withSettings,
+ bool toFile, std::string& errorMsg);
+ /**
+ * Method that imports a single Configurable Domain from an string
+ * describing an Xml source.
+ *
+ * @deprecated use the other versions of importSingleDomainXml instead
+ *
+ * @param[in] strXmlSource a string containing an xml description
+ * @param[in] bOverwrite when importing an existing domain, allow overwriting or return an
+ * error
* @param[out] strError is used as the error output
*
* @return false if any error occurs
diff --git a/remote-process/remote-process-SetupFiles/remote-process.msi b/remote-process/remote-process-SetupFiles/remote-process.msi
deleted file mode 100644
index 9054313..0000000
--- a/remote-process/remote-process-SetupFiles/remote-process.msi
+++ /dev/null
Binary files differ
diff --git a/remote-process/remote-process.aip b/remote-process/remote-process.aip
deleted file mode 100644
index b2627ab..0000000
--- a/remote-process/remote-process.aip
+++ /dev/null
@@ -1,106 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<DOCUMENT Type="Advanced Installer" CreateVersion="8.4" version="8.4" Modules="simple" RootPath="." Language="en" Id="{DF8C210E-8203-42B3-952D-37C25C847E40}">
- <COMPONENT cid="caphyon.advinst.msicomp.MsiPropsComponent">
- <ROW Property="ALLUSERS" Value="2"/>
- <ROW Property="ARPCOMMENTS" Value="This installer database contains the logic and data required to install [|ProductName]." ValueLocId="*"/>
- <ROW Property="Manufacturer" Value="Intel" ValueLocId="*"/>
- <ROW Property="ProductCode" Value="1033:{AF2B7CC8-4839-474B-9EDC-C6DF403A6E06} " Type="16"/>
- <ROW Property="ProductLanguage" Value="1033"/>
- <ROW Property="ProductName" Value="remote-process" ValueLocId="*"/>
- <ROW Property="ProductVersion" Value="1.0.0"/>
- <ROW Property="SecureCustomProperties" Value="OLDPRODUCTS;AI_NEWERPRODUCTFOUND"/>
- <ROW Property="UpgradeCode" Value="{3625D1F7-8052-480A-A478-4F7EF0F14086}"/>
- <ROW Property="WindowsType9X" MultiBuildValue="DefaultBuild:Windows 9x/ME" ValueLocId="-"/>
- <ROW Property="WindowsType9XDisplay" MultiBuildValue="DefaultBuild:Windows 9x/ME" ValueLocId="-"/>
- </COMPONENT>
- <COMPONENT cid="caphyon.advinst.msicomp.MsiDirsComponent">
- <ROW Directory="APPDIR" Directory_Parent="TARGETDIR" DefaultDir="APPDIR:." IsPseudoRoot="1"/>
- <ROW Directory="TARGETDIR" DefaultDir="SourceDir"/>
- </COMPONENT>
- <COMPONENT cid="caphyon.advinst.msicomp.MsiCompsComponent">
- <ROW Component="cygwin1.dll" ComponentId="{3D0DD481-F3F9-4604-80A6-E3BDCF89EE07}" Directory_="APPDIR" Attributes="0" KeyPath="cygwin1.dll"/>
- <ROW Component="remote_process.exe" ComponentId="{5501B612-760F-414A-BDDB-C8792519F574}" Directory_="APPDIR" Attributes="0" KeyPath="remote_process.exe"/>
- <ROW Component="remote_processor.dll" ComponentId="{8C46DBF0-DAF8-45CC-8EBA-4D1C58D866EF}" Directory_="APPDIR" Attributes="0" KeyPath="remote_processor.dll"/>
- </COMPONENT>
- <COMPONENT cid="caphyon.advinst.msicomp.MsiFeatsComponent">
- <ROW Feature="MainFeature" Title="MainFeature" Description="Description" Display="1" Level="1" Directory_="APPDIR" Attributes="0" Components="cygwin1.dll remote_process.exe remote_processor.dll"/>
- <ATTRIBUTE name="CurrentFeature" value="MainFeature"/>
- </COMPONENT>
- <COMPONENT cid="caphyon.advinst.msicomp.MsiFilesComponent">
- <ROW File="cygwin1.dll" Component_="cygwin1.dll" FileName="cygwin1.dll" Attributes="0" SourcePath="..\..\..\..\..\..\..\..\cygwin\bin\cygwin1.dll" SelfReg="false" NextFile="remote_processor.dll"/>
- <ROW File="remote_process.exe" Component_="remote_process.exe" FileName="remote~1.exe|remote-process.exe" Attributes="0" SourcePath="..\..\parameter-framework-build-windows\remote-process.exe" SelfReg="false"/>
- <ROW File="remote_processor.dll" Component_="remote_processor.dll" FileName="remote~1.dll|remote-processor.dll" Attributes="0" SourcePath="..\..\parameter-framework-build-windows\remote-processor.dll" SelfReg="false" NextFile="remote_process.exe"/>
- </COMPONENT>
- <COMPONENT cid="caphyon.advinst.msicomp.BuildComponent">
- <ROW BuildKey="DefaultBuild" BuildName="DefaultBuild" BuildOrder="1" BuildType="0" Languages="en" InstallationType="4"/>
- <ATTRIBUTE name="CurrentBuild" value="DefaultBuild"/>
- </COMPONENT>
- <COMPONENT cid="caphyon.advinst.msicomp.DictionaryComponent">
- <ROW Path="<AI_DICTS>ui.ail"/>
- <ROW Path="<AI_DICTS>ui_en.ail"/>
- </COMPONENT>
- <COMPONENT cid="caphyon.advinst.msicomp.FragmentComponent">
- <ROW Fragment="CommonUI.aip" Path="<AI_FRAGS>CommonUI.aip"/>
- <ROW Fragment="FolderDlg.aip" Path="<AI_THEMES>classic\fragments\FolderDlg.aip"/>
- <ROW Fragment="SequenceDialogs.aip" Path="<AI_THEMES>classic\fragments\SequenceDialogs.aip"/>
- <ROW Fragment="Sequences.aip" Path="<AI_FRAGS>Sequences.aip"/>
- <ROW Fragment="StaticUIStrings.aip" Path="<AI_FRAGS>StaticUIStrings.aip"/>
- <ROW Fragment="UI.aip" Path="<AI_THEMES>classic\fragments\UI.aip"/>
- <ROW Fragment="Validation.aip" Path="<AI_FRAGS>Validation.aip"/>
- </COMPONENT>
- <COMPONENT cid="caphyon.advinst.msicomp.MsiBinaryComponent">
- <ROW Name="aicustact.dll" SourcePath="<AI_CUSTACTS>aicustact.dll"/>
- </COMPONENT>
- <COMPONENT cid="caphyon.advinst.msicomp.MsiControlComponent">
- <ATTRIBUTE name="FixedSizeBitmaps" value="0"/>
- </COMPONENT>
- <COMPONENT cid="caphyon.advinst.msicomp.MsiControlEventComponent">
- <ROW Dialog_="FolderDlg" Control_="Back" Event="NewDialog" Argument="WelcomeDlg" Condition="AI_INSTALL" Ordering="1"/>
- <ROW Dialog_="WelcomeDlg" Control_="Next" Event="NewDialog" Argument="FolderDlg" Condition="AI_INSTALL" Ordering="1"/>
- <ROW Dialog_="VerifyReadyDlg" Control_="Back" Event="NewDialog" Argument="FolderDlg" Condition="AI_INSTALL" Ordering="201"/>
- <ROW Dialog_="FolderDlg" Control_="Next" Event="NewDialog" Argument="VerifyReadyDlg" Condition="AI_INSTALL" Ordering="201"/>
- <ROW Dialog_="VerifyReadyDlg" Control_="Install" Event="EndDialog" Argument="Return" Condition="AI_INSTALL" Ordering="197"/>
- <ROW Dialog_="MaintenanceTypeDlg" Control_="Back" Event="NewDialog" Argument="MaintenanceWelcomeDlg" Condition="AI_MAINT" Ordering="1"/>
- <ROW Dialog_="MaintenanceWelcomeDlg" Control_="Next" Event="NewDialog" Argument="MaintenanceTypeDlg" Condition="AI_MAINT" Ordering="99"/>
- <ROW Dialog_="CustomizeDlg" Control_="Back" Event="NewDialog" Argument="MaintenanceTypeDlg" Condition="AI_MAINT" Ordering="1"/>
- <ROW Dialog_="MaintenanceTypeDlg" Control_="ChangeButton" Event="NewDialog" Argument="CustomizeDlg" Condition="AI_MAINT" Ordering="301"/>
- <ROW Dialog_="VerifyReadyDlg" Control_="Back" Event="NewDialog" Argument="CustomizeDlg" Condition="AI_MAINT" Ordering="202"/>
- <ROW Dialog_="CustomizeDlg" Control_="Next" Event="NewDialog" Argument="VerifyReadyDlg" Condition="AI_MAINT" Ordering="1"/>
- <ROW Dialog_="VerifyReadyDlg" Control_="Install" Event="EndDialog" Argument="Return" Condition="AI_MAINT" Ordering="198"/>
- <ROW Dialog_="VerifyReadyDlg" Control_="Back" Event="NewDialog" Argument="PatchWelcomeDlg" Condition="AI_PATCH" Ordering="203"/>
- <ROW Dialog_="PatchWelcomeDlg" Control_="Next" Event="NewDialog" Argument="VerifyReadyDlg" Condition="AI_PATCH" Ordering="201"/>
- <ROW Dialog_="VerifyReadyDlg" Control_="Install" Event="EndDialog" Argument="Return" Condition="AI_PATCH" Ordering="199"/>
- <ROW Dialog_="ResumeDlg" Control_="Install" Event="EndDialog" Argument="Return" Condition="AI_RESUME" Ordering="299"/>
- </COMPONENT>
- <COMPONENT cid="caphyon.advinst.msicomp.MsiCustActComponent">
- <ROW Action="AI_DOWNGRADE" Type="19" Target="4010"/>
- <ROW Action="AI_PREPARE_UPGRADE" Type="65" Source="aicustact.dll" Target="PrepareUpgrade"/>
- <ROW Action="AI_RESTORE_LOCATION" Type="65" Source="aicustact.dll" Target="RestoreLocation"/>
- <ROW Action="AI_ResolveKnownFolders" Type="1" Source="aicustact.dll" Target="AI_ResolveKnownFolders"/>
- <ROW Action="AI_STORE_LOCATION" Type="51" Source="ARPINSTALLLOCATION" Target="[APPDIR]"/>
- <ROW Action="SET_APPDIR" Type="307" Source="APPDIR" Target="[ProgramFilesFolder][Manufacturer]\[ProductName]"/>
- <ROW Action="SET_SHORTCUTDIR" Type="307" Source="SHORTCUTDIR" Target="[ProgramMenuFolder][ProductName]"/>
- <ROW Action="SET_TARGETDIR_TO_APPDIR" Type="51" Source="TARGETDIR" Target="[APPDIR]"/>
- </COMPONENT>
- <COMPONENT cid="caphyon.advinst.msicomp.MsiInstExSeqComponent">
- <ROW Action="AI_DOWNGRADE" Condition="AI_NEWERPRODUCTFOUND AND (UILevel <> 5)" Sequence="210"/>
- <ROW Action="AI_RESTORE_LOCATION" Condition="APPDIR=""" Sequence="749"/>
- <ROW Action="AI_STORE_LOCATION" Condition="(Not Installed) OR REINSTALL" Sequence="1501"/>
- <ROW Action="AI_PREPARE_UPGRADE" Condition="AI_UPGRADE="No" AND (Not Installed)" Sequence="1399"/>
- <ROW Action="AI_ResolveKnownFolders" Sequence="51"/>
- </COMPONENT>
- <COMPONENT cid="caphyon.advinst.msicomp.MsiInstallUISequenceComponent">
- <ROW Action="AI_RESTORE_LOCATION" Condition="APPDIR=""" Sequence="749"/>
- <ROW Action="AI_ResolveKnownFolders" Sequence="51"/>
- </COMPONENT>
- <COMPONENT cid="caphyon.advinst.msicomp.MsiLaunchConditionsComponent">
- <ROW Condition="VersionNT" Description="[ProductName] cannot be installed on [WindowsType9XDisplay]" DescriptionLocId="AI.LaunchCondition.No9X" IsPredefined="true" Builds="DefaultBuild"/>
- </COMPONENT>
- <COMPONENT cid="caphyon.advinst.msicomp.MsiThemeComponent">
- <ATTRIBUTE name="UsedTheme" value="classic"/>
- </COMPONENT>
- <COMPONENT cid="caphyon.advinst.msicomp.MsiUpgradeComponent">
- <ROW UpgradeCode="[|UpgradeCode]" VersionMax="[|ProductVersion]" Attributes="1025" ActionProperty="OLDPRODUCTS"/>
- <ROW UpgradeCode="[|UpgradeCode]" VersionMin="[|ProductVersion]" Attributes="2" ActionProperty="AI_NEWERPRODUCTFOUND"/>
- </COMPONENT>
-</DOCUMENT>
diff --git a/remote-process/remote-process.dev b/remote-process/remote-process.dev
deleted file mode 100644
index 2269907..0000000
--- a/remote-process/remote-process.dev
+++ /dev/null
@@ -1,71 +0,0 @@
-[Project]
-FileName=remote-process.dev
-Name=remote-process
-UnitCount=1
-Type=1
-Ver=3
-IsCpp=1
-Folders=
-CommandLine=
-CompilerSettings=0000000000000000000000
-PchHead=-1
-PchSource=-1
-ProfilesCount=1
-ProfileIndex=0
-
-[Unit1]
-FileName=main.cpp
-CompileCpp=1
-Folder=remote-process
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[VersionInfo]
-Major=0
-Minor=1
-Release=1
-Build=1
-LanguageID=1033
-CharsetID=1252
-CompanyName=
-FileVersion=
-FileDescription=Developed using the Dev-C++ IDE
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=
-AutoIncBuildNrOnRebuild=0
-AutoIncBuildNrOnCompile=0
-
-[Profile1]
-ProfileName=Default Profile
-Type=1
-ObjFiles=
-Includes=../remote-processor
-Libs=..\..\..\Windows\parameter-framework-build-windows
-ResourceIncludes=
-MakeIncludes=
-Compiler=
-CppCompiler=-O2_@@_
-Linker=_@@_../../parameter-framework-build-windows/libremote-processor.a_@@_
-PreprocDefines=
-CompilerSettings=0000000000000000000000
-Icon=
-ExeOutput=..\..\..\Windows\parameter-framework-build-windows
-ObjectOutput=..\..\..\Windows\parameter-framework-build-windows\intemediates
-OverrideOutput=0
-OverrideOutputName=remote-process.exe
-HostApplication=
-CommandLine=
-UseCustomMakefile=0
-CustomMakefile=
-IncludeVersionInfo=0
-SupportXPThemes=0
-CompilerSet=0
-CompilerType=0
-
diff --git a/remote-processor/Android.mk b/remote-processor/Android.mk
index e125192..124eb71 100644
--- a/remote-processor/Android.mk
+++ b/remote-processor/Android.mk
@@ -49,10 +49,6 @@
-Werror \
-Wextra \
-Wno-unused-parameter \
- -pthread \
- -Wno-error=unused-result \
-
-common_ldlibs := -pthread
#############################
# Target build
@@ -61,8 +57,9 @@
LOCAL_SRC_FILES := $(common_src_files)
+LOCAL_STATIC_LIBRARIES := libpfw_utility
+
LOCAL_CFLAGS := $(common_cflags)
-LOCAL_LDLIBS := $(common_ldlibs)
LOCAL_MODULE := $(common_module)
LOCAL_MODULE_OWNER := intel
@@ -81,8 +78,10 @@
LOCAL_SRC_FILES := $(common_src_files)
-LOCAL_CFLAGS := $(common_cflags)
-LOCAL_LDLIBS := $(common_ldlibs)
+LOCAL_STATIC_LIBRARIES := libpfw_utility_host
+
+LOCAL_CFLAGS := $(common_cflags) -pthread
+LOCAL_LDLIBS := -lpthread
LOCAL_MODULE := $(common_module)_host
LOCAL_MODULE_OWNER := intel
diff --git a/remote-processor/AnswerMessage.cpp b/remote-processor/AnswerMessage.cpp
index 341917e..8cfe8d3 100644
--- a/remote-processor/AnswerMessage.cpp
+++ b/remote-processor/AnswerMessage.cpp
@@ -61,7 +61,7 @@
}
// Size
-uint32_t CAnswerMessage::getDataSize() const
+size_t CAnswerMessage::getDataSize() const
{
// Answer
return getStringSize(getAnswer());
diff --git a/remote-processor/AnswerMessage.h b/remote-processor/AnswerMessage.h
index 3f50e7e..9dbcdc8 100644
--- a/remote-processor/AnswerMessage.h
+++ b/remote-processor/AnswerMessage.h
@@ -47,8 +47,10 @@
virtual void fillDataToSend();
// Collect received data
virtual void collectReceivedData();
- // Size
- virtual uint32_t getDataSize() const;
+
+ /** @return size of the answer message in bytes
+ */
+ virtual size_t getDataSize() const;
// Answer
void setAnswer(const std::string& strAnswer);
diff --git a/remote-processor/CMakeLists.txt b/remote-processor/CMakeLists.txt
index 23307a1..27a41f9 100644
--- a/remote-processor/CMakeLists.txt
+++ b/remote-processor/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014, Intel Corporation
+# Copyright (c) 2014-2015, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
@@ -37,12 +37,10 @@
RemoteProcessorServerBuilder.cpp)
set(CMAKE_THREAD_PREFER_PTHREAD 1)
-include(FindThreads)
-if(NOT CMAKE_USE_PTHREADS_INIT)
- message(SEND_ERROR "
- pthread library not found! Please install the POSIX thread library and
- headers.")
-endif(NOT CMAKE_USE_PTHREADS_INIT)
-target_link_libraries(remote-processor ${CMAKE_THREAD_LIBS_INIT})
+find_package(Threads REQUIRED)
+
+include_directories("${PROJECT_SOURCE_DIR}/utility")
+
+target_link_libraries(remote-processor pfw_utility ${CMAKE_THREAD_LIBS_INIT})
install(TARGETS remote-processor LIBRARY DESTINATION lib)
diff --git a/remote-processor/ListeningSocket.cpp b/remote-processor/ListeningSocket.cpp
index 1677d71..191d412 100644
--- a/remote-processor/ListeningSocket.cpp
+++ b/remote-processor/ListeningSocket.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -39,6 +39,7 @@
#include <stdio.h>
#include <errno.h>
+#include <cstring>
#define base CSocket
@@ -52,7 +53,7 @@
}
// Listen
-bool CListeningSocket::listen(uint16_t uiPort)
+bool CListeningSocket::listen(uint16_t uiPort, string &strError)
{
struct sockaddr_in server_addr;
@@ -62,19 +63,17 @@
// Bind
if (bind(getFd(), (struct sockaddr*)&server_addr, sizeof(struct sockaddr)) == -1) {
- std::ostringstream oss;
- oss << "CListeningSocket::listen::bind port " << uiPort;
- perror(oss.str().c_str());
-
+ std::ostringstream oss;
+ oss << uiPort;
+ strError = "Could not bind socket to port " + oss.str() + ": " + strerror(errno);
return false;
}
if (::listen(getFd(), 5) == -1) {
- std::ostringstream oss;
- oss << "CListeningSocket::listen::bind port " << uiPort;
- perror(oss.str().c_str());
-
+ std::ostringstream oss;
+ oss << uiPort;
+ strError = "Could not listen to port " + oss.str() + ": " + strerror(errno);
return false;
}
return true;
diff --git a/remote-processor/ListeningSocket.h b/remote-processor/ListeningSocket.h
index 8aa0608..3b5b614 100644
--- a/remote-processor/ListeningSocket.h
+++ b/remote-processor/ListeningSocket.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -37,7 +37,7 @@
CListeningSocket();
// Listen
- bool listen(uint16_t uiPort);
+ bool listen(uint16_t uiPort, std::string &strError);
// Accept
CSocket* accept();
diff --git a/remote-processor/Message.cpp b/remote-processor/Message.cpp
index ee3652d..2662e3d 100644
--- a/remote-processor/Message.cpp
+++ b/remote-processor/Message.cpp
@@ -57,7 +57,7 @@
}
// Data
-void CMessage::writeData(const void* pvData, uint32_t uiSize)
+void CMessage::writeData(const void* pvData, size_t uiSize)
{
assert(_uiIndex + uiSize <= _uiDataSize);
@@ -68,7 +68,7 @@
_uiIndex += uiSize;
}
-void CMessage::readData(void* pvData, uint32_t uiSize)
+void CMessage::readData(void* pvData, size_t uiSize)
{
assert(_uiIndex + uiSize <= _uiDataSize);
@@ -98,7 +98,7 @@
readData(&uiSize, sizeof(uiSize));
// Data
- char* pcData = new char[uiSize + 1];
+ char pcData[uiSize + 1];
// Content
readData(pcData, uiSize);
@@ -108,19 +108,16 @@
// Output
strData = pcData;
-
- // Delete
- delete [] pcData;
}
-uint32_t CMessage::getStringSize(const string& strData) const
+size_t CMessage::getStringSize(const string& strData) const
{
// Return string length plus room to store its length
return strData.length() + sizeof(uint32_t);
}
// Remaining data size
-uint32_t CMessage::getRemainingDataSize() const
+size_t CMessage::getRemainingDataSize() const
{
return _uiDataSize - _uiIndex;
}
@@ -151,7 +148,7 @@
}
// Size
- uint32_t uiSize = sizeof(_ucMsgId) + _uiDataSize;
+ uint32_t uiSize = (uint32_t)(sizeof(_ucMsgId) + _uiDataSize);
if (!pSocket->write(&uiSize, sizeof(uiSize))) {
@@ -267,8 +264,8 @@
return uiChecksum;
}
-// Data allocation
-void CMessage::allocateData(uint32_t uiSize)
+// Allocation of room to store the message
+void CMessage::allocateData(size_t uiSize)
{
// Remove previous one
if (_pucData) {
diff --git a/remote-processor/Message.h b/remote-processor/Message.h
index 2e52c09..3f5e847 100644
--- a/remote-processor/Message.h
+++ b/remote-processor/Message.h
@@ -64,25 +64,61 @@
protected:
// Msg Id
uint8_t getMsgId() const;
- // Data
- void writeData(const void* pvData, uint32_t uiSize);
- void readData(void* pvData, uint32_t uiSize);
+
+ /** Write raw data to the message
+ *
+ * @param[in] pvData pointer to the data array
+ * @param[in] uiSize array size in bytes
+ */
+ void writeData(const void* pvData, size_t uiSize);
+
+ /** Read raw data from the message
+ *
+ * @param[out] pvData pointer to the data array
+ * @param[in] uiSize array size in bytes
+ */
+ void readData(void* pvData, size_t uiSize);
+
+ /** Write string to the message
+ *
+ * @param[in] strData the string to write
+ */
void writeString(const std::string& strData);
+
+ /** Write string to the message
+ *
+ * @param[out] strData the string to read to
+ */
void readString(std::string& strData);
- uint32_t getStringSize(const std::string& strData) const;
- // Remaining data size
- uint32_t getRemainingDataSize() const;
+
+ /** @return string length plus room to store its length
+ *
+ * @param[in] strData the string to get the size from
+ */
+ size_t getStringSize(const std::string& strData) const;
+
+ /** @return remaining data size to read or to write depending on the context
+ * (request: write, answer: read)
+ */
+ size_t getRemainingDataSize() const;
private:
CMessage(const CMessage&);
CMessage& operator=(const CMessage&);
- // Data allocation
- void allocateData(uint32_t uiDataSize);
+
+ /** Allocate room to store the message
+ *
+ * @param[int] uiDataSize the szie to allocate in bytes
+ */
+ void allocateData(size_t uiDataSize);
// Fill data to send
virtual void fillDataToSend() = 0;
// Collect received data
virtual void collectReceivedData() = 0;
- // Size
- virtual uint32_t getDataSize() const = 0;
+
+ /** @return size of the transaction data in bytes
+ */
+ virtual size_t getDataSize() const = 0;
+
// Checksum
uint8_t computeChecksum() const;
@@ -90,8 +126,8 @@
uint8_t _ucMsgId;
// Data
uint8_t* _pucData;
- // Data size
- uint32_t _uiDataSize;
- // Read/Write Index
- uint32_t _uiIndex;
+ /** Size of the allocated memory to store the message */
+ size_t _uiDataSize;
+ /** Read/Write Index used to iterate across the message data */
+ size_t _uiIndex;
};
diff --git a/remote-processor/RemoteCommandHandlerTemplate.h b/remote-processor/RemoteCommandHandlerTemplate.h
index fbfa059..0b7428d 100644
--- a/remote-processor/RemoteCommandHandlerTemplate.h
+++ b/remote-processor/RemoteCommandHandlerTemplate.h
@@ -190,7 +190,7 @@
const CRemoteCommandParserItem* pRemoteCommandParserItem = _remoteCommandParserVector[uiIndex];
- uint32_t uiRemoteCommandUsageLength = pRemoteCommandParserItem->usage().length();
+ uint32_t uiRemoteCommandUsageLength = (uint32_t)pRemoteCommandParserItem->usage().length();
if (uiRemoteCommandUsageLength > _uiMaxCommandUsageLength) {
@@ -220,7 +220,7 @@
strResult += strUsage;
// Align
- uint32_t uiToSpacesAdd = _uiMaxCommandUsageLength + 5 - strUsage.length();
+ uint32_t uiToSpacesAdd = _uiMaxCommandUsageLength + 5 - (uint32_t)strUsage.length();
while (uiToSpacesAdd--) {
diff --git a/remote-processor/RemoteProcessorServer.cpp b/remote-processor/RemoteProcessorServer.cpp
index c1d87e5..e289d4e 100644
--- a/remote-processor/RemoteProcessorServer.cpp
+++ b/remote-processor/RemoteProcessorServer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -29,12 +29,14 @@
*/
#include "RemoteProcessorServer.h"
#include "ListeningSocket.h"
+#include "FullIo.hpp"
#include <iostream>
#include <memory>
#include <assert.h>
#include <poll.h>
#include <unistd.h>
-#include <strings.h>
+#include <string.h>
+#include <errno.h>
#include "RequestMessage.h"
#include "AnswerMessage.h"
#include "RemoteCommandHandler.h"
@@ -44,8 +46,6 @@
CRemoteProcessorServer::CRemoteProcessorServer(uint16_t uiPort, IRemoteCommandHandler* pCommandHandler) :
_uiPort(uiPort), _pCommandHandler(pCommandHandler), _bIsStarted(false), _pListeningSocket(NULL), _ulThreadId(0)
{
- // Create inband pipe
- pipe(_aiInbandPipe);
}
CRemoteProcessorServer::~CRemoteProcessorServer()
@@ -54,27 +54,38 @@
}
// State
-bool CRemoteProcessorServer::start()
+bool CRemoteProcessorServer::start(string &error)
{
assert(!_bIsStarted);
+ if (pipe(_aiInbandPipe) == -1) {
+ error = "Could not create a pipe for remote processor communication: ";
+ error += strerror(errno);
+ return false;
+ }
+
// Create server socket
- _pListeningSocket = new CListeningSocket;
+ std::auto_ptr<CListeningSocket> pListeningSocket(new CListeningSocket);
- if (!_pListeningSocket->listen(_uiPort)) {
-
- // Remove listening socket
- delete _pListeningSocket;
- _pListeningSocket = NULL;
+ if (!pListeningSocket->listen(_uiPort, error)) {
return false;
}
+ // Thread needs to access to the listning socket.
+ _pListeningSocket = pListeningSocket.get();
// Create thread
- pthread_create(&_ulThreadId, NULL, thread_func, this);
+ errno = pthread_create(&_ulThreadId, NULL, thread_func, this);
+ if (errno != 0) {
+
+ error = "Could not create a remote processor thread: ";
+ error += strerror(errno);
+ return false;
+ }
// State
_bIsStarted = true;
+ pListeningSocket.release();
return true;
}
@@ -89,10 +100,20 @@
// Cause exiting of the thread
uint8_t ucData = 0;
- write(_aiInbandPipe[1], &ucData, sizeof(ucData));
+ if (not utility::fullWrite(_aiInbandPipe[1], &ucData, sizeof(ucData))) {
+ std::cerr << "Could not query command processor thread to terminate: "
+ "fail to write on inband pipe: "
+ << strerror(errno) << std::endl;
+ assert(false);
+ }
// Join thread
- pthread_join(_ulThreadId, NULL);
+ errno = pthread_join(_ulThreadId, NULL);
+ if (errno != 0) {
+ std::cout << "Could not join with remote processor thread: "
+ << strerror(errno) << std::endl;
+ assert(false);
+ }
_bIsStarted = false;
@@ -139,7 +160,11 @@
// Consume exit request
uint8_t ucData;
- read(_aiInbandPipe[0], &ucData, sizeof(ucData));
+ if (not utility::fullRead(_aiInbandPipe[0], &ucData, sizeof(ucData))) {
+ std::cerr << "Remote processor could not receive exit request"
+ << strerror(errno) << std::endl;
+ assert(false);
+ }
// Exit
return;
diff --git a/remote-processor/RemoteProcessorServer.h b/remote-processor/RemoteProcessorServer.h
index 202364b..08f93e4 100644
--- a/remote-processor/RemoteProcessorServer.h
+++ b/remote-processor/RemoteProcessorServer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -43,7 +43,7 @@
virtual ~CRemoteProcessorServer();
// State
- virtual bool start();
+ virtual bool start(std::string &error);
virtual void stop();
virtual bool isStarted() const;
diff --git a/remote-processor/RemoteProcessorServerInterface.h b/remote-processor/RemoteProcessorServerInterface.h
index 19a799c..3ca3b76 100644
--- a/remote-processor/RemoteProcessorServerInterface.h
+++ b/remote-processor/RemoteProcessorServerInterface.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -30,11 +30,12 @@
#pragma once
#include "RequestMessage.h"
+#include <string>
class IRemoteProcessorServerInterface
{
public:
- virtual bool start() = 0;
+ virtual bool start(std::string &strError) = 0;
virtual void stop() = 0;
virtual bool isStarted() const = 0;
diff --git a/remote-processor/RequestMessage.cpp b/remote-processor/RequestMessage.cpp
index 32b25f6..3f1cdcc 100644
--- a/remote-processor/RequestMessage.cpp
+++ b/remote-processor/RequestMessage.cpp
@@ -140,10 +140,10 @@
}
// Size
-uint32_t CRequestMessage::getDataSize() const
+size_t CRequestMessage::getDataSize() const
{
// Command
- uint32_t uiSize = getStringSize(getCommand());
+ size_t uiSize = getStringSize(getCommand());
// Arguments
uint32_t uiArgument;
diff --git a/remote-processor/RequestMessage.h b/remote-processor/RequestMessage.h
index 17f433b..7a30aaa 100644
--- a/remote-processor/RequestMessage.h
+++ b/remote-processor/RequestMessage.h
@@ -64,7 +64,10 @@
// Collect received data
virtual void collectReceivedData();
// Size
- virtual uint32_t getDataSize() const;
+ /**
+ * @return size of the request message in bytes
+ */
+ virtual size_t getDataSize() const;
// Trim input std::string
static std::string trim(const std::string& strToTrim);
diff --git a/remote-processor/Socket.cpp b/remote-processor/Socket.cpp
index b36d32f..0aec7a2 100644
--- a/remote-processor/Socket.cpp
+++ b/remote-processor/Socket.cpp
@@ -39,8 +39,9 @@
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <sys/time.h>
+#include <signal.h>
-CSocket::CSocket() : _iSockFd(socket(AF_INET, SOCK_STREAM, 0))
+CSocket::CSocket() : _iSockFd(socket(AF_INET, SOCK_STREAM, 0)), mSendFlag(0)
{
assert(_iSockFd != -1);
@@ -50,6 +51,19 @@
// they are ready to be sent, instead of waiting for more data on the
// socket.
setsockopt(_iSockFd, IPPROTO_TCP, TCP_NODELAY, (char *)&iNoDelay, sizeof(iNoDelay));
+
+ // Disable sigpipe reception on send
+# if not defined(SIGPIPE)
+ // Pipe signal does not exist, there no sigpipe to ignore on send
+# elif defined(SO_NOSIGPIPE)
+ const int set = 1;
+ setsockopt(_iSockFd, SOL_SOCKET, SO_NOSIGPIPE, &set, sizeof(set));
+# elif defined(MSG_NOSIGNAL)
+ // Use flag NOSIGNAL on send call
+ mSendFlag = MSG_NOSIGNAL;
+# else
+# error Can not disable SIGPIPE
+# endif
}
CSocket::CSocket(int iSockId) : _iSockFd(iSockId)
@@ -59,7 +73,11 @@
CSocket::~CSocket()
{
- close(_iSockFd);
+ // fd might be invalide if send had an error.
+ // valgrind displays a warning if closing an invalid fd.
+ if (_iSockFd != -1) {
+ close(_iSockFd);
+ }
}
// Socket address init
@@ -108,7 +126,7 @@
while (uiSize) {
- int32_t iAccessedSize = ::recv(_iSockFd, &pucData[uiOffset], uiSize, MSG_NOSIGNAL);
+ int32_t iAccessedSize = ::recv(_iSockFd, &pucData[uiOffset], uiSize, 0);
switch (iAccessedSize) {
case 0:
@@ -140,17 +158,19 @@
while (uiSize) {
- int32_t iAccessedSize = ::send(_iSockFd, &pucData[uiOffset], uiSize, MSG_NOSIGNAL);
+ int32_t iAccessedSize = ::send(_iSockFd, &pucData[uiOffset], uiSize, mSendFlag);
if (iAccessedSize == -1) {
- if (errno == ECONNRESET) {
- // Peer has disconnected
- _disconnected = true;
+ if (errno == EINTR) {
+ // The send system call was interrupted, try again
+ continue;
}
- // errno == EINTR => The send system call was interrupted, try again
- if (errno != EINTR) {
- return false;
- }
+
+ // An error occured, forget this socket
+ _disconnected = true;
+ close(_iSockFd);
+ _iSockFd = -1; // Avoid writing again on the same socket
+ return false;
} else {
uiSize -= iAccessedSize;
uiOffset += iAccessedSize;
diff --git a/remote-processor/Socket.h b/remote-processor/Socket.h
index 00bd8bc..8c3fb9f 100644
--- a/remote-processor/Socket.h
+++ b/remote-processor/Socket.h
@@ -108,4 +108,5 @@
* See hasPeerDisconnected for more details.
*/
bool _disconnected;
+ int mSendFlag;
};
diff --git a/remote-processor/remote-processor.dev b/remote-processor/remote-processor.dev
deleted file mode 100644
index 4860949..0000000
--- a/remote-processor/remote-processor.dev
+++ /dev/null
@@ -1,271 +0,0 @@
-[Project]
-FileName=remote-processor.dev
-Name=remote-processor
-UnitCount=19
-Type=3
-Ver=3
-IsCpp=1
-Folders=
-CommandLine=
-CompilerSettings=0000000000000000000000
-PchHead=-1
-PchSource=-1
-ProfilesCount=1
-ProfileIndex=0
-
-[Unit3]
-FileName=ConnectionSocket.cpp
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit4]
-FileName=ConnectionSocket.h
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit5]
-FileName=ListeningSocket.cpp
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit6]
-FileName=ListeningSocket.h
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit7]
-FileName=Message.cpp
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit8]
-FileName=Message.h
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit9]
-FileName=RemoteCommand.h
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit10]
-FileName=RemoteCommandHandler.h
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit11]
-FileName=RemoteProcessorProtocol.h
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit12]
-FileName=RemoteProcessorServer.cpp
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit13]
-FileName=RemoteProcessorServer.h
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit14]
-FileName=RemoteProcessorServerBuilder.cpp
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit15]
-FileName=RemoteProcessorServerInterface.h
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit16]
-FileName=RequestMessage.cpp
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit17]
-FileName=RequestMessage.h
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit18]
-FileName=Socket.cpp
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit19]
-FileName=Socket.h
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit20]
-FileName=Socket.h
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit21]
-FileName=Socket.h
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[VersionInfo]
-Major=0
-Minor=1
-Release=1
-Build=1
-LanguageID=1033
-CharsetID=1252
-CompanyName=
-FileVersion=
-FileDescription=Developed using the Dev-C++ IDE
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=
-AutoIncBuildNrOnRebuild=0
-AutoIncBuildNrOnCompile=0
-
-[Profile1]
-ProfileName=Default Profile
-Type=3
-ObjFiles=
-Includes=
-Libs=
-ResourceIncludes=
-MakeIncludes=
-Compiler=-DBUILDING_DLL=1_@@_
-CppCompiler=-DBUILDING_DLL=1 -O2_@@_
-Linker=
-PreprocDefines=
-CompilerSettings=0000000000000000000000
-Icon=
-ExeOutput=..\..\..\Windows\parameter-framework-build-windows
-ObjectOutput=..\..\..\Windows\parameter-framework-build-windows\intemediates
-OverrideOutput=0
-OverrideOutputName=remote-processor.dll
-HostApplication=
-CommandLine=
-UseCustomMakefile=0
-CustomMakefile=
-IncludeVersionInfo=0
-SupportXPThemes=0
-CompilerSet=0
-CompilerType=0
-
-[Unit2]
-FileName=AnswerMessage.h
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit1]
-FileName=AnswerMessage.cpp
-CompileCpp=1
-Folder=remote-processor
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
diff --git a/support/android/build_pfw_settings.mk b/support/android/build_pfw_settings.mk
index 482c56d..e51adfd 100644
--- a/support/android/build_pfw_settings.mk
+++ b/support/android/build_pfw_settings.mk
@@ -35,7 +35,8 @@
# As of Android K, python is available as prebuilt. We can't reliably use the
# host's default python because the low-level python binding has been compiled
# against Android's Python headers.
-$(LOCAL_BUILT_MODULE): MY_PYTHON := prebuilts/python/linux-x86/2.7.5/bin/python
+# BTW, python is only available in 32bits for now, thus arch is forced to 32bits
+$(LOCAL_BUILT_MODULE): MY_PYTHON := prebuilts/python/$(HOST_OS)-x86/2.7.5/bin/python
# The parameter-framework binding module is installed on these locations on
# Android (On 64bit machines, PyPfw.py is installed in the 'lib64' directory
# and _PyPfw.so is installed in the 'lib' directory, hence the need for these
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 0000000..8efd0d7
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,33 @@
+# Copyright (c) 2014-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+add_subdirectory(test-platform)
+add_subdirectory(test-fixed-point-parameter)
+add_subdirectory(tokenizer)
+add_subdirectory(functional-tests)
+add_subdirectory(test-subsystem)
diff --git a/test/functional-tests/ACTCampaignEngine.py b/test/functional-tests/ACTCampaignEngine.py
new file mode 100755
index 0000000..d4aeaf9
--- /dev/null
+++ b/test/functional-tests/ACTCampaignEngine.py
@@ -0,0 +1,94 @@
+#!/usr/bin/python2
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Create a test suite for all tests about SET/GET commands
+
+Uses PfwSetTsetSuite to create a single instance of the HAL
+for all the SET/GEt commands.
+
+These commands are tested using the methods of the classes
+"BooleanTestCase", etc...
+"""
+
+import sys
+import os
+import unittest
+import shutil
+from Util import PfwUnitTestLib
+
+class Logger(object):
+
+ def __init__(self, filename="Default.log"):
+ self.terminal = sys.stdout
+ self.log = open(filename, "a")
+
+ def write(self, message):
+ self.terminal.write(message)
+ self.log.write(message)
+
+def testsRunner(testDirectory):
+
+ tests = unittest.defaultTestLoader.discover(testDirectory, pattern='t*.py')
+ runner = unittest.TextTestRunner(verbosity=2)
+
+ return runner.run(tests).wasSuccessful()
+
+def main():
+
+ pfw_root = os.environ["PFW_ROOT"]
+ pfw_result = os.environ["PFW_RESULT"]
+ xml_path = "xml/configuration/ParameterFrameworkConfiguration.xml"
+
+ os.environ["PFW_TEST_TOOLS"] = os.path.dirname(os.path.abspath(__file__))
+ os.environ["PFW_TEST_CONFIGURATION"] = os.path.join(pfw_root, xml_path)
+
+ try:
+ # This directory must not exist. An exception will be raised if it does.
+ os.makedirs(pfw_result)
+
+ isAlive = os.path.join(pfw_result,"isAlive")
+ with open(isAlive, 'w') as fout:
+ fout.write('true')
+
+ needResync = os.path.join(pfw_result,"needResync")
+ with open(needResync, 'w') as fout:
+ fout.write('false')
+
+ success = testsRunner('PfwTestCase')
+
+ finally:
+ shutil.rmtree(pfw_result)
+
+ sys.exit(0 if success else 1)
+
+if __name__ == "__main__":
+ main()
diff --git a/test/functional-tests/CMakeLists.txt b/test/functional-tests/CMakeLists.txt
new file mode 100644
index 0000000..f1f8544
--- /dev/null
+++ b/test/functional-tests/CMakeLists.txt
@@ -0,0 +1,60 @@
+# Copyright (c) 2014-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+if (BUILD_TESTING)
+ find_program(python2 python2)
+
+ set(PFW_ROOT ${CMAKE_BINARY_DIR}/tmp/test-parameters)
+ set(PFW_RESULT ${PFW_ROOT}/result)
+
+ configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/xml/configuration/Structure/Test/TestSubsystem.xml.in
+ ${PFW_ROOT}/xml/configuration/Structure/Test/TestSubsystem.xml @ONLY)
+ configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/xml/configuration/Structure/Test/TestClass.xml
+ ${PFW_ROOT}/xml/configuration/Structure/Test/TestClass.xml
+ COPYONLY)
+ configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/xml/configuration/ParameterFrameworkConfiguration.xml
+ ${PFW_ROOT}/xml/configuration/ParameterFrameworkConfiguration.xml
+ COPYONLY)
+ configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/xml/configuration/Settings/Test/TestConfigurableDomains.xml
+ ${PFW_ROOT}/xml/configuration/Settings/Test/TestConfigurableDomains.xml
+ COPYONLY)
+
+ add_test(NAME functional-test
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMAND ${python2} ACTCampaignEngine.py)
+
+ # Custom function defined in the top-level CMakeLists
+ set_test_env(functional-test)
+ set_property(TEST functional-test APPEND PROPERTY ENVIRONMENT
+ PFW_ROOT=${PFW_ROOT}
+ PFW_RESULT=${PFW_RESULT})
+endif()
diff --git a/test/functional-tests/PfwTestCase/Domains/__init__.py b/test/functional-tests/PfwTestCase/Domains/__init__.py
new file mode 100644
index 0000000..e49f417
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Domains/__init__.py
@@ -0,0 +1,10 @@
+"""
+Domains Package : All testcases about DOMAINS functions in PFW :
+ - domains configuration selections and restore
+ - domains creation and deletion
+ - domain rename
+ - rules management
+ - elements management
+ - elements sequences in domains
+ - domains split
+"""
\ No newline at end of file
diff --git a/test/functional-tests/PfwTestCase/Domains/tDomain_Configuration.py b/test/functional-tests/PfwTestCase/Domains/tDomain_Configuration.py
new file mode 100644
index 0000000..e5fcfed
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Domains/tDomain_Configuration.py
@@ -0,0 +1,505 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Creation, renaming and deletion configuration testcases
+
+List of tested functions :
+--------------------------
+ - [listConfigurations] function
+ - [createConfiguration] function
+ - [deleteConfiguration] function
+ - [renameConfiguration] function
+
+Test cases :
+------------
+ - Testing configuration creation error
+ - Testing configuration renaming error
+ - Testing configuration deletion error
+ - Testing nominal case
+"""
+import os
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+
+# Test of Domains - Rename
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.pfw.sendCmd("setTuningMode", "on")
+ self.domain_name = "domain_test"
+ self.conf_test = "conf_white"
+ self.conf_test_renamed = "conf_black"
+ self.new_conf_number = 5
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Conf_Creation_Error(self):
+ """
+ Testing configuration creation error
+ ------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Create an already existent configuration
+ - Create a configuration with no name specified
+ - Create a configuration on a wrong domain name
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [createConfiguration] function
+ - [createDomain] function
+ - [listConfigurations] function
+ - [deleteConfiguration] function
+ - [deleteDomain] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - no configuration created
+ - existent configurations not affected by error
+ """
+ log.D(self.test_Conf_Creation_Error.__doc__)
+ # New domain creation for testing purpose
+ log.I("New domain creation for testing purpose : %s" % (self.domain_name))
+ log.I("command [createDomain]")
+ out, err = self.pfw.sendCmd("createDomain",self.domain_name, "")
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createDomain] - Error while creating domain %s" % (self.domain_name)
+ log.I("command [createDomain] correctly executed")
+ log.I("Domain %s created" % (self.domain_name))
+
+ # New configurations creation for testing purpose
+ for iteration in range (self.new_conf_number):
+ new_conf_name = "".join([self.conf_test, "_", str(iteration)])
+ log.I("New configuration %s creation for domain %s" % (new_conf_name,self.domain_name))
+ log.I("command [createConfiguration]")
+ out, err = self.pfw.sendCmd("createConfiguration",self.domain_name,new_conf_name)
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration %s" % (new_conf_name)
+ log.I("command [createConfiguration] correctly executed")
+ log.I("Configuration %s created for domain %s" % (new_conf_name,self.domain_name))
+
+ # Domain configurations listing backup
+ log.I("Configurations listing for domain %s" % (self.domain_name))
+ log.I("command [listConfigurations]")
+ out, err = self.pfw.sendCmd("listConfigurations",self.domain_name, "")
+ assert err == None, "ERROR : command [listConfigurations] - Error while listing configurations for domain %s" % (self.domain_name)
+ log.I("command [listConfigurations] correctly executed")
+ # Saving configurations names
+ f_configurations_backup = open("f_configurations_backup", "w")
+ f_configurations_backup.write(out)
+ f_configurations_backup.close()
+
+ # New configurations creation error
+ log.I("Creating an already existent configurations names")
+ for iteration in range (self.new_conf_number):
+ new_conf_name = "".join([self.conf_test, "_", str(iteration)])
+ log.I("Trying to create already existent %s configuration for domain %s" % (new_conf_name,self.domain_name))
+ log.I("command [createConfiguration]")
+ out, err = self.pfw.sendCmd("createConfiguration",self.domain_name,new_conf_name)
+ assert out != "Done", "ERROR : command [createConfiguration] - Error not detected while creating already existent configuration %s" % (new_conf_name)
+ assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration %s" % (new_conf_name)
+ log.I("command [createConfiguration] correctly executed")
+ log.I("error correctly detected, no configuration created")
+ log.I("Creating a configuration without specifying a name")
+ out, err = self.pfw.sendCmd("createConfiguration",self.domain_name)
+ assert out != "Done", "ERROR : command [createConfiguration] - Error not detected while creating a configuration without specifying a name"
+ assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration"
+ log.I("error correctly detected")
+ log.I("Creating a configuration on a wrong domain name")
+ new_conf_name = "new_conf"
+ out, err = self.pfw.sendCmd("createConfiguration","wrong_domain_name",new_conf_name)
+ assert out != "Done", "ERROR : command [createConfiguration] - Error not detected while creating a configuration on a wrong domain name"
+ assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration"
+ log.I("error correctly detected")
+
+ # New domain configurations listing
+ log.I("Configurations listing for domain %s" % (self.domain_name))
+ log.I("command [listConfigurations]" )
+ out, err = self.pfw.sendCmd("listConfigurations",self.domain_name, "")
+ assert err == None, "ERROR : command [listConfigurations] - Error while listing configurations for domain %s" % (self.domain_name)
+ log.I("command [listConfigurations] correctly executed")
+ # Saving configurations names
+ f_configurations = open("f_configurations", "w")
+ f_configurations.write(out)
+ f_configurations.close()
+
+ # Checking configurations names integrity
+ log.I("Configurations listing conformity check")
+ f_configurations = open("f_configurations", "r")
+ f_configurations_backup = open("f_configurations_backup", "r")
+ for iteration in range(self.new_conf_number):
+ listed_conf_backup = f_configurations_backup.readline().strip('\n')
+ listed_conf = f_configurations.readline().strip('\n')
+ assert listed_conf==listed_conf_backup, "ERROR : Error while listing configuration %s (found %s)" % (listed_conf_backup, listed_conf)
+ log.I("No change detected, listed configurations names conform to expected values")
+
+ # New domain deletion
+ log.I("End of test, new domain deletion")
+ log.I("command [deleteDomain]")
+ out, err = self.pfw.sendCmd("deleteDomain",self.domain_name, "")
+ assert out == "Done", "ERROR : %s" % (out)
+ assert err == None, "ERROR : command [deleteDomain] - Error while deleting domain %s" % (self.domain_name)
+ log.I("command [deleteDomain] correctly executed")
+
+ # Closing and deleting temp files
+ f_configurations_backup.close()
+ os.remove("f_configurations_backup")
+ f_configurations.close()
+ os.remove("f_configurations")
+
+ def test_Conf_Renaming_Error(self):
+ """
+ Testing configuration renaming error
+ ------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Rename a configuration with an already used name
+ - Rename a configuration with no name specified
+ - Rename a configuration on a wrong domain name
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [renameConfiguration] function
+ - [createDomain] function
+ - [listConfigurations] function
+ - [createConfiguration] function
+ - [deleteConfiguration] function
+ - [deleteDomain] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - no configuration created
+ - existent configurations not affected by error
+ """
+ log.D(self.test_Conf_Renaming_Error.__doc__)
+ # New domain creation for testing purpose
+ log.I("New domain creation for testing purpose : %s" % (self.domain_name))
+ log.I("command [createDomain]")
+ out, err = self.pfw.sendCmd("createDomain",self.domain_name, "")
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createDomain] - Error while creating domain %s" % (self.domain_name)
+ log.I("command [createDomain] correctly executed")
+ log.I("Domain %s created" % (self.domain_name))
+
+ # New configurations creation for testing purpose
+ for iteration in range (self.new_conf_number):
+ new_conf_name = "".join([self.conf_test, "_", str(iteration)])
+ log.I("New configuration %s creation for domain %s" % (new_conf_name,self.domain_name))
+ log.I("command [createConfiguration]")
+ out, err = self.pfw.sendCmd("createConfiguration",self.domain_name,new_conf_name)
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration %s" % (new_conf_name)
+ log.I("command [createConfiguration] correctly executed")
+ log.I("Configuration %s created for domain %s" % (new_conf_name,self.domain_name))
+
+ # Domain configurations listing backup
+ log.I("Configurations listing for domain %s" % (self.domain_name))
+ log.I("command [listConfigurations]")
+ out, err = self.pfw.sendCmd("listConfigurations",self.domain_name, "")
+ assert err == None, "ERROR : command [listConfigurations] - Error while listing configurations for domain %s" % (self.domain_name)
+ log.I("command [listConfigurations] correctly executed")
+ # Saving configurations names
+ f_configurations_backup = open("f_configurations_backup", "w")
+ f_configurations_backup.write(out)
+ f_configurations_backup.close()
+
+ # New configurations renaming error
+ log.I("renaming a configuration with an already used name")
+ for iteration in range (self.new_conf_number-1):
+ conf_name = "".join([self.conf_test, "_", str(iteration)])
+ new_conf_name = "".join([self.conf_test, "_", str(iteration+1)])
+ log.I("Trying to rename %s on domain %s with an already used name : %s" % (conf_name,self.domain_name,new_conf_name))
+ log.I("command [renameConfiguration]" )
+ out, err = self.pfw.sendCmd("renameConfiguration",self.domain_name,conf_name,new_conf_name)
+ assert out != "Done", "ERROR : command [renameConfiguration] - Error not detected while renaming configuration %s with an already used name" % (new_conf_name)
+ assert err == None, "ERROR : command [renameConfiguration] - Error while renaming configuration %s" % (new_conf_name)
+ log.I("command [renameConfiguration] correctly executed")
+ log.I("error correctly detected, no configuration renamed")
+ log.I("renaming a configuration without specifying a new name")
+ out, err = self.pfw.sendCmd("renameConfiguration",self.domain_name,new_conf_name)
+ assert out != "Done", "ERROR : command [renameConfiguration] - Error not detected while renaming a configuration without specifying a new name"
+ assert err == None, "ERROR : command [renameConfiguration] - Error while renaming configuration"
+ log.I("error correctly detected, no configuration renamed")
+ log.I("renaming a configuration on a wrong domain name")
+ new_conf_name = "new_conf"
+ out, err = self.pfw.sendCmd("renameConfiguration","wrong_domain_name",new_conf_name,"Configuration")
+ assert out != "Done", "ERROR : command [renameConfiguration] - Error not detected while renaming a configuration on a wrong domain name"
+ assert err == None, "ERROR : command [renameConfiguration] - Error while renaming configuration"
+ log.I("error correctly detected, no configuration renamed")
+
+ # New domain configurations listing
+ log.I("Configurations listing for domain %s" % (self.domain_name))
+ log.I("command [listConfigurations]")
+ out, err = self.pfw.sendCmd("listConfigurations",self.domain_name, "")
+ assert err == None, "ERROR : command [listConfigurations] - Error while listing configurations for domain %s" % (self.domain_name)
+ log.I("command [listConfigurations] correctly executed")
+ # Saving configurations names
+ f_configurations = open("f_configurations", "w")
+ f_configurations.write(out)
+ f_configurations.close()
+
+ # Checking configurations names integrity
+ log.I("Configurations listing conformity check")
+ f_configurations = open("f_configurations", "r")
+ f_configurations_backup = open("f_configurations_backup", "r")
+ for iteration in range(self.new_conf_number):
+ listed_conf_backup = f_configurations_backup.readline().strip('\n')
+ listed_conf = f_configurations.readline().strip('\n')
+ assert listed_conf==listed_conf_backup, "ERROR : Error while listing configuration %s (found %s)" % (listed_conf_backup, listed_conf)
+ log.I("No change detected, listed configurations names conform to expected values")
+
+ # Testing domain deletion
+ log.I("End of test, new domain deletion")
+ log.I("command [deleteDomain]")
+ out, err = self.pfw.sendCmd("deleteDomain",self.domain_name, "")
+ assert out == "Done", "ERROR : %s" % (out)
+ assert err == None, "ERROR : command [deleteDomain] - Error while deleting domain %s" % (self.domain_name)
+ log.I("command [deleteDomain] correctly executed")
+
+ # Closing and deleting temp files
+ f_configurations_backup.close()
+ os.remove("f_configurations_backup")
+ f_configurations.close()
+ os.remove("f_configurations")
+
+ def test_Conf_Deletion_Error(self):
+ """
+ Testing configuration deletion error
+ ------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Delete a configuration with a non existent name
+ - Delete a configuration with no name specified
+ - Delete a configuration on a wrong domain name
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [deleteConfiguration] function
+ - [createDomain] function
+ - [listConfigurations] function
+ - [createConfiguration] function
+ - [deleteDomain] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - no configuration created
+ - existent configurations not affected by error
+ """
+ print self.test_Conf_Renaming_Error.__doc__
+ # New domain creation for testing purpose
+ log.I("New domain creation for testing purpose : %s" % (self.domain_name))
+ log.I("command [createDomain]")
+ out, err = self.pfw.sendCmd("createDomain",self.domain_name, "")
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createDomain] - Error while creating domain %s" % (self.domain_name)
+ log.I("command [createDomain] correctly executed")
+ log.I("Domain %s created" % (self.domain_name))
+
+ # New configurations creation for testing purpose
+ for iteration in range (self.new_conf_number):
+ new_conf_name = "".join([self.conf_test, "_", str(iteration)])
+ log.I("New configuration %s creation for domain %s" % (new_conf_name,self.domain_name))
+ log.I("command [createConfiguration]")
+ out, err = self.pfw.sendCmd("createConfiguration",self.domain_name,new_conf_name)
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration %s" % (new_conf_name)
+ log.I("command [createConfiguration] correctly executed")
+ log.I("Configuration %s created for domain %s" % (new_conf_name,self.domain_name))
+
+ # Domain configurations listing backup
+ log.I("Configurations listing for domain %s" % (self.domain_name))
+ log.I("command [listConfigurations]")
+ out, err = self.pfw.sendCmd("listConfigurations",self.domain_name, "")
+ assert err == None, "ERROR : command [listConfigurations] - Error while listing configurations for domain %s" % (self.domain_name)
+ log.I("command [listConfigurations] correctly executed")
+ # Saving configurations names
+ f_configurations_backup = open("f_configurations_backup", "w")
+ f_configurations_backup.write(out)
+ f_configurations_backup.close()
+
+ # Configurations deletion errors
+ log.I("Trying various deletions error test cases")
+ log.I("Trying to delete a wrong configuration name on domain %s" % (self.domain_name))
+ log.I("command [deleteConfiguration]")
+ out, err = self.pfw.sendCmd("deleteConfiguration",self.domain_name,"wrong_configuration_name")
+ assert out != "Done", "ERROR : command [deleteConfiguration] - Error not detected while deleting non existent configuration name"
+ assert err == None, "ERROR : command [deleteConfiguration] - Error while deleting configuration"
+ log.I("command [deleteConfiguration] correctly executed")
+ log.I("error correctly detected, no configuration deleted")
+ log.I("deleting a configuration with no name specified")
+ out, err = self.pfw.sendCmd("deleteConfiguration",self.domain_name)
+ assert out != "Done", "ERROR : command [deleteConfiguration] - Error not detected while deleting a configuration without specifying a name"
+ assert err == None, "ERROR : command [deleteConfiguration] - Error while deleting configuration"
+ log.I("error correctly detected, no configuration deleted")
+ log.I("deleting a configuration on a wrong domain name")
+ out, err = self.pfw.sendCmd("deleteConfiguration","wrong_domain_name",new_conf_name)
+ assert out != "Done", "ERROR : command [deleteConfiguration] - Error not detected while deleting a configuration on a wrong domain name"
+ assert err == None, "ERROR : command [deleteConfiguration] - Error while deleting configuration"
+ log.I("error correctly detected, no configuration deleted")
+
+ # New domain configurations listing
+ log.I("Configurations listing for domain %s" % (self.domain_name))
+ log.I("command [listConfigurations]")
+ out, err = self.pfw.sendCmd("listConfigurations",self.domain_name, "")
+ assert err == None, "ERROR : command [listConfigurations] - Error while listing configurations for domain %s" % (self.domain_name)
+ log.I("command [listConfigurations] correctly executed")
+ # Saving configurations names
+ f_configurations = open("f_configurations", "w")
+ f_configurations.write(out)
+ f_configurations.close()
+
+ # Checking configurations names integrity
+ log.I("Configurations listing conformity check")
+ f_configurations = open("f_configurations", "r")
+ f_configurations_backup = open("f_configurations_backup", "r")
+ for iteration in range(self.new_conf_number):
+ listed_conf_backup = f_configurations_backup.readline().strip('\n')
+ listed_conf = f_configurations.readline().strip('\n')
+ assert listed_conf==listed_conf_backup, "ERROR : Error while listing configuration %s (found %s)" % (listed_conf_backup, listed_conf)
+ log.I("No change detected, listed configurations names conform to expected values")
+
+ # Testing domain deletion
+ log.I("End of test, new domain deletion")
+ log.I("command [deleteDomain]")
+ out, err = self.pfw.sendCmd("deleteDomain",self.domain_name, "")
+ assert out == "Done", "ERROR : %s" % (out)
+ assert err == None, "ERROR : command [deleteDomain] - Error while deleting domain %s" % (self.domain_name)
+ log.I("command [deleteDomain] correctly executed")
+
+ # Closing and deleting temp files
+ f_configurations_backup.close()
+ os.remove("f_configurations_backup")
+ f_configurations.close()
+ os.remove("f_configurations")
+
+ def test_Nominal_Case(self):
+ """
+ Testing nominal cases
+ ---------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Create new configurations
+ - List domain configurations
+ - Rename configurations
+ - Delete configurations
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [listConfigurations] function
+ - [createConfiguration] function
+ - [renameConfiguration] function
+ - [deleteConfiguration] function
+ - [createDomain] function
+ - [deleteDomain] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - all operations succeed
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ # New domain creation
+ log.I("New domain creation for testing purpose : %s" % (self.domain_name))
+ log.I("command [createDomain]")
+ out, err = self.pfw.sendCmd("createDomain",self.domain_name, "")
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createDomain] - Error while creating domain %s" % (self.domain_name)
+ log.I("command [createDomain] correctly executed")
+ log.I("Domain %s created" % (self.domain_name))
+
+ # New configurations creation
+ for iteration in range (self.new_conf_number):
+ new_conf_name = "".join([self.conf_test, "_", str(iteration)])
+ log.I("New configuration %s creation for domain %s" % (new_conf_name,self.domain_name))
+ log.I("command [createConfiguration]" )
+ out, err = self.pfw.sendCmd("createConfiguration",self.domain_name,new_conf_name)
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration %s" % (new_conf_name)
+ log.I("command [createConfiguration] correctly executed")
+ log.I("Configuration %s created for domain %s" % (new_conf_name,self.domain_name))
+
+ # Listing domain configurations
+ log.I("Configurations listing for domain %s" % (self.domain_name))
+ log.I("command [listConfigurations]")
+ out, err = self.pfw.sendCmd("listConfigurations",self.domain_name, "")
+ assert err == None, "ERROR : command [listConfigurations] - Error while listing configurations for domain %s" % (self.domain_name)
+ log.I("command [listConfigurations] correctly executed")
+ # Saving configurations names
+ f_configurations = open("f_configurations", "w")
+ f_configurations.write(out)
+ f_configurations.close()
+ # Checking configurations names integrity
+ log.I("Configurations listing conformity check")
+ f_configurations = open("f_configurations", "r")
+ for iteration in range(self.new_conf_number):
+ new_conf_name = "".join([self.conf_test, "_", str(iteration)])
+ listed_conf = f_configurations.readline().strip('\n')
+ assert listed_conf==new_conf_name, "ERROR : Error while listing configuration %s (found %s)" % (listed_conf, new_conf_name)
+ log.I("Listed configurations names conform to expected values")
+
+ # Configuration renaming
+ log.I("Configurations renaming")
+ for iteration in range (self.new_conf_number):
+ conf_name = "".join([self.conf_test, "_", str(iteration)])
+ new_conf_name = "".join([self.conf_test_renamed, "_", str(iteration)])
+ log.I("Configuration %s renamed to %s in domain %s" % (conf_name,new_conf_name,self.domain_name))
+ log.I("command [renameConfiguration]")
+ out, err = self.pfw.sendCmd("renameConfiguration",self.domain_name,conf_name,new_conf_name)
+ assert out == "Done", out
+ assert err == None, "ERROR : command [renameConfiguration] - Error while renaming configuration %s to %s" % (conf_name,new_conf_name)
+ log.I("command [renameConfiguration] correctly executed")
+ log.I("Configuration %s renamed to %s for domain %s" % (conf_name,new_conf_name,self.domain_name))
+ # Listing domain configurations
+ log.I("Configurations listing to check configurations renaming")
+ log.I("command [listConfigurations]")
+ out, err = self.pfw.sendCmd("listConfigurations",self.domain_name, "")
+ assert err == None, "ERROR : command [listConfigurations] - Error while listing configurations for domain %s" % (self.domain_name)
+ log.I("command [listConfigurations] correctly executed")
+ # Saving configurations names
+ f_configurations_renamed = open("f_configurations_renamed", "w")
+ f_configurations_renamed.write(out)
+ f_configurations_renamed.close()
+ # Checking configurations names integrity
+ log.I("Configurations listing conformity check")
+ f_configurations_renamed = open("f_configurations_renamed", "r")
+ for iteration in range(self.new_conf_number):
+ new_conf_name = "".join([self.conf_test_renamed, "_", str(iteration)])
+ listed_conf = f_configurations_renamed.readline().strip('\n')
+ assert listed_conf==new_conf_name, "ERROR : Error while renaming configuration %s (found %s)" % (new_conf_name,listed_conf)
+ log.I("Listed configurations names conform to expected values, renaming successfull")
+
+ # New domain deletion
+ log.I("End of test, new domain deletion")
+ log.I("command [deleteDomain]")
+ out, err = self.pfw.sendCmd("deleteDomain",self.domain_name, "")
+ assert out == "Done", "ERROR : %s" % (out)
+ assert err == None, "ERROR : command [deleteDomain] - Error while deleting domain %s" % (self.domain_name)
+ log.I("command [deleteDomain] correctly executed")
+
+ # Closing and deleting temp file
+ f_configurations.close()
+ os.remove("f_configurations")
+ f_configurations_renamed.close()
+ os.remove("f_configurations_renamed")
diff --git a/test/functional-tests/PfwTestCase/Domains/tDomain_Configuration_Backup.py b/test/functional-tests/PfwTestCase/Domains/tDomain_Configuration_Backup.py
new file mode 100644
index 0000000..51d3d2b
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Domains/tDomain_Configuration_Backup.py
@@ -0,0 +1,239 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Save and restore configuration testcases
+
+List of tested functions :
+--------------------------
+ - [saveConfiguration] function
+ - [restoreConfiguration] function
+
+Test cases :
+------------
+ - Testing nominal case
+ - Testing saveConfiguration errors
+ - Testing restoreConfiguration errors
+"""
+
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of Domains - save/restore configuration
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.pfw.sendCmd("setTuningMode", "on")
+ self.domain_name = "Domain_0"
+ self.conf_1 = "Conf_0"
+ self.conf_2 = "Conf_1"
+ self.param_name = "/Test/Test/TEST_DIR/INT8"
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing nominal case
+ --------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - save a configuration
+ - restore a configuration
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [saveConfiguration] function
+ - [restoreConfiguration] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - all operations succeed
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+
+ # Saving original parameter value
+ log.I("restoring configuration %s from domain %s" % (self.conf_1, self.domain_name))
+ out, err = self.pfw.sendCmd("restoreConfiguration", self.domain_name, self.conf_1)
+ assert err == None, "Error when restoring configuration %s from domain %s : %s" % (self.conf_1, self.domain_name, err)
+ assert out == "Done", out
+ out, err = self.pfw.sendCmd("getParameter", self.param_name)
+ assert err == None, "Error when getting parameter %s : %s" % (self.param_name, err)
+ Param_saved_1 = int(out)
+ log.I("saved parameter %s value on %s from domain %s = %s" % (self.param_name, self.conf_1, self.domain_name, Param_saved_1))
+
+ # Modifying parameter value
+ log.I("modifying parameter %s value on configuration %s from domain %s" % (self.param_name, self.conf_1, self.domain_name))
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, str(Param_saved_1+1))
+ assert err == None, "Error when setting parameter %s : %s" % (self.param_name, err)
+ log.I("new parameter %s value = %s in place of %s" % (self.param_name, str(Param_saved_1+1), Param_saved_1))
+
+ # Saving new parameter value
+ log.I("saving configuration %s from domain %s" % (self.conf_1, self.domain_name))
+ out, err = self.pfw.sendCmd("saveConfiguration", self.domain_name, self.conf_1)
+ assert err == None, "Error when saving configuration %s from domain %s : %s" % (self.conf_1, self.domain_name, err)
+ assert out == "Done", out
+ out, err = self.pfw.sendCmd("getParameter", self.param_name)
+ assert err == None, "Error when getting parameter %s : %s" % (self.param_name, err)
+ Param_saved_1 = int(out)
+ log.I("new saved parameter %s value on %s from domain %s = %s" % (self.param_name, self.conf_1, self.domain_name, Param_saved_1))
+
+ # Modifying and restoring parameter value
+ log.I("modifying parameter %s value on configuration %s from domain %s" % (self.param_name, self.conf_1, self.domain_name))
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, str(Param_saved_1+1))
+ assert err == None, "Error when setting parameter %s : %s" % (self.param_name, err)
+ out, err = self.pfw.sendCmd("getParameter", self.param_name)
+ assert err == None, "Error when getting parameter %s : %s" % (self.param_name, err)
+ Param_saved_2 = int(out)
+ log.I("new parameter %s value on %s = %s in place of %s" % (self.param_name, self.conf_1, str(Param_saved_2), Param_saved_1))
+ log.I("restoring configuration %s from domain %s" % (self.conf_1, self.domain_name))
+ out, err = self.pfw.sendCmd("restoreConfiguration", self.domain_name, self.conf_1)
+ assert err == None, "Error when restoring configuration %s from domain %s : %s" % (self.conf_1, self.domain_name, err)
+ assert out == "Done", out
+ out, err = self.pfw.sendCmd("getParameter", self.param_name)
+ assert err == None, "Error when getting parameter %s : %s" % (self.param_name, err)
+ Param_saved_2 = int(out)
+ assert Param_saved_2 == Param_saved_1, "Error when restoring configuration %s from domain %s" % (self.conf_1, self.domain_name)
+ log.I("saving and restoring configuration works fine")
+
+ def test_Save_Config_Error(self):
+ """
+ Testing saveConfiguration error
+ -------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - save a configuration with a missing argument
+ - save a configuration with a wrong domain name
+ - save a configuration with a wrong configuration name
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [saveConfiguration] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - errors correctly detected
+ """
+ log.D(self.test_Save_Config_Error.__doc__)
+ # Saving original parameter value and setting a new value to parameter for testing purpose
+ log.I("restoring configuration %s from domain %s" % (self.conf_1, self.domain_name))
+ out, err = self.pfw.sendCmd("restoreConfiguration", self.domain_name, self.conf_1)
+ assert err == None, "Error when restoring configuration %s from domain %s : %s" % (self.conf_1, self.domain_name, err)
+ assert out == "Done", out
+ out, err = self.pfw.sendCmd("getParameter", self.param_name)
+ assert err == None, "Error when getting parameter %s : %s" % (self.param_name, err)
+ Param_saved_1 = int(out)
+ log.I("saved parameter %s value on %s from domain %s = %s" % (self.param_name, self.conf_1, self.domain_name, Param_saved_1))
+ log.I("modifying parameter %s value on configuration %s from domain %s" % (self.param_name, self.conf_1, self.domain_name))
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, str(Param_saved_1+1))
+ assert err == None, "Error when setting parameter %s : %s" % (self.param_name, err)
+ log.I("new parameter %s value = %s in place of %s" % (self.param_name, str(Param_saved_1+1), Param_saved_1))
+
+ # Configuration saving errors
+ log.I("saving configuration error test cases :")
+ log.I("saving configuration with a missing argument")
+ out, err = self.pfw.sendCmd("saveConfiguration", self.domain_name)
+ assert err == None, "ERROR : Error when saving configuration with a missing argument"
+ assert out != "Done", "ERROR : Error not detected when saving configuration with a missing argument"
+ log.I("saving configuration with a wrong domain name")
+ out, err = self.pfw.sendCmd("saveConfiguration", "Wrong_Domain_Name", self.conf_1)
+ assert err == None, "ERROR : Error when saving configuration with a wrong domain name"
+ assert out != "Done", "ERROR : Error not detected when saving configuration with a wrong domain name"
+ log.I("saving configuration with a wrong configuration name")
+ out, err = self.pfw.sendCmd("saveConfiguration", self.domain_name, "Wrong_Configuration_Name")
+ assert err == None, "ERROR : Error when saving configuration with a wrong configuration name"
+ assert out != "Done", "ERROR : Error not detected when saving configuration with a wrong configuration name"
+ log.I("saving configuration error test cases : errors correctly detected")
+
+ # Checking that no error has affected original configuration save
+ log.I("restoring configuration %s from domain %s" % (self.conf_1, self.domain_name))
+ out, err = self.pfw.sendCmd("restoreConfiguration", self.domain_name, self.conf_1)
+ assert err == None, "error when restoring configuration %s from domain %s : %s" % (self.conf_1, self.domain_name, err)
+ assert out == "Done", out
+ out, err = self.pfw.sendCmd("getParameter", self.param_name)
+ assert err == None, "error when getting parameter %s : %s" % (self.param_name, err)
+ Param_saved_2 = int(out)
+ assert Param_saved_2 == Param_saved_1, "error when restoring configuration %s from domain %s, parameter %s affected by configuration saving error" % (self.conf_1, self.domain_name, Param_saved_1)
+ log.I("Test passed : saving errors correctly detected, no impact on previously saved configuration")
+
+ def test_Restore_Config_Error(self):
+ """
+ Testing restoreConfiguration error
+ ----------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - restore a configuration with a missing argument
+ - restore a configuration with a wrong domain name
+ - restore a configuration with a wrong configuration name
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [restoreConfiguration] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - errors correctly detected
+ - configuration's parameters not affected by errors
+ """
+
+ log.D(self.test_Restore_Config_Error.__doc__)
+ # Saving original parameter value and setting a new value to parameter for testing purpose
+ log.I("restore configuration %s from domain %s" % (self.conf_1, self.domain_name))
+ out, err = self.pfw.sendCmd("restoreConfiguration", self.domain_name, self.conf_1)
+ assert err == None, "Error when restoring configuration %s from domain %s : %s" % (self.conf_1, self.domain_name, err)
+ assert out == "Done", out
+ out, err = self.pfw.sendCmd("getParameter", self.param_name)
+ assert err == None, "Error when getting parameter %s : %s" % (self.param_name, err)
+ Param_saved_1 = int(out)
+ log.I("saved parameter %s value on %s from domain %s = %s" % (self.param_name, self.conf_1, self.domain_name, Param_saved_1))
+ log.I("modifying parameter %s value on configuration %s from domain %s" % (self.param_name, self.conf_1, self.domain_name))
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, str(Param_saved_1+1))
+ assert err == None, "Error when setting parameter %s : %s" % (self.param_name, err)
+ log.I("new parameter %s value = %s in place of %s" % (self.param_name, str(Param_saved_1+1), Param_saved_1))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name)
+ assert err == None, "Error when getting parameter %s : %s" % (self.param_name, err)
+ Param_saved_2 = int(out)
+
+ # Configuration restore errors
+ log.I("restoring configuration error test cases :")
+ log.I("restoring configuration with a missing argument")
+ out, err = self.pfw.sendCmd("restoreConfiguration", self.domain_name)
+ assert err == None, "ERROR : Error when restoring configuration with a missing argument"
+ assert out != "Done", "ERROR : Error not detected when restoring configuration with a missing argument"
+ log.I("restoring configuration with a wrong domain name")
+ out, err = self.pfw.sendCmd("restoreConfiguration", "Wrong_Domain_Name", self.conf_1)
+ assert err == None, "ERROR : Error when restoring configuration with a wrong domain name"
+ assert out != "Done", "ERROR : Error not detected when restoring configuration with a wrong domain name"
+ log.I("restoring configuration with a wrong configuration name")
+ out, err = self.pfw.sendCmd("restoreConfiguration", self.domain_name, "Wrong_Configuration_Name")
+ assert err == None, "ERROR : Error when restoring configuration with a wrong configuration name"
+ assert out != "Done", "ERROR : Error not detected when restoring configuration with a wrong configuration name"
+ log.I("restoring configuration error test cases : errors correctly detected")
+
+ # Checking that no error has affected configuration's parameter value
+ out, err = self.pfw.sendCmd("getParameter", self.param_name)
+ assert err == None, "error when getting parameter %s : %s" % (self.param_name, err)
+ Param_saved_1 = int(out)
+ assert Param_saved_2 == Param_saved_1, "error when restoring configuration %s from domain %s, parameter %s affected by configuration restoration error" % (self.conf_1, self.domain_name, Param_saved_1)
+ log.I("Test passed : restoring errors correctly detected, no impact on previously modified configuration's parameter")
diff --git a/test/functional-tests/PfwTestCase/Domains/tDomain_Configuration_Selection.py b/test/functional-tests/PfwTestCase/Domains/tDomain_Configuration_Selection.py
new file mode 100644
index 0000000..86739ac
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Domains/tDomain_Configuration_Selection.py
@@ -0,0 +1,185 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Effect of criteria changes on configuration testcases
+
+List of tested functions :
+--------------------------
+ - [applyConfigurations] function
+ - [setCriterionState] function
+
+Test cases :
+------------
+ - test_Combinatorial_Criteria
+"""
+import os
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+class TestCases(PfwTestCase):
+
+ def setUp(self):
+ self.pfw.sendCmd("setTuningMode", "on")
+ self.reference_xml = "$PFW_TEST_TOOLS/xml/XML_Test/Reference_Criteria.xml"
+ self.temp_domain="f_Domains_Backup"
+ self.temp_status="f_Config_Status"
+ # Expected results are defined by Reference_Criteria.xml configuration settings
+ self.expected_result = [["Conf_1_1", "<none>", "Conf_3_0"] ,
+ ["Conf_1_1", "Conf_2_1", "Conf_3_1"] ,
+ ["Conf_1_1", "Conf_2_1", "Conf_3_0"] ,
+ ["Conf_1_1", "Conf_2_0", "Conf_3_0"] ,
+ ["Conf_1_0", "Conf_2_0", "Conf_3_0"] ,
+ ["Conf_1_1", "Conf_2_0", "Conf_3_0"] ,
+ ["Conf_1_1", "Conf_2_0", "Conf_3_1"]]
+ self.criterion_setup = [["0x2", "1"] ,
+ ["0x2", "0"] ,
+ ["0x1", "0"] ,
+ ["0x1", "1"] ,
+ ["0x3", "4"] ,
+ ["0x0", "1"]]
+ # names used in this test refer to names used in Reference_Criteria.xml
+ self.new_domain_name = "Domain"
+ self.crit_change_iteration = 6
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Combinatorial_Criteria(self):
+ """
+ Testing combinatorial criteria
+ ------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ Checking that PFW behaviour is in line with expectations when setting criteria states.
+ - Test of all combinatorial of criteria and possible errors
+ - nominal case in configuration selection
+ - conflict in configuration selection
+ - no configuration selected
+ - error in criterion setting
+ - test of compound rules : All / Any
+ - test of matches cases : Is / IsNot / Include / Exclude
+ - test of criteria types : Inclusive / Exclusive
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [applyConfigurations] function
+ - [setCriterionState] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - Configurations setting conform to expected behavior
+ """
+ log.D(self.test_Combinatorial_Criteria.__doc__)
+
+ # Import a reference XML file
+ log.I("Import Domains with settings from %s"%(self.reference_xml))
+ out, err = self.pfw.sendCmd("importDomainsWithSettingsXML",self.reference_xml, "")
+ assert err == None, log.E("Command [importDomainsWithSettingsXML %s] : %s"%(self.reference_xml,err))
+ assert out == "Done", log.F("When using function importDomainsWithSettingsXML %s]"%(self.reference_xml))
+
+ # Check number of domain
+ log.I("Current domains listing")
+ log.I("Command [listDomains]")
+ out, err = self.pfw.sendCmd("listDomains","","")
+ assert err == None, log.E("Command [listDomains] : %s"%(err))
+ log.I("Command [listDomains] : correctly executed")
+
+ # Domains listing backup
+ f_Domains_Backup = open(self.temp_domain, "w")
+ f_Domains_Backup.write(out)
+ f_Domains_Backup.close()
+ f_Domains_Backup = open(self.temp_domain, "r")
+ domains_nbr = 0
+ line=f_Domains_Backup.readline()
+ while line!="":
+ line=f_Domains_Backup.readline()
+ domains_nbr+=1
+ f_Domains_Backup.close()
+
+ # Applying default configurations
+ out, err = self.pfw.sendCmd("setTuningMode", "off")
+ assert err == None, log.E("Command [setTuningMode]")
+ out, err = self.hal.sendCmd("applyConfigurations")
+ assert err == None, log.E("Command HAL [applyConfigurations]")
+
+ # Saving default status
+ out, err = self.pfw.sendCmd("status")
+ f_Config_Status = open(self.temp_status, "w")
+ f_Config_Status.write(out)
+ f_Config_Status.close()
+
+ # Test cases iterations
+ for iteration in range (self.crit_change_iteration+1):
+
+ # Criteria settings
+ # No criteria are set at the first iteration for testing default configurations
+ if iteration != 0:
+ log.I("Setting criterion %s to %s" % ("Crit_0", str(self.criterion_setup[iteration-1][0])))
+ state = str(self.criterion_setup[iteration-1][0])
+ out, err = self.hal.sendCmd("setCriterionState", "Crit_0", state)
+ assert err == None, log.E("Command HAL [setCriterionState]")
+ log.I("Setting criterion %s to %s" % ("Crit_1", str(self.criterion_setup[iteration-1][1])))
+ state = str(self.criterion_setup[iteration-1][1])
+ out, err = self.hal.sendCmd("setCriterionState", "Crit_1", state)
+ assert err == None, log.E("Command HAL [setCriterionState]")
+ log.I("Applaying new configurations")
+ out, err = self.hal.sendCmd("applyConfigurations")
+ assert err == None, log.E("Command HAL [applyConfigurations]")
+ out, err = self.pfw.sendCmd("status")
+ assert err == None, log.E("Command [status]")
+ os.remove(self.temp_status)
+ f_Config_Status = open(self.temp_status, "w")
+ f_Config_Status.write(out)
+ f_Config_Status.close()
+ else :
+ log.I("Default Configurations - no criteria are set :")
+ out, err = self.pfw.sendCmd("status")
+ os.remove(self.temp_status)
+ f_Config_Status = open(self.temp_status, "w")
+ f_Config_Status.write(out)
+ f_Config_Status.close()
+
+ # Configurations checking
+ for domain in range (domains_nbr):
+ domain_name = "".join([self.new_domain_name, "_", str(domain+1), "[<none>]"])
+ config = str(self.expected_result[iteration][domain])
+ log.I("Checking that domain %s is set to configuration : %s" % (domain_name,config))
+ for line in open(self.temp_status, "r"):
+ if domain_name in line:
+ line = line.replace(domain_name,'')
+ line = line.replace(":","")
+ line = line.replace(' ','')
+ line = line.replace("\n","")
+ assert line == config, log.F("Domain %s - Expected configuration : %s, found : %s" % (domain_name,config,line))
+ log.I("Domain %s - configuration correctly set to %s" % (domain_name,line))
+
+ # Temporary files deletion
+ os.remove(self.temp_domain)
+ os.remove(self.temp_status)
diff --git a/test/functional-tests/PfwTestCase/Domains/tDomain_Elements.py b/test/functional-tests/PfwTestCase/Domains/tDomain_Elements.py
new file mode 100644
index 0000000..8651968
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Domains/tDomain_Elements.py
@@ -0,0 +1,311 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Adding and Removing elements from domain testcases
+
+List of tested functions :
+--------------------------
+ - [listDomainElements] function
+ - [addElement] function
+ - [removeElement] function
+
+Test cases :
+------------
+ - Testing nominal case
+ - Testing addElement errors
+ - Testing removeElement errors
+"""
+import os
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.pfw.sendCmd("setTuningMode", "on")
+ self.domain_name = "Domain_0"
+ self.elem_0_path = "/Test/Test/TEST_DIR"
+ self.elem_1_path = "/Test/Test/TEST_DOMAIN_0"
+ self.elem_2_path = "/Test/Test/TEST_DOMAIN_1"
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing nominal case
+ --------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - list and backup initial domain elements
+ - add a domain element
+ - remove a domain element
+ - list and check domains elements
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [listDomainElements] function
+ - [addElement] function
+ - [removeElement] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - all operations succeed
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+
+ # List and backup initial domain elements
+ log.I("Listing initial domain %s elements" % (self.domain_name))
+ out, err = self.pfw.sendCmd("listDomainElements",str(self.domain_name))
+ assert err == None, "ERROR : command [listDomainElements] - Error while listing domain elements"
+ f_DomainElements_Backup = open("f_DomainElements_Backup", "w")
+ f_DomainElements_Backup.write(out)
+ f_DomainElements_Backup.close()
+ log.I("command [listDomainElements] correctly executed")
+ f_DomainElements_Backup = open("f_DomainElements_Backup", "r")
+ element_nbr_init = 0
+ line=f_DomainElements_Backup.readline()
+ while line!="":
+ line=f_DomainElements_Backup.readline()
+ element_nbr_init+=1
+ f_DomainElements_Backup.close()
+ log.I("Actual domain %s elements number is %s" % (self.domain_name,element_nbr_init))
+
+ # Adding a new domain element
+ log.I("Adding a new domain element to domain %s" % (self.domain_name))
+ out, err = self.pfw.sendCmd("addElement", str(self.domain_name), str(self.elem_1_path))
+ assert err == None, "ERROR : command [addElement] - Error while adding new domain element %s" % (self.elem_1_path)
+ assert out == "Done", "ERROR : command [addElement] - Error while adding new domain element %s" % (self.elem_1_path)
+ log.I("Adding a new domain element to domain %s" % (self.domain_name))
+ out, err = self.pfw.sendCmd("addElement", str(self.domain_name), str(self.elem_2_path))
+ assert err == None, "ERROR : command [addElement] - Error while adding new domain element %s" % (self.elem_2_path)
+ assert out == "Done", "ERROR : command [addElement] - Error while adding new domain element %s" % (self.elem_2_path)
+ log.I("New domain elements %s and %s added to domain %s" % (self.elem_1_path, self.elem_2_path, self.domain_name))
+
+ # Removing a domain element
+ log.I("Removing domain element %s from domain %s" % (self.elem_1_path,self.domain_name))
+ out, err = self.pfw.sendCmd("removeElement", str(self.domain_name), str(self.elem_1_path))
+ assert err == None, "ERROR : command [removeElement] - Error while removing domain element %s" % (self.elem_1_path)
+ assert out == "Done", "ERROR : command [removeElement] - Error while removing domain element %s" % (self.elem_1_path)
+
+ # Checking final domain elements
+ log.I("Listing final domain %s elements" % (self.domain_name))
+ out, err = self.pfw.sendCmd("listDomainElements",str(self.domain_name))
+ assert err == None, "ERROR : command [listDomainElements] - Error while listing domain elements"
+ f_DomainElements = open("f_DomainElements", "w")
+ f_DomainElements.write(out)
+ f_DomainElements.close()
+ log.I("command [listDomainElements] correctly executed")
+ f_DomainElements = open("f_DomainElements", "r")
+ element_nbr = 0
+ line=f_DomainElements.readline()
+ while line!="":
+ line=f_DomainElements.readline()
+ element_nbr+=1
+ f_DomainElements.close()
+ log.I("Actual domain %s elements number is %s" % (self.domain_name,element_nbr))
+ log.I("Checking domain %s elements names conformity" % (self.domain_name))
+ f_DomainElements = open("f_DomainElements", "r")
+ f_DomainElements_Backup = open("f_DomainElements_Backup", "r")
+ for line in range(element_nbr):
+ # initial domain elements shall not have been impacted by current test
+ if (line < element_nbr_init):
+ element_name = f_DomainElements.readline().strip('\n')
+ element_name_backup = f_DomainElements_Backup.readline().strip('\n')
+ assert element_name==element_name_backup, "ERROR : Error while modifying domain elements on domain %s" % (self.domain_name)
+ # last listed element shall be equal to the only one element added previously
+ else:
+ element_name = f_DomainElements.readline().strip('\n')
+ assert element_name==str(self.elem_2_path), "ERROR : Error while modifying domain elements on domain %s" % (self.domain_name)
+ log.I("Actual domain %s elements names conform to expected values" % (self.domain_name))
+ # Temporary files deletion
+ f_DomainElements.close()
+ f_DomainElements_Backup.close()
+ os.remove("f_DomainElements_Backup")
+ os.remove("f_DomainElements")
+ # Removing created domain element
+ out, err = self.pfw.sendCmd("removeElement", str(self.domain_name), str(self.elem_2_path))
+ assert err == None, "ERROR : command [removeElement] - Error while removing domain element %s" % (self.elem_2_path)
+ assert out == "Done", "ERROR : command [removeElement] - Error while removing domain element %s" % (self.elem_2_path)
+
+ def test_addElement_Error(self):
+ """
+ Testing addElement error
+ ------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - add an already existing domain element
+ - add a non defined domain element
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [addElement] function
+ - [listDomainElements] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - Errors correctly detected
+ - No side effect
+ """
+ log.D(self.test_addElement_Error.__doc__)
+
+ # List and backup initial domain elements
+ log.I("Listing initial domain %s elements" % (self.domain_name))
+ out, err = self.pfw.sendCmd("listDomainElements",str(self.domain_name))
+ assert err == None, "ERROR : command [listDomainElements] - Error while listing domain elements"
+ f_DomainElements_Backup = open("f_DomainElements_Backup", "w")
+ f_DomainElements_Backup.write(out)
+ f_DomainElements_Backup.close()
+ log.I("command [listDomainElements] correctly executed")
+ f_DomainElements_Backup = open("f_DomainElements_Backup", "r")
+ element_nbr_init = 0
+ line=f_DomainElements_Backup.readline()
+ while line!="":
+ line=f_DomainElements_Backup.readline()
+ element_nbr_init+=1
+ f_DomainElements_Backup.close()
+ log.I("Actual domain %s elements number is %s" % (self.domain_name,element_nbr_init))
+
+ # Adding a new domain element errors
+ log.I("Adding an already existing domain element to domain %s" % (self.domain_name))
+ out, err = self.pfw.sendCmd("addElement", str(self.domain_name), str(self.elem_0_path))
+ assert err == None, "ERROR : command [addElement] - Error while adding new domain element %s" % (self.elem_0_path)
+ assert out != "Done", "ERROR : command [addElement] - Error not detected while adding an already existing domain element to domain %s" % (self.domain_name)
+ log.I("Adding a non defined domain element to domain %s" % (self.domain_name))
+ out, err = self.pfw.sendCmd("addElement", str(self.domain_name), "Non_Defined_Element")
+ assert err == None, "ERROR : command [addElement] - Error while adding new domain element %s" % (self.elem_2_path)
+ assert out != "Done", "ERROR : command [addElement] - Error not detected while adding a non defined domain element to domain %s" % (self.domain_name)
+ log.I("Error when adding elements correctly detected")
+
+ # Checking final domain elements
+ log.I("Listing final domain %s elements" % (self.domain_name))
+ out, err = self.pfw.sendCmd("listDomainElements",str(self.domain_name))
+ assert err == None, "ERROR : command [listDomainElements] - Error while listing domain elements"
+ f_DomainElements = open("f_DomainElements", "w")
+ f_DomainElements.write(out)
+ f_DomainElements.close()
+ log.I("command [listDomainElements] correctly executed")
+ f_DomainElements = open("f_DomainElements", "r")
+ element_nbr = 0
+ line=f_DomainElements.readline()
+ while line!="":
+ line=f_DomainElements.readline()
+ element_nbr+=1
+ f_DomainElements.close()
+ log.I("Actual domain %s elements number is %s" % (self.domain_name,element_nbr))
+ log.I("Checking domain %s elements names conformity" % (self.domain_name))
+ f_DomainElements = open("f_DomainElements", "r")
+ f_DomainElements_Backup = open("f_DomainElements_Backup", "r")
+ for line in range(element_nbr):
+ # initial domain elements shall not have been impacted by current test
+ element_name = f_DomainElements.readline().strip('\n')
+ element_name_backup = f_DomainElements_Backup.readline().strip('\n')
+ assert element_name==element_name_backup, "ERROR : domain %s elements affected by addElement errors" % (self.domain_name)
+ log.I("Actual domain %s elements names conform to expected values" % (self.domain_name))
+ # Temporary files deletion
+ f_DomainElements.close()
+ f_DomainElements_Backup.close()
+ os.remove("f_DomainElements_Backup")
+ os.remove("f_DomainElements")
+
+ def test_removeElement_Error(self):
+ """
+ Testing removeElement error
+ ---------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - remove a non defined domain element
+ - remove a domain element on a wrong domain name
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [removeElement] function
+ - [listDomainElements] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - Errors correctly detected
+ - No side effect
+ """
+ log.D(self.test_removeElement_Error.__doc__)
+
+ # List and backup initial domain elements
+ log.I("Listing initial domain %s elements" % (self.domain_name))
+ out, err = self.pfw.sendCmd("listDomainElements",str(self.domain_name))
+ assert err == None, "ERROR : command [listDomainElements] - Error while listing domain elements"
+ f_DomainElements_Backup = open("f_DomainElements_Backup", "w")
+ f_DomainElements_Backup.write(out)
+ f_DomainElements_Backup.close()
+ log.I("command [listDomainElements] correctly executed")
+ f_DomainElements_Backup = open("f_DomainElements_Backup", "r")
+ element_nbr_init = 0
+ line=f_DomainElements_Backup.readline()
+ while line!="":
+ line=f_DomainElements_Backup.readline()
+ element_nbr_init+=1
+ f_DomainElements_Backup.close()
+ log.I("Actual domain %s elements number is %s" % (self.domain_name,element_nbr_init))
+
+ # Error when removing domain elements
+ log.I("Removing a domain element from a non defined domain")
+ out, err = self.pfw.sendCmd("removeElement", "Wrong_Domain_Name", str(self.elem_0_path))
+ assert err == None, "ERROR : command [removeElement] - Error when removing domain element %s" % (self.elem_0_path)
+ assert out != "Done", "ERROR : command [removeElement] - Error not detected when removing domain element %s from an undefined domain"% (self.elem_0_path)
+ log.I("Removing a non existent domain element from domain %s" % (self.domain_name))
+ out, err = self.pfw.sendCmd("removeElement", str(self.domain_name), "Wrong_Element_Name")
+ assert err == None, "ERROR : command [removeElement] - Error when removing domain element %s" % (self.elem_0_path)
+ assert out != "Done", "ERROR : command [removeElement] - Error not detected when removing a non existent domain element from domain %s" % (self.domain_name)
+ log.I("Error when removing elements correctly detected")
+
+ # Checking final domain elements
+ log.I("Listing final domain %s elements" % (self.domain_name))
+ out, err = self.pfw.sendCmd("listDomainElements",str(self.domain_name))
+ assert err == None, "ERROR : command [listDomainElements] - Error while listing domain elements"
+ f_DomainElements = open("f_DomainElements", "w")
+ f_DomainElements.write(out)
+ f_DomainElements.close()
+ log.I("command [listDomainElements] correctly executed")
+ f_DomainElements = open("f_DomainElements", "r")
+ element_nbr = 0
+ line=f_DomainElements.readline()
+ while line!="":
+ line=f_DomainElements.readline()
+ element_nbr+=1
+ f_DomainElements.close()
+ log.I("Actual domain %s elements number is %s" % (self.domain_name,element_nbr))
+ log.I("Checking domain %s elements names conformity" % (self.domain_name))
+ f_DomainElements = open("f_DomainElements", "r")
+ f_DomainElements_Backup = open("f_DomainElements_Backup", "r")
+ for line in range(element_nbr):
+ # initial domain elements shall not have been impacted by current test
+ element_name = f_DomainElements.readline().strip('\n')
+ element_name_backup = f_DomainElements_Backup.readline().strip('\n')
+ assert element_name==element_name_backup, "ERROR : domain %s elements affected by addElement errors" % (self.domain_name)
+ log.I("Actual domain %s elements names conform to expected values" % (self.domain_name))
+ # Temporary files deletion
+ f_DomainElements.close()
+ f_DomainElements_Backup.close()
+ os.remove("f_DomainElements_Backup")
+ os.remove("f_DomainElements")
diff --git a/test/functional-tests/PfwTestCase/Domains/tDomain_Elements_Sequences.py b/test/functional-tests/PfwTestCase/Domains/tDomain_Elements_Sequences.py
new file mode 100644
index 0000000..1544cae
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Domains/tDomain_Elements_Sequences.py
@@ -0,0 +1,294 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Element Sequence testcases
+
+List of tested functions :
+--------------------------
+ - [setElementSequence] function
+ - [getElementSequence] function
+
+Test cases :
+------------
+ - Testing setElementSequence errors
+ - Testing getElementSequence errors
+ - Testing nominal case
+"""
+import os
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.pfw.sendCmd("setTuningMode", "on")
+ self.domain_name = "Domain_0"
+ self.elem_0_path = "/Test/Test/TEST_DIR"
+ self.elem_1_path = "/Test/Test/TEST_DOMAIN_0"
+ self.elem_2_path = "/Test/Test/TEST_DOMAIN_1"
+ self.configuration = "Conf_0"
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing nominal case
+ --------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set a new sequences order for a selected configuration
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setElementSequence] function
+ - [getElementSequence] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - all operations succeed
+ - new sequences order conform to expected order
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+
+ # Adding new domain elements
+ log.I("Working on domain %s" % (self.domain_name))
+ log.I("Adding a new domain element to domain %s" % (self.domain_name))
+ out, err = self.pfw.sendCmd("addElement", str(self.domain_name), str(self.elem_1_path))
+ assert err == None, "ERROR : command [addElement] - Error while adding new domain element %s" % (self.elem_1_path)
+ assert out == "Done", "ERROR : command [addElement] - Error while adding new domain element %s" % (self.elem_1_path)
+ log.I("Adding a new domain element to domain %s" % (self.domain_name))
+ out, err = self.pfw.sendCmd("addElement", str(self.domain_name), str(self.elem_2_path))
+ assert err == None, "ERROR : command [addElement] - Error while adding new domain element %s" % (self.elem_2_path)
+ assert out == "Done", "ERROR : command [addElement] - Error while adding new domain element %s" % (self.elem_2_path)
+ log.I("New domain elements %s and %s added to domain %s" % (self.elem_1_path, self.elem_2_path, self.domain_name))
+
+ # Getting elements sequence from selected configuration
+ log.I("Getting elements sequence from configuration %s" % (self.configuration))
+ out, err = self.pfw.sendCmd("getElementSequence", self.domain_name, self.configuration)
+ assert err == None, "ERROR : command [getElementSequence] - Error while listing elements sequence for configuration %s" % (self.configuration)
+ log.I("Listing elements sequence for configuration %s correctly executed :\n%s" % (self.configuration, out))
+
+ # Setting new elements sequence order for selected configuration
+ log.I("Setting new elements sequence order for configuration %s" % (self.configuration))
+ out, err = self.pfw.sendCmd("setElementSequence", self.domain_name, self.configuration, self.elem_2_path, self.elem_0_path, self.elem_1_path)
+ assert err == None, "ERROR : command [setElementSequence] - Error while setting new elements sequence for configuration %s" % (self.configuration)
+ assert out == "Done", "ERROR : command [setElementSequence] - Error while setting new elements sequence for configuration %s" % (self.configuration)
+ log.I("Setting new elements sequence for configuration %s correctly executed")
+ out, err = self.pfw.sendCmd("getElementSequence", self.domain_name, self.configuration)
+ assert err == None, "ERROR : command [getElementSequence] - Error while listing elements sequence for configuration %s" % (self.configuration)
+ log.I("New elements sequence for configuration %s :\n%s" % (self.configuration, out))
+
+ # Checking new elements sequence order conformity for selected configuration
+ log.I("Checking new elements sequence order for configuration")
+ f_ConfigElementsOrder = open("f_ConfigElementsOrder", "w")
+ f_ConfigElementsOrder.write(out)
+ f_ConfigElementsOrder.close()
+ f_ConfigElementsOrder = open("f_ConfigElementsOrder", "r")
+ element_name = f_ConfigElementsOrder.readline().strip('\n')
+ assert element_name==self.elem_2_path, "ERROR : Error while modifying configuration %s elements order on domain %s" % (self.configuration)
+ element_name = f_ConfigElementsOrder.readline().strip('\n')
+ assert element_name==self.elem_0_path, "ERROR : Error while modifying configuration %s elements order on domain %s" % (self.configuration)
+ element_name = f_ConfigElementsOrder.readline().strip('\n')
+ assert element_name==self.elem_1_path, "ERROR : Error while modifying configuration %s elements order on domain %s" % (self.configuration)
+ log.I("New elements sequence order conform to expected order for configuration %s" % (self.configuration))
+ # Closing and removing temp file
+ f_ConfigElementsOrder.close()
+ os.remove("f_ConfigElementsOrder")
+ # Removing created domain element
+ out, err = self.pfw.sendCmd("removeElement", str(self.domain_name), str(self.elem_1_path))
+ assert err == None, "ERROR : command [removeElement] - Error while removing domain element %s" % (self.elem_1_path)
+ assert out == "Done", "ERROR : command [removeElement] - Error while removing domain element %s" % (self.elem_1_path)
+ out, err = self.pfw.sendCmd("removeElement", str(self.domain_name), str(self.elem_2_path))
+ assert err == None, "ERROR : command [removeElement] - Error while removing domain element %s" % (self.elem_2_path)
+ assert out == "Done", "ERROR : command [removeElement] - Error while removing domain element %s" % (self.elem_2_path)
+
+ def test_setElementSequence_errors(self):
+ """
+ Testing setElementSequence_errors
+ ---------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Setting an element not belonging to configuration
+ - Setting undefined element in sequence order
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setElementSequence] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - all errors correctly detected
+ - no impact on initial sequences order
+ """
+ log.D(self.test_setElementSequence_errors.__doc__)
+
+ # Adding a new domain element
+ log.I("Working on domain %s" % (self.domain_name))
+ log.I("Adding a new domain element to domain %s" % (self.domain_name))
+ out, err = self.pfw.sendCmd("addElement", str(self.domain_name), str(self.elem_1_path))
+ assert err == None, "ERROR : command [addElement] - Error while adding new domain element %s" % (self.elem_1_path)
+ assert out == "Done", "ERROR : command [addElement] - Error while adding new domain element %s" % (self.elem_1_path)
+ log.I("New domain element %s added to domain %s" % (self.elem_1_path, self.domain_name))
+
+ # Getting elements sequence from selected configuration
+ log.I("Getting elements sequence from configuration %s" % (self.configuration))
+ out, err = self.pfw.sendCmd("getElementSequence", self.domain_name, self.configuration)
+ assert err == None, "ERROR : command [getElementSequence] - Error while listing elements sequence for configuration %s" % (self.configuration)
+ log.I("Listing elements sequence for configuration %s correctly executed :\n%s" % (self.configuration, out))
+
+ # Elements sequence backup
+ f_ConfigElementsOrder_Backup = open("f_ConfigElementsOrder_Backup", "w")
+ f_ConfigElementsOrder_Backup.write(out)
+ f_ConfigElementsOrder_Backup.close()
+
+ # Setting an element not belonging to configuration in sequence order
+ log.I("Setting an element not belonging to configuration %s in sequence order" % (self.configuration))
+ out, err = self.pfw.sendCmd("setElementSequence", self.domain_name, self.configuration, self.elem_2_path, self.elem_0_path, self.elem_1_path)
+ assert err == None, "ERROR : command [setElementSequence] - Error while setting elements sequence for configuration %s" % (self.configuration)
+ assert out != "Done", "ERROR : command [setElementSequence] - Error not detected when setting an element not belonging to configuration"
+
+ # Setting undefined element in sequence order for selected configuration
+ log.I("Setting undefined element in sequence order for configuration %s" % (self.configuration))
+ out, err = self.pfw.sendCmd("setElementSequence", self.domain_name, self.configuration, "Wrong_Element_Name", self.elem_0_path, self.elem_1_path)
+ assert err == None, "ERROR : command [setElementSequence] - Error while setting elements sequence for configuration %s" % (self.configuration)
+ assert out != "Done", "ERROR : command [getElementSequence] - Error not detected when setting an undefined element to configuration"
+
+ # Getting elements sequence from selected configuration for checking purpose
+ out, err = self.pfw.sendCmd("getElementSequence", self.domain_name, self.configuration)
+ assert err == None, "ERROR : command [getElementSequence] - Error while listing elements sequence for configuration %s" % (self.configuration)
+ # Elements sequence backup
+ f_ConfigElementsOrder = open("f_ConfigElementsOrder", "w")
+ f_ConfigElementsOrder.write(out)
+ f_ConfigElementsOrder.close()
+
+ # Checking new elements sequence order conformity for selected configuration
+ log.I("Checking new elements sequence order for configuration")
+ f_ConfigElementsOrder = open("f_ConfigElementsOrder", "r")
+ f_ConfigElementsOrder_Backup = open("f_ConfigElementsOrder_Backup", "r")
+ new_element_name = f_ConfigElementsOrder.readline().strip('\n')
+ element_name = f_ConfigElementsOrder_Backup.readline().strip('\n')
+ assert element_name==new_element_name, "ERROR : setElementSequence errors have affected elements order on domain %s" % (self.configuration)
+ new_element_name = f_ConfigElementsOrder.readline().strip('\n')
+ element_name = f_ConfigElementsOrder_Backup.readline().strip('\n')
+ assert element_name==new_element_name, "ERROR : setElementSequence errors have affected elements order on domain %s" % (self.configuration)
+ log.I("Elements sequence order not affected by setElementSequence errors")
+
+ # Closing and removing temp file
+ f_ConfigElementsOrder.close()
+ f_ConfigElementsOrder_Backup.close()
+ os.remove("f_ConfigElementsOrder")
+ os.remove("f_ConfigElementsOrder_Backup")
+ # Removing created domain element
+ out, err = self.pfw.sendCmd("removeElement", str(self.domain_name), str(self.elem_1_path))
+ assert err == None, "ERROR : command [removeElement] - Error while removing domain element %s" % (self.elem_1_path)
+ assert out == "Done", "ERROR : command [removeElement] - Error while removing domain element %s" % (self.elem_1_path)
+
+ def test_getElementSequence_errors(self):
+ """
+ Testing getElementSequence_errors
+ ---------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Getting an element sequence on a wrong domain name
+ - Getting an element sequence on a wrong configuration name
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [getElementSequence] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - all errors correctly detected
+ - no impact on initial sequences order
+ """
+ log.D(self.test_getElementSequence_errors.__doc__)
+
+ # Adding new domain elements
+ log.I("Adding a new domain element to domain %s" % (self.domain_name))
+ out, err = self.pfw.sendCmd("addElement", str(self.domain_name), str(self.elem_1_path))
+ assert err == None, "ERROR : command [addElement] - Error while adding new domain element %s" % (self.elem_1_path)
+ assert out == "Done", "ERROR : command [addElement] - Error while adding new domain element %s" % (self.elem_1_path)
+ log.I("Adding a new domain element to domain %s" % (self.domain_name))
+ out, err = self.pfw.sendCmd("addElement", str(self.domain_name), str(self.elem_2_path))
+ assert err == None, "ERROR : command [addElement] - Error while adding new domain element %s" % (self.elem_2_path)
+ assert out == "Done", "ERROR : command [addElement] - Error while adding new domain element %s" % (self.elem_2_path)
+ log.I("New domain elements %s and %s added to domain %s" % (self.elem_1_path, self.elem_2_path, self.domain_name))
+
+ # Getting elements sequence from selected configuration
+ log.I("Getting elements sequence from configuration %s" % (self.configuration))
+ out, err = self.pfw.sendCmd("getElementSequence", self.domain_name, self.configuration)
+ assert err == None, "ERROR : command [getElementSequence] - Error while listing elements sequence for configuration %s" % (self.configuration)
+ log.I("Listing elements sequence for configuration %s correctly executed :\n%s" % (self.configuration, out))
+
+ # Elements sequence backup
+ f_ConfigElementsOrder_Backup = open("f_ConfigElementsOrder_Backup", "w")
+ f_ConfigElementsOrder_Backup.write(out)
+ f_ConfigElementsOrder_Backup.close()
+
+ # Getting an element sequence on a wrong domain name
+ log.I("Getting an element sequence on a wrong domain name")
+ out, err = self.pfw.sendCmd("getElementSequence", "Wrong_Domain_Name", self.configuration)
+ assert err == None, "ERROR : command [getElementSequence] - Error when getting elements sequence for configuration %s" % (self.configuration)
+ assert out != "Done", "ERROR : command [getElementSequence] - Error not detected when getting elements sequence for a wrong domain name"
+
+ # Getting an element sequence on a wrong configuration name
+ log.I("Getting an element sequence on a wrong configuration name")
+ out, err = self.pfw.sendCmd("getElementSequence", self.domain_name, "Wrong_Configuration_Name")
+ assert err == None, "ERROR : command [getElementSequence] - Error when getting elements sequence on a wrong configuration name"
+ assert out != "Done", "ERROR : command [getElementSequence] - Error not detected when getting elements sequence on a wrong configuration name"
+
+ # Getting elements sequence from selected configuration for checking purpose
+ out, err = self.pfw.sendCmd("getElementSequence", self.domain_name, self.configuration)
+ assert err == None, "ERROR : command [getElementSequence] - Error while listing elements sequence for configuration %s" % (self.configuration)
+ # Elements sequence backup
+ f_ConfigElementsOrder = open("f_ConfigElementsOrder", "w")
+ f_ConfigElementsOrder.write(out)
+ f_ConfigElementsOrder.close()
+
+ # Checking new elements sequence order conformity for selected configuration
+ log.I("Checking new elements sequence order for configuration")
+ f_ConfigElementsOrder = open("f_ConfigElementsOrder", "r")
+ f_ConfigElementsOrder_Backup = open("f_ConfigElementsOrder_Backup", "r")
+ new_element_name = f_ConfigElementsOrder.readline().strip('\n')
+ element_name = f_ConfigElementsOrder_Backup.readline().strip('\n')
+ assert element_name==new_element_name, "ERROR : getElementSequence errors have affected elements order on domain %s" % (self.configuration)
+ new_element_name = f_ConfigElementsOrder.readline().strip('\n')
+ element_name = f_ConfigElementsOrder_Backup.readline().strip('\n')
+ assert element_name==new_element_name, "ERROR : getElementSequence errors have affected elements order on domain %s" % (self.configuration)
+ log.I("Elements sequence order not affected by getElementSequence errors")
+
+ # Closing and removing temp file
+ f_ConfigElementsOrder.close()
+ f_ConfigElementsOrder_Backup.close()
+ os.remove("f_ConfigElementsOrder")
+ os.remove("f_ConfigElementsOrder_Backup")
+ # Removing created domain element
+ out, err = self.pfw.sendCmd("removeElement", str(self.domain_name), str(self.elem_1_path))
+ assert err == None, "ERROR : command [removeElement] - Error while removing domain element %s" % (self.elem_1_path)
+ assert out == "Done", "ERROR : command [removeElement] - Error while removing domain element %s" % (self.elem_1_path)
+ out, err = self.pfw.sendCmd("removeElement", str(self.domain_name), str(self.elem_2_path))
+ assert err == None, "ERROR : command [removeElement] - Error while removing domain element %s" % (self.elem_2_path)
+ assert out == "Done", "ERROR : command [removeElement] - Error while removing domain element %s" % (self.elem_2_path)
diff --git a/test/functional-tests/PfwTestCase/Domains/tDomain_Rules.py b/test/functional-tests/PfwTestCase/Domains/tDomain_Rules.py
new file mode 100644
index 0000000..0084e22
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Domains/tDomain_Rules.py
@@ -0,0 +1,443 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Rules management testcases
+
+List of tested functions :
+--------------------------
+ - [setRule] function
+ - [clearRule] function
+ - [getRule] function
+
+Test cases :
+------------
+ - Testing clearRule errors
+ - Testing setRule errors
+ - Testing getRule errors
+ - Testing nominal case
+"""
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of Domains - Rules
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.pfw.sendCmd("setTuningMode", "on")
+ self.domain_name = "domain_test"
+ self.conf_1 = "conf_1"
+ self.conf_2 = "conf_2"
+ self.rule_1 = "Any{Crit_0 Includes State_0x2, Crit_1 IsNot State_1}"
+ self.rule_2 = "All{Crit_0 Includes State_0x1, Crit_1 Is State_1}"
+ self.rule_error_1 = "All{Crit_Error Includes State_0x1, Crit_1 Is State_1}"
+ self.rule_error_2 = "Any{Crit_0 Includes State_0x2, Crit_0 IsNot State_1}"
+ self.rule_error_3 = "Ay{Crit_0 Includes State_0x2, Crit_1 IsNot State_1}"
+ self.rule_error_4 = "All{Crit_0 Includes State_0x4, Crit_1 IsNot State_1}"
+ self.rule_error_5 = "All{Crit_0 Includes State_0x2, Crit_1 IsNot 1}"
+ self.rule_error_nbr = 5
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_ClearRule_Errors(self):
+ """
+ Testing configuration creation error
+ ------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Clearing rule on a non-existent configuration
+ - Clearing rule on a non-existent domain
+ - Clearing rule with wrong parameters order
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [clearRule] function
+ - [setRule] function
+ - [getRule] function
+ - [createDomain] function
+ - [createConfiguration] function
+ - [deleteDomain] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - all errors are detected
+ - no rule is deleted
+ """
+ log.D(self.test_ClearRule_Errors.__doc__)
+ # New domain creation for testing purpose
+ log.I("New domain creation for testing purpose : %s" % (self.domain_name))
+ log.I("command [createDomain]")
+ out, err = self.pfw.sendCmd("createDomain",self.domain_name, "")
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createDomain] - Error while creating domain %s" % (self.domain_name)
+ log.I("command [createDomain] correctly executed")
+ log.I("Domain %s created" % (self.domain_name))
+
+ # New configurations creation for testing purpose
+ log.I("New configuration %s creation for domain %s for testing purpose" % (self.conf_1,self.domain_name))
+ log.I("command [createConfiguration]")
+ out, err = self.pfw.sendCmd("createConfiguration",self.domain_name,self.conf_1)
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration %s" % (self.conf_1)
+ log.I("command [createConfiguration] correctly executed")
+ log.I("Configuration %s created for domain %s" % (self.conf_1,self.domain_name))
+ log.I("New configuration %s creation for domain %s for testing purpose" % (self.conf_2,self.domain_name))
+ log.I("command [createConfiguration]")
+ out, err = self.pfw.sendCmd("createConfiguration",self.domain_name,self.conf_2)
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration %s" % (self.conf_2)
+ log.I("command [createConfiguration] correctly executed")
+ log.I("Configuration %s created for domain %s" % (self.conf_2,self.domain_name))
+
+ # Applying rules to configurations
+ log.I("Applying rules to configurations %s and %s from domain %s" % (self.conf_1,self.conf_2,self.domain_name))
+ log.I("command [setRule]")
+ out, err = self.pfw.sendCmd("setRule",self.domain_name,self.conf_1,self.rule_1)
+ assert err == None, "ERROR : command [setRule] - Error while setting rule for configurations %s" % (self.conf_1)
+ assert out == "Done", "FAIL : command [setRule] - Error while setting rule for configuration %s" % (self.conf_1)
+ log.I("command [setRule] correctly executed")
+ log.I("rule correctly created for configuration %s" % (self.conf_1))
+ out, err = self.pfw.sendCmd("setRule",self.domain_name,self.conf_2,self.rule_2)
+ assert err == None, "ERROR : command [setRule] - Error while setting rule for configurations %s" % (self.conf_2)
+ assert out == "Done", "FAIL : command [setRule] - Error while setting rule for configuration %s" % (self.conf_2)
+ log.I("command [setRule] correctly executed")
+ log.I("rule correctly created for configuration %s" % (self.conf_2))
+
+ # Clearing rule errors
+ log.I("Clearing a rule on domain %s to a non-existent configuration" % (self.domain_name))
+ log.I("command [clearRule]")
+ out, err = self.pfw.sendCmd("clearRule",self.domain_name,"Wrong_Config_Name")
+ assert err == None, "ERROR : command [clearRule] - Error while clearing rule on domain %s to a non-existent configuration" % (self.domain_name)
+ assert out != "Done", "ERROR : command [clearRule] - Error not detected while clearing rule on domain %s to a non-existent configuration" % (self.domain_name)
+ log.I("error correctly detected when clearing a rule to a non-existent configuration")
+ log.I("Clearing a rule on a non-existent domain")
+ log.I("command [clearRule]")
+ out, err = self.pfw.sendCmd("clearRule","Wrong_Domain_Name",self.conf_2)
+ assert err == None, "ERROR : command [clearRule] - Error while clearing rule on a non-existent domain"
+ assert out != "Done", "ERROR : command [clearRule] - Error not detected while clearing rule on a non-existent domain"
+ log.I("error correctly detected while clearing rule on a non-existent domain")
+ log.I("Clearing a rule with wrong parameters order")
+ log.I("command [clearRule]")
+ out, err = self.pfw.sendCmd("clearRule",self.conf_1,self.domain_name)
+ assert err == None, "ERROR : command [clearRule] - Error when clearing a rule with incorrect paramaters order"
+ assert out != "Done", "ERROR : command [clearRule] - Error not detected when clearing a rule with incorrect paramaters order"
+ log.I("error correctly detected when clearing a rule with incorrect paramaters order on domain %s and configuration %s" % (self.domain_name,self.conf_1))
+
+ #Checking that no rule has been cleared
+ out, err = self.pfw.sendCmd("getRule",self.domain_name,self.conf_1)
+ assert out == self.rule_1, "FAIL : command [clearRule] - clearRule error has affected configuration %s" % (self.conf_1)
+ out, err = self.pfw.sendCmd("getRule",self.domain_name,self.conf_2)
+ assert out == self.rule_2, "FAIL : command [clearRule] - clearRule error has affected configuration %s" % (self.conf_2)
+ log.I("command [ClearRule] correctly executed, no impact due to clearing errors")
+ log.I("no rule removed from configurations %s and %s on domain %s" % (self.conf_1,self.conf_2,self.domain_name))
+
+ # New domain deletion
+ log.I("Domain %s deletion" % (self.domain_name))
+ log.I("command [deleteDomain]")
+ out, err = self.pfw.sendCmd("deleteDomain",self.domain_name, "")
+ assert out == "Done", out
+ assert err == None, "ERROR : command [deleteDomain] - Error while delting domain %s" % (self.domain_name)
+ log.I("command [deleteDomain] correctly executed")
+ log.I("Domain %s deleted" % (self.domain_name))
+
+ def test_SetRule_Errors(self):
+ """
+ Testing setRule errors
+ ----------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Setting rule on a non-existent configuration
+ - Setting rule on a non-existent domain
+ - Setting various incorrect format rules
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setRule] function
+ - [getRule] function
+ - [createDomain] function
+ - [createConfiguration] function
+ - [deleteDomain] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - all errors are detected
+ - no new rule is created
+ """
+ log.D(self.test_SetRule_Errors.__doc__)
+ # New domain creation for testing purpose
+ log.I("New domain creation for testing purpose : %s" % (self.domain_name))
+ log.I("command [createDomain]")
+ out, err = self.pfw.sendCmd("createDomain",self.domain_name, "")
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createDomain] - Error while creating domain %s" % (self.domain_name)
+ log.I("command [createDomain] correctly executed")
+ log.I("Domain %s created" % (self.domain_name))
+
+ # New configuration creation for testing purpose
+ log.I("New configuration %s creation for domain %s for testing purpose" % (self.conf_1,self.domain_name))
+ log.I("command [createConfiguration]")
+ out, err = self.pfw.sendCmd("createConfiguration",self.domain_name,self.conf_1)
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration %s" % (self.conf_1)
+ log.I("command [createConfiguration] correctly executed")
+ log.I("Configuration %s created for domain %s" % (self.conf_1,self.domain_name))
+
+ # setRule :basic error cases
+ log.I("Applying a new rule on domain %s to a non-existent configuration" % (self.domain_name))
+ log.I("command [setRule]")
+ out, err = self.pfw.sendCmd("setRule",self.domain_name,"Wrong_Config_Name",self.rule_1)
+ assert err == None, "ERROR : command [setRule] - Error while setting rule on domain %s to a non-existent configuration" % (self.domain_name)
+ assert out != "Done", "ERROR : command [setRule] - Error not detected while setting rule on domain %s to a non-existent configuration" % (self.domain_name)
+ log.I("error correctly detected when creating a rule to a non-existent configuration")
+ log.I("Applying a new rule on a non-existent domain")
+ log.I("command [setRule]")
+ out, err = self.pfw.sendCmd("setRule","Wrong_Domain_Name",self.conf_1,self.rule_1)
+ assert err == None, "ERROR : command [setRule] - Error while setting rule on a non-existent domain"
+ assert out != "Done", "ERROR : command [setRule] - Error not detected while setting rule on a non-existent domain"
+ log.I("error correctly detected while setting rule on a non-existent domain")
+ log.I("Applying a new rule with incorrect format")
+ log.I("command [setRule]")
+ out, err = self.pfw.sendCmd("setRule",self.domain_name,self.conf_1,"Wrong_Rule_Format")
+ assert err == None, "ERROR : command [setRule] - Error when setting incorrect format rule"
+ assert out != "Done", "ERROR : command [setRule] - Error not detected when setting incorrect format rule"
+ log.I("error correctly detected when setting incorrect format rule on domain %s and configuration %s" % (self.domain_name,self.conf_1))
+
+ # setRule : various rules errors
+ log.I("Various rules errors setting :")
+ for index in range (self.rule_error_nbr):
+ log.I("Rule error number %s" % (str(index)))
+ rule_name = "".join(["self.rule_error_", "_", str(index)])
+ out, err = self.pfw.sendCmd("setRule",self.domain_name,self.conf_1, rule_name)
+ assert err == None, "ERROR : command [setRule] - Error when setting incorrect format rule %s" % (str(rule_name))
+ assert out != "Done", "ERROR : command [setRule] - Error not detected when setting incorrect format rule %s" % (str(rule_name))
+ log.I("error correctly detected when setting incorrect format rule on domain %s and configuration %s" % (self.domain_name,self.conf_1))
+
+ #Checking that no rule has been created
+ out, err = self.pfw.sendCmd("getRule",self.domain_name,self.conf_1)
+ assert out == "<none>", "FAIL : command [setRule] - setRule not working for configuration %s" % (self.conf_1)
+ log.I("command [setRule] correctly executed, no impact due to setting errors")
+ log.I("no rule added to configurations %s on domain %s" % (self.conf_1,self.domain_name))
+
+ # New domain deletion
+ log.I("Domain %s deletion" % (self.domain_name))
+ log.I("command [deleteDomain]")
+ out, err = self.pfw.sendCmd("deleteDomain",self.domain_name, "")
+ assert out == "Done", out
+ assert err == None, "ERROR : command [deleteDomain] - Error while delting domain %s" % (self.domain_name)
+ log.I("command [deleteDomain] correctly executed")
+ log.I("Domain %s deleted" % (self.domain_name))
+
+ def test_GetRule_Errors(self):
+ """
+ Testing getRule errors
+ ----------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Getting rule on a non-existent configuration
+ - Getting rule on a non-existent domain
+ - Getting rule with wrong parameters order
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [getRule] function
+ - [setRule] function
+ - [clearRule] function
+ - [createDomain] function
+ - [createConfiguration] function
+ - [deleteDomain] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - all errors are detected
+ """
+ log.D(self.test_GetRule_Errors.__doc__)
+ # New domain creation for testing purpose
+ log.I("New domain creation for testing purpose : %s" % (self.domain_name))
+ log.I("command [createDomain]")
+ out, err = self.pfw.sendCmd("createDomain",self.domain_name, "")
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createDomain] - Error while creating domain %s" % (self.domain_name)
+ log.I("command [createDomain] correctly executed")
+ log.I("Domain %s created" % (self.domain_name))
+
+ # New configurations creation for testing purpose
+ log.I("New configuration %s creation for domain %s for testing purpose" % (self.conf_1,self.domain_name))
+ log.I("command [createConfiguration]")
+ out, err = self.pfw.sendCmd("createConfiguration",self.domain_name,self.conf_1)
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration %s" % (self.conf_1)
+ log.I("command [createConfiguration] correctly executed")
+ log.I("Configuration %s created for domain %s" % (self.conf_1,self.domain_name))
+ log.I("New configuration %s creation for domain %s for testing purpose" % (self.conf_2,self.domain_name))
+ log.I("command [createConfiguration]")
+ out, err = self.pfw.sendCmd("createConfiguration",self.domain_name,self.conf_2)
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration %s" % (self.conf_2)
+ log.I("command [createConfiguration] correctly executed")
+ log.I("Configuration %s created for domain %s" % (self.conf_2,self.domain_name))
+
+ # Applying rules to configurations
+ log.I("Applying rules to configurations %s and %s from domain %s" % (self.conf_1,self.conf_2,self.domain_name))
+ log.I("command [setRule]")
+ out, err = self.pfw.sendCmd("setRule",self.domain_name,self.conf_1,self.rule_1)
+ assert err == None, "ERROR : command [setRule] - Error while setting rule for configurations %s" % (self.conf_1)
+ assert out == "Done", "FAIL : command [setRule] - Error while setting rule for configuration %s" % (self.conf_1)
+ log.I("command [setRule] correctly executed")
+ log.I("rule correctly created for configuration %s" % (self.conf_1))
+ out, err = self.pfw.sendCmd("setRule",self.domain_name,self.conf_2,self.rule_2)
+ assert err == None, "ERROR : command [setRule] - Error while setting rule for configurations %s" % (self.conf_2)
+ assert out == "Done", "FAIL : command [setRule] - Error while setting rule for configuration %s" % (self.conf_2)
+ log.I("command [setRule] correctly executed")
+ log.I("rule correctly created for configuration %s" % (self.conf_2))
+
+ # Getting rule errors
+ log.I("Getting a rule on domain %s from a non-existent configuration" % (self.domain_name))
+ log.I("command [getRule]")
+ out, err = self.pfw.sendCmd("getRule",self.domain_name,"Wrong_Config_Name")
+ assert err == None, "ERROR : command [getRule] - Error when getting rule on domain %s from a non-existent configuration" % (self.domain_name)
+ assert out != "Done", "ERROR : command [getRule] - Error not detected while getting rule on domain %s from a non-existent configuration" % (self.domain_name)
+ log.I("error correctly detected when getting a rule from a non-existent configuration")
+ log.I("getting a rule from a non-existent domain")
+ log.I("command [getRule]")
+ out, err = self.pfw.sendCmd("getRule","Wrong_Domain_Name",self.conf_2)
+ assert err == None, "ERROR : command [getRule] - Error when getting rule from a non-existent domain"
+ assert out != "Done", "ERROR : command [getRule] - Error not detected while getting rule from a non-existent domain"
+ log.I("error correctly detected when getting rule from a non-existent domain")
+ log.I("getting a rule with wrong parameters order")
+ log.I("command [getRule]")
+ out, err = self.pfw.sendCmd("getRule",self.conf_1,self.domain_name)
+ assert err == None, "ERROR : command [getRule] - Error when getting a rule with incorrect paramaters order"
+ assert out != "Done", "ERROR : command [getRule] - Error not detected when getting a rule with incorrect paramaters order"
+ log.I("error correctly detected when getting a rule with incorrect paramaters order on domain %s and configuration %s" % (self.domain_name,self.conf_1))
+
+ # New domain deletion
+ log.I("Domain %s deletion" % (self.domain_name))
+ log.I("command [deleteDomain]")
+ out, err = self.pfw.sendCmd("deleteDomain",self.domain_name, "")
+ assert out == "Done", out
+ assert err == None, "ERROR : command [deleteDomain] - Error while delting domain %s" % (self.domain_name)
+ log.I("command [deleteDomain] correctly executed")
+ log.I("Domain %s deleted" % (self.domain_name))
+
+ def test_Nominal_Case(self):
+ """
+ Testing nominal case
+ --------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - setting rules for configurations
+ - getting rules from configurations
+ - Clear created rules
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [getRule] function
+ - [setRule] function
+ - [clearRule] function
+ - [createDomain] function
+ - [createConfiguration] function
+ - [deleteConfiguration] function
+ - [deleteDomain] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - all operations succeed
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ # New domain creation for testing purpose
+ log.I("New domain creation for testing purpose : %s" % (self.domain_name))
+ log.I("command [createDomain]")
+ out, err = self.pfw.sendCmd("createDomain",self.domain_name, "")
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createDomain] - Error while creating domain %s" % (self.domain_name)
+ log.I("command [createDomain] correctly executed")
+ log.I("Domain %s created" % (self.domain_name))
+
+ # New configurations creation for testing purpose
+ log.I("New configuration %s creation for domain %s for testing purpose" % (self.conf_1,self.domain_name))
+ log.I("command [createConfiguration]")
+ out, err = self.pfw.sendCmd("createConfiguration",self.domain_name,self.conf_1)
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration %s" % (self.conf_1)
+ log.I("command [createConfiguration] correctly executed")
+ log.I("Configuration %s created for domain %s" % (self.conf_1,self.domain_name))
+ log.I("New configuration %s creation for domain %s for testing purpose" % (self.conf_2,self.domain_name))
+ log.I("command [createConfiguration]")
+ out, err = self.pfw.sendCmd("createConfiguration",self.domain_name,self.conf_2)
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration %s" % (self.conf_2)
+ log.I("command [createConfiguration] correctly executed")
+ log.I("Configuration %s created for domain %s" % (self.conf_2,self.domain_name))
+
+ # Applying rules to configurations
+ log.I("Applying rules to configurations %s and %s from domain %s" % (self.conf_1,self.conf_2,self.domain_name))
+ log.I("command [setRule]")
+ out, err = self.pfw.sendCmd("setRule",self.domain_name,self.conf_1,self.rule_1)
+ assert err == None, "ERROR : command [setRule] - Error while setting rule for configurations %s" % (self.conf_1)
+ assert out == "Done", "FAIL : command [setRule] - Error while setting rule for configuration %s" % (self.conf_1)
+ log.I("command [setRule] correctly executed")
+ log.I("rule correctly created for configuration %s" % (self.conf_1))
+ out, err = self.pfw.sendCmd("setRule",self.domain_name,self.conf_2,self.rule_2)
+ assert err == None, "ERROR : command [setRule] - Error while setting rule for configurations %s" % (self.conf_2)
+ assert out == "Done", "FAIL : command [setRule] - Error while setting rule for configuration %s" % (self.conf_2)
+ log.I("command [setRule] correctly executed")
+ log.I("rule correctly created for configuration %s" % (self.conf_2))
+
+ # Checking rules recovered
+ log.I("Recovering rules for configurations %s and %s from domain %s" % (self.conf_1,self.conf_2,self.domain_name))
+ log.I("command [getRule]")
+ out, err = self.pfw.sendCmd("getRule",self.domain_name,self.conf_1)
+ assert err == None, "ERROR : command [getRule] - Error while setting rule to configurations %s" % (self.conf_1)
+ assert out == str(self.rule_1), "FAIL : command [getRule] - Error while recovering rule from configuration %s, incorrect value" % (self.conf_1)
+ log.I("command [getRule] correctly executed")
+ log.I("rule correctly recovered from configuration %s" % (self.conf_1))
+ out, err = self.pfw.sendCmd("getRule",self.domain_name,self.conf_2)
+ assert err == None, "ERROR : command [getRule] - Error while setting rule to configurations %s" % (self.conf_2)
+ assert out == str(self.rule_2), "FAIL : command [getRule] - Error while recovering rule from configuration %s, incorrect value" % (self.conf_2)
+ log.I("command [getRule] correctly executed")
+ log.I("rule correctly recovered from configuration %s" % (self.conf_2))
+
+ # Clearing rules
+ log.I("Clear rules for configurations %s and %s from domain %s" % (self.conf_1,self.conf_2,self.domain_name))
+ log.I("command [clearRule]")
+ out, err = self.pfw.sendCmd("clearRule",self.domain_name,self.conf_1)
+ assert err == None, "ERROR : command [clearRule] - Error on clearRule for configuration %s" % (self.conf_1)
+ assert out == "Done", "FAIL : command [clearRule] - Error on clearRule for configuration %s" % (self.conf_1)
+ out, err = self.pfw.sendCmd("getRule",self.domain_name,self.conf_1)
+ assert out == "<none>", "ERROR : command [clearRule] - ClearRule not working for configuration %s" % (self.conf_1)
+ out, err = self.pfw.sendCmd("clearRule",self.domain_name,self.conf_2)
+ assert err == None, "ERROR : command [clearRule] - Error on clearRule for configuration %s" % (self.conf_2)
+ assert out == "Done", "FAIL : command [clearRule] - Error on clearRule for configuration %s" % (self.conf_2)
+ out, err = self.pfw.sendCmd("getRule",self.domain_name,self.conf_2)
+ assert out == "<none>", "ERROR : command [clearRule] - ClearRule not working for configuration %s" % (self.conf_2)
+ log.I("command [clearRule] correctly executed")
+ log.I("ClearRule effective for configurations %s and %s" % (self.conf_1,self.conf_2))
+
+ # New domain deletion
+ log.I("Domain %s deletion" % (self.domain_name))
+ log.I("command [deleteDomain]")
+ out, err = self.pfw.sendCmd("deleteDomain",self.domain_name, "")
+ assert out == "Done", out
+ assert err == None, "ERROR : command [deleteDomain] - Error while delting domain %s" % (self.domain_name)
+ log.I("command [deleteDomain] correctly executed")
+ log.I("Domain %s deleted" % (self.domain_name))
diff --git a/test/functional-tests/PfwTestCase/Domains/tDomain_Split.py b/test/functional-tests/PfwTestCase/Domains/tDomain_Split.py
new file mode 100644
index 0000000..9d2990e
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Domains/tDomain_Split.py
@@ -0,0 +1,247 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Split elements from domains testcases
+
+List of tested functions :
+--------------------------
+ - [splitDomain] function
+ - [listBelongingDomains] function
+ - [listAssociatedDomains] function
+ - [listAssociatedElements] function
+ - [listConflictingElements] function
+ - [listRogueElements] function
+Test cases :
+------------
+ - Testing nominal case
+"""
+import os.path
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+class TestCases(PfwTestCase):
+
+ def setUp(self):
+ self.pfw.sendCmd("setTuningMode", "on")
+ self.reference_xml = "$PFW_TEST_TOOLS/xml/XML_Test/Reference_Split_Domain.xml"
+
+ self.temp_domain="f_Domains_Backup"
+ self.temp_status="f_Config_Status"
+
+ self.path_main = "/Test/Test/TEST_MAIN/"
+ self.path_dir_0 = "/Test/Test/TEST_MAIN/TEST_DIR_0"
+ self.path_dir_1 = "/Test/Test/TEST_MAIN/TEST_DIR_1"
+ self.path_dir_2 = "/Test/Test/TEST_MAIN/TEST_DIR_2"
+ self.dir_nbr = 3
+ self.element_name = "TEST_DIR"
+
+ self.domain_1 = "Domain_1"
+ self.domain_2 = "Domain_2"
+ self.domain_3 = "Domain_3"
+
+ self.temp_file="f_temp_file"
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+ if os.path.exists(self.temp_file):
+ os.remove(self.temp_file)
+ def test_Combinatorial_Criteria(self):
+ """
+ Testing combinatorial criteria
+ ------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Split a configuration element associated to a domain
+ - Check that the configuration element children are associated to the domain
+ - Pass a configuration element to rogue element
+ - Add a configuration element to another domain and heck that this element is
+ conflicting while not removed from original domain.
+
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [splitDomain] function
+ - [listBelongingDomains] function
+ - [listAssociatedDomains] function
+ - [listAssociatedElements] function
+ - [listConflictingElements] function
+ - [listRogueElements] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - Conform to expected behavior
+ """
+ log.D(self.test_Combinatorial_Criteria.__doc__)
+
+ # Import a reference XML file
+ log.I("Import Domains with settings from %s"%(self.reference_xml))
+ out, err = self.pfw.sendCmd("importDomainsWithSettingsXML",self.reference_xml, "")
+ assert err == None, log.E("Command [importDomainsWithSettingsXML %s] : %s"%(self.reference_xml,err))
+ assert out == "Done", log.F("When using function importDomainsWithSettingsXML %s]"%(self.reference_xml))
+
+ # Checking initial state
+ # Checking domain integrity
+ log.I("Checking initial conditions :")
+ log.I("Checking that %s configurable element is associated to %s :" % (self.path_main,self.domain_1))
+ out, err = self.pfw.sendCmd("listAssociatedDomains", self.path_main)
+ assert err == None, log.E("Command [listAssociatedDomains] : error when listing domain name")
+ f_temp_file = open(self.temp_file, "w")
+ f_temp_file.write(out)
+ f_temp_file.close()
+ element_name = self.domain_1
+ element_found = 0
+ for line in open(self.temp_file, "r"):
+ if element_name in line:
+ element_found = 1
+ assert element_found==1, log.F("configurable element %s not correctly associated to domain %s" % (self.path_main, self.domain_1))
+ log.I("configurable element %s correctly associated to domain %s" % (self.path_main, self.domain_1))
+ # Deleting temp file
+ os.remove(self.temp_file)
+
+ # Checking children integrity
+ log.I("Checking that %s children configurable elements are correctly set for the test" % (self.path_main))
+ out, err = self.pfw.sendCmd("listElements", self.path_main)
+ assert err == None, log.E("Command [listElements] : listing error")
+ f_temp_file = open(self.temp_file, "w")
+ f_temp_file.write(out)
+ f_temp_file.close()
+ for index in range (self.dir_nbr):
+ element_name = "".join([self.element_name, "_", str(index)])
+ element_found = 0
+ for line in open(self.temp_file, "r"):
+ if element_name in line:
+ element_found = 1
+ assert element_found==1, log.F("Element %s not found in %s" % (element_name, self.path_main))
+ log.I("Element %s found in %s" % (element_name, self.path_main))
+ # Checking that child element belong to domain
+ element_path = "".join([self.path_main, element_name])
+ out, err = self.pfw.sendCmd("listBelongingDomains", element_path)
+ assert err == None, log.E("Command [listBelongingDomains] : listing error")
+ assert out == self.domain_1, log.F("Wrong behavior : %s not belonging to %s " % (element_name, self.domain_1))
+ # Checking that child element is not associated to domain, and only belong to it
+ out, err = self.pfw.sendCmd("listAssociatedDomains", element_path)
+ assert err == None, log.E("Command [listAssociatedDomains] : listing error")
+ assert out == '', log.F("Wrong behavior : configurable element %s not associated to %s" % (element_name, self.domain_1))
+ log.I("configurable element %s is belonging to %s" % (element_name, self.domain_1))
+ log.I("Configurable elements : check OK")
+ # Deleting temp file
+ os.remove(self.temp_file)
+
+ # Split domain_0
+ log.I("Splitting configurable element %s from %s" % (self.path_main, self.domain_1))
+ out, err = self.pfw.sendCmd("splitDomain", self.domain_1, self.path_main)
+ assert err == None, log.E("Command [splitDomain] : %s" % (err))
+ assert out == 'Done', log.F("Wrong behavior : configurable element %s not splitted correctly" % (self.path_main))
+ log.I("Splitting done")
+
+ # check that the configurable element splitted is neither associated nor belonging to the domain
+ log.I("Checking that %s is neither associated nor belonging to %s" % (self.path_main, self.domain_1))
+ out, err = self.pfw.sendCmd("listBelongingDomains", self.path_main)
+ assert err == None, log.E("Command [listBelongingDomains] : listing error")
+ assert out != self.domain_1, log.F("Wrong behavior : %s still belonging to %s" % (self.path_main, self.domain_1))
+ out, err = self.pfw.sendCmd("listAssociatedDomains", self.path_main)
+ assert err == None, log.E("Command [listAssociatedDomains] : listing error")
+ assert out == '', log.F("Wrong behavior : configurable element %s still associated to %s" % (self.path_main, self.domain_1))
+ log.I("Configurable element %s is no longer associated to %s" % (self.path_main, self.domain_1))
+
+ # Checking that children configurable elements are now associated to domain
+ log.I("Checking that %s children configurable elements are now associated to %s" % (self.path_main, self.domain_1))
+ out, err = self.pfw.sendCmd("listElements", self.path_main)
+ assert err == None, log.E("Command [listElements] : listing error")
+ f_temp_file = open(self.temp_file, "w")
+ f_temp_file.write(out)
+ f_temp_file.close()
+ for index in range (self.dir_nbr):
+ element_name = "".join([self.element_name, "_", str(index)])
+ element_found = 0
+ for line in open(self.temp_file, "r"):
+ if element_name in line:
+ element_found = 1
+ assert element_found==1, log.F("Element %s not found in %s" % (element_name, self.path_main))
+ log.I("Element %s found in %s" % (element_name, self.path_main))
+ # Checking that child element is associated to domain
+ element_path = "".join([self.path_main, element_name])
+ out, err = self.pfw.sendCmd("listAssociatedDomains", element_path)
+ assert err == None, log.E("Command [listAssociatedDomains] : listing error")
+ assert out == self.domain_1, log.F("Wrong behavior : configurable element %s not associated to %s" % (element_name, self.domain_1))
+ log.I("configurable element %s is associated to %s" % (element_name, self.domain_1))
+ log.I("Configurable elements : check OK")
+ # Deleting temp file
+ os.remove(self.temp_file)
+
+ # Removing one element from domain and checking that it becomes a rogue element
+ log.I("Removing domain element %s from domain %s" % (self.path_dir_0, self.domain_1))
+ out, err = self.pfw.sendCmd("removeElement", str(self.domain_1), str(self.path_dir_0))
+ assert err == None, log.E("ERROR : command [removeElement] - Error while removing domain element %s" % (self.path_dir_0))
+ assert out == "Done", log.F("Domain element %s not correctly removed" % (self.path_dir_0))
+ log.I("Domain element %s correctly removed from domain %s" % (self.path_dir_0, self.domain_1))
+ log.I("Checking that %s is a rogue element" % (self.path_dir_0))
+ out, err = self.pfw.sendCmd("listRogueElements")
+ assert err == None, log.E("command [listRogueElements] - Error while listing rogue elements")
+ f_temp_file = open(self.temp_file, "w")
+ f_temp_file.write(out)
+ f_temp_file.close()
+ element_found = 0
+ for line in open(self.temp_file, "r"):
+ if self.path_dir_0 in line:
+ element_found = 1
+ assert element_found==1, log.F("Configurable element %s not found in rogue elements" % (self.path_dir_0))
+ log.I("Element %s found in rogue elements" % (self.path_dir_0))
+
+ # Moving one configuration element to another domain
+ log.I("Moving configurable element %s from domain %s to domain %s" % (self.path_dir_1, self.domain_1, self.domain_2))
+ log.I("Adding %s to domain %s" % (self.path_dir_1, self.domain_2))
+ out, err = self.pfw.sendCmd("addElement", self.domain_2, self.path_dir_1)
+ assert err == None, log.E("ERROR : command [addElement] - Error while adding element %s to domain %s" % (self.path_dir_1, self.domain_2))
+ out, err = self.pfw.sendCmd("listConflictingElements")
+ assert err == None, log.E("command [listConflictingElements] - Error while listing conflicting elements")
+ f_temp_file = open(self.temp_file, "w")
+ f_temp_file.write(out)
+ f_temp_file.close()
+ element_found = 0
+ for line in open(self.temp_file, "r"):
+ if self.path_dir_1 in line:
+ element_found = 1
+ assert element_found==1, log.F("Configurable element %s not found in conflicting elements" % (self.path_dir_1))
+ log.I("Element %s found in conflicting elements" % (self.path_dir_1))
+ log.I("Removing %s from domain %s" % (self.path_dir_1, self.domain_1))
+ out, err = self.pfw.sendCmd("removeElement", self.domain_1, self.path_dir_1)
+ assert err == None, log.E("ERROR : command [removeElement] - Error while removing element %s from domain %s" % (self.path_dir_1, self.domain_2))
+ out, err = self.pfw.sendCmd("listConflictingElements")
+ assert err == None, log.E("command [listConflictingElements] - Error while listing conflicting elements")
+ f_temp_file = open(self.temp_file, "w")
+ f_temp_file.write(out)
+ f_temp_file.close()
+ element_found = 0
+ for line in open(self.temp_file, "r"):
+ if self.path_dir_1 in line:
+ element_found = 1
+ assert element_found!=1, log.F("Configurable element %s still found in conflicting elements" % (self.path_dir_1))
+ log.I("Element %s no longer found in conflicting elements" % (self.path_dir_1))
diff --git a/test/functional-tests/PfwTestCase/Domains/tDomain_creation_deletion.py b/test/functional-tests/PfwTestCase/Domains/tDomain_creation_deletion.py
new file mode 100644
index 0000000..039830d
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Domains/tDomain_creation_deletion.py
@@ -0,0 +1,344 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Creation, renaming and deletion configuration testcases
+
+List of tested functions :
+--------------------------
+ - [createDomain] function
+ - [deleteDomain] function
+
+Test cases :
+------------
+ - Testing nominal cases
+ - Testing domain creation error
+ - Testing domain deletion error
+"""
+import os
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of Domains - Basic operations (creations/deletions)
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.pfw.sendCmd("setTuningMode", "on")
+ self.new_domains_number = 4
+ self.new_domain_name = "Domain"
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Domain_Creation_Error(self):
+ """
+ Testing domain creation error
+ -----------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Create an already existent domain
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [createDomain] function
+ - [listDomains] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - Error detected when creating an already existent domain
+ - No domains list update
+ """
+ log.D(self.test_Domain_Creation_Error.__doc__)
+ # New domain creation
+ log.I("New domain creation")
+ log.I("command [createDomain]")
+ domain_name = 'Test_Domain'
+ out, err = self.pfw.sendCmd("createDomain",domain_name, "")
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createDomain] - Error while creating domain %s" % (domain_name)
+ log.I("command [createDomain] correctly executed")
+
+ # Domains listing using "listDomains" command
+ log.I("Current domains listing")
+ log.I("command [listDomains]")
+ out, err = self.pfw.sendCmd("listDomains","","")
+ assert err == None, "ERROR : command [listDomains] - Error while listing domains"
+ log.I("command [listDomains] - correctly executed")
+
+ # Domains listing backup
+ f_Domains_Backup = open("f_Domains_Backup", "w")
+ f_Domains_Backup.write(out)
+ f_Domains_Backup.close()
+ f_Domains_Backup = open("f_Domains_Backup", "r")
+ domains_nbr_init = 0
+ line=f_Domains_Backup.readline()
+ while line!="":
+ line=f_Domains_Backup.readline()
+ domains_nbr_init+=1
+ f_Domains_Backup.close()
+ log.I("Actual domains number : %s" % domains_nbr_init)
+
+ # Trying to add an existent domain name
+ log.I("Adding an already existent domain name")
+ log.I("command [createDomain]")
+ domain_name = 'Test_Domain'
+ out, err = self.pfw.sendCmd("createDomain",domain_name, "")
+ assert out != "Done", "ERROR : command [createDomain] - Error not detected when creating an already existent domain"
+ assert err == None, err
+ log.I("command [createDomain] - error correctly detected")
+
+ # Checking domains list integrity
+ log.I("Checking domains listing integrity after domain creation error")
+ ## Domains listing using "listDomains" command
+ out, err = self.pfw.sendCmd("listDomains","","")
+ assert err == None, "ERROR : command [listDomains] - Error while listing domains"
+ f_Domains = open("f_Domains", "w")
+ f_Domains.write(out)
+ f_Domains.close()
+ ## Domains listing integrity check
+ f_Domains = open("f_Domains", "r")
+ domains_nbr = 0
+ line=f_Domains.readline()
+ while line!="":
+ line=f_Domains.readline()
+ domains_nbr+=1
+ f_Domains.close()
+ assert domains_nbr == domains_nbr_init, "ERROR : Domains number error, expected %s, found %s" % (domains_nbr_init,domains_nbr)
+ log.I("Test OK - Domains number not updated")
+ f_Domains = open("f_Domains", "r")
+ f_Domains_Backup = open("f_Domains_Backup", "r")
+ for line in range(domains_nbr):
+ domain_backup_name = f_Domains_Backup.readline().strip('\n'),
+ domain_name = f_Domains.readline().strip('\n'),
+ assert domain_backup_name==domain_name, "ERROR : Error while reading domain %s" % (domain_backup_name)
+ log.I("Test OK - Domains listing not affected by domain creation error")
+
+ # Closing and deleting temp files
+ f_Domains_Backup.close()
+ f_Domains.close()
+ os.remove("f_Domains_Backup")
+ os.remove("f_Domains")
+
+ def test_Domain_Deletion_Error(self):
+ """
+ Testing domain deletion error
+ -----------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Delete a non existent domain
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [deleteDomain] function
+ - [listDomains] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - Error detected when deleting a non-existent domain
+ - No domains list update
+ """
+ log.D(self.test_Domain_Deletion_Error.__doc__)
+ # Domains listing using "listDomains" command
+ log.I("Current domains listing")
+ log.I("command [listDomains]")
+ out, err = self.pfw.sendCmd("listDomains","","")
+ assert err == None, "ERROR : command [listDomains] - Error while listing domains"
+ log.I("command [listDomains] correctly executed")
+
+ # Domains listing backup
+ f_Domains_Backup = open("f_Domains_Backup", "w")
+ f_Domains_Backup.write(out)
+ f_Domains_Backup.close()
+ f_Domains_Backup = open("f_Domains_Backup", "r")
+ domains_nbr_init = 0
+ line=f_Domains_Backup.readline()
+ while line!="":
+ line=f_Domains_Backup.readline()
+ domains_nbr_init+=1
+ f_Domains_Backup.close()
+ log.I("Actual domains number : %s" % domains_nbr_init)
+
+ # Trying to delete a non-existent domain name
+ log.I("Deleting a non-existent domain name")
+ log.I("command [deleteDomain]")
+ domain_name = 'Wrong_Domain_Name'
+ out, err = self.pfw.sendCmd("deleteDomain",domain_name, "")
+ assert out != "Done", "ERROR : command [deleteDomain] - Error not detected when deleting a non-existent domain"
+ assert err == None, err
+ log.I("command [deleteDomain] - error correctly detected")
+
+ # Checking domains list integrity
+ log.I("Checking domains listing integrity after domain deletion error")
+ ## Domains listing using "listDomains" command
+ out, err = self.pfw.sendCmd("listDomains","","")
+ assert err == None, "ERROR : command [listDomains] - Error while listing domains"
+ f_Domains = open("f_Domains", "w")
+ f_Domains.write(out)
+ f_Domains.close()
+ ## Domains listing integrity check
+ f_Domains = open("f_Domains", "r")
+ domains_nbr = 0
+ line=f_Domains.readline()
+ while line!="":
+ line=f_Domains.readline()
+ domains_nbr+=1
+ f_Domains.close()
+ assert domains_nbr == domains_nbr_init, "ERROR : Domains number error, expected %s, found %s" % (domains_nbr_init,domains_nbr)
+ log.I("Test OK - Domains number not updated")
+ f_Domains = open("f_Domains", "r")
+ f_Domains_Backup = open("f_Domains_Backup", "r")
+ for line in range(domains_nbr):
+ domain_backup_name = f_Domains_Backup.readline().strip('\n'),
+ domain_name = f_Domains.readline().strip('\n'),
+ assert domain_backup_name==domain_name, "Error while reading domain %s" % (domain_backup_name)
+ log.I("Test OK - Domains listing not affected by domain deletion error")
+
+ # Closing and deleting temp files
+ f_Domains_Backup.close()
+ f_Domains.close()
+ os.remove("f_Domains_Backup")
+ os.remove("f_Domains")
+
+ def test_Nominal_Case(self):
+ """
+ Testing nominal cases
+ ---------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Create X new domains
+ - Delete X domains
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [createDomain] function
+ - [deleteDomain] function
+ - [listDomains] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - X new domains created
+ - X domains deleted
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ # Initial domains listing using "listDomains" command
+ log.I("Initial domains listing")
+ log.I("command [listDomains]")
+ out, err = self.pfw.sendCmd("listDomains","","")
+ assert err == None, "ERROR : command [listDomains] - Error while listing domains"
+ log.I("command [listDomains] correctly executed")
+
+ # Initial domains number count
+ f_init_domains = open("f_init_domains", "w")
+ f_init_domains.write(out)
+ f_init_domains.close()
+ init_domains_nbr = 0
+ f_init_domains = open("f_init_domains", "r")
+ line=f_init_domains.readline()
+ while line!="":
+ line=f_init_domains.readline()
+ init_domains_nbr+=1
+ f_init_domains.close()
+ log.I("Initial domains number : %s" % (init_domains_nbr))
+
+ # New domains creation
+ log.I("New domains creation")
+ log.I("PFW command : [createDomain]")
+ for index in range (self.new_domains_number):
+ domain_name = "".join([self.new_domain_name, "_", str(index+init_domains_nbr)])
+ out, err = self.pfw.sendCmd("createDomain",domain_name, "")
+ assert out == "Done", "ERROR : %s" % (out)
+ assert err == None, "ERROR : command [createDomain] - Error while creating domain %s" % (domain_name)
+ log.I("command [createDomain] correctly executed")
+
+ # New domain creation check
+ log.I("New domains creation check :")
+ log.I("command [listDomains]")
+ out, err = self.pfw.sendCmd("listDomains","","")
+ assert err == None, "ERROR : command [listDomains] - Error while listing new domains"
+ log.I("command [listDomains] correctly executed")
+
+ # Working on a temporary files to record domains listing
+ tempfile = open("tempfile", "w")
+ tempfile.write(out)
+ tempfile.close()
+
+ # Checking last added entries in the listing
+ tempfile = open("tempfile", "r")
+ domains_nbr = 0
+ line=tempfile.readline()
+ while line!="":
+ line=tempfile.readline()
+ domains_nbr+=1
+ tempfile.close()
+ log.I("New domains conformity check")
+ tempfile = open("tempfile", "r")
+ for line in range(domains_nbr):
+ if (line >= (domains_nbr - self.new_domains_number)):
+ domain_name = "".join([self.new_domain_name,"_",str(line)]),
+ domain_created = tempfile.readline().strip('\n'),
+ assert domain_name==domain_created, "ERROR : Error while creating domain %s %s" % (domain_created, domain_name)
+ else:
+ domain_created = tempfile.readline()
+ log.I("New domains conform to expected values")
+ created_domains_number = domains_nbr - init_domains_nbr
+ log.I("%s new domains created" % created_domains_number)
+ tempfile.close()
+ os.remove("tempfile")
+
+ # New domains deletion
+ log.I("New domains deletion")
+ log.I("command [deleteDomain]")
+ for index in range (self.new_domains_number):
+ domain_name = "".join([self.new_domain_name, "_", str(index+init_domains_nbr)])
+ out, err = self.pfw.sendCmd("deleteDomain",domain_name, "")
+ assert out == "Done", "ERROR : %s" % (out)
+ assert err == None, "ERROR : command [deleteDomain] - Error while deleting domain %s" % (domain_name)
+ log.I("command [deleteDomain] correctly executed")
+
+ # New domains deletion check
+ f_init_domains = open("f_init_domains", "r")
+ tempfile = open("tempfile", "w")
+ log.I("New domains deletion check :")
+ log.I("command [listDomains]")
+ out, err = self.pfw.sendCmd("listDomains","","")
+ assert err == None, "ERROR : command [listDomains] - Error while listing domains"
+ log.I("command [listDomains] correctly executed")
+ tempfile.write(out)
+ tempfile.close()
+ tempfile = open("tempfile", "r")
+ line=tempfile.readline()
+ line_init=f_init_domains.readline()
+ while line!="":
+ line=tempfile.readline()
+ line_init=f_init_domains.readline()
+ assert line == line_init, "ERROR : Domain deletion error"
+ if line=="":
+ assert line_init == "", "ERROR : Wrong domains deletion number"
+ log.I("Deletion completed - %s domains deleted" % created_domains_number)
+
+ # Temporary files deletion
+ tempfile.close()
+ f_init_domains.close()
+ os.remove("tempfile")
+ os.remove("f_init_domains")
diff --git a/test/functional-tests/PfwTestCase/Domains/tDomain_rename.py b/test/functional-tests/PfwTestCase/Domains/tDomain_rename.py
new file mode 100644
index 0000000..81d4539
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Domains/tDomain_rename.py
@@ -0,0 +1,337 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Renaming domains testcases
+
+List of tested functions :
+--------------------------
+ - [renameDomain] function
+
+Test cases :
+------------
+ - Nominal cases
+ - Renaming errors
+ - Special cases
+"""
+import os
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of Domains - Rename
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.pfw.sendCmd("setTuningMode", "on")
+ self.domain_name = "domain_white"
+ self.new_domain_name = "domain_black"
+ self.renaming_iterations = 5
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Nominal case
+ ------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Renaming a domain
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [renameDomain] function
+ - [createDomain] function
+ - [listDomains] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - domains correctly renamed
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ # New domain creation
+ log.I("New domain creation : %s" % (self.domain_name))
+ log.I("command [createDomain]" )
+ out, err = self.pfw.sendCmd("createDomain",self.domain_name, "")
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createDomain] - ERROR while creating domain %s" % (self.domain_name)
+ log.I("command [createDomain] correctly executed")
+ log.I("Domain %s created" % (self.domain_name))
+
+ # Initial domains listing using "listDomains" command
+ log.I("Creating a domains listing backup")
+ log.I("command [listDomains]")
+ out, err = self.pfw.sendCmd("listDomains","","")
+ assert err == None, "INFO : command [listDomains] - ERROR while listing domains"
+ log.I("command [listDomains] correctly executed")
+ # Saving initial domains names
+ f_init_domains = open("f_init_domains", "w")
+ f_init_domains.write(out)
+ f_init_domains.close()
+ log.I("Domains listing backup created")
+
+ # Checking domains number
+ f_init_domains = open("f_init_domains", "r")
+ domains_nbr = 0
+ line=f_init_domains.readline()
+ while line!="":
+ line=f_init_domains.readline()
+ domains_nbr+=1
+ f_init_domains.close()
+ os.remove("f_init_domains")
+ log.I("%s domains names saved" % domains_nbr)
+
+ # Domain renaming iterations
+ log.I("Checking domain renaming - %s iterations" % self.renaming_iterations)
+ old_name = self.domain_name
+ new_name = self.new_domain_name
+ for iteration in range (self.renaming_iterations):
+ log.I("Iteration %s" % (iteration))
+ log.I("Renaming domain %s to %s" % (old_name,new_name))
+ log.I("command [renameDomain]")
+ out, err = self.pfw.sendCmd("renameDomain",old_name,new_name)
+ assert out == "Done", out
+ assert err == None, "ERROR : command [renameDomain] - ERROR while renaming domain %s" % (old_name)
+ # Domains listing using "listDomains" command
+ log.I("Creating a domains listing")
+ log.I("command [listDomains]")
+ out, err = self.pfw.sendCmd("listDomains","","")
+ assert err == None, "ERROR : command [listDomains] - ERROR while listing domains"
+ log.I("command [listDomains] correctly executed")
+ # Saving domains names
+ f_domains = open("f_domains", "w")
+ f_domains.write(out)
+ f_domains.close()
+ log.I("Domains listing created")
+ # Checking renaming
+ log.I("Checking that renaming is correct in domains listing")
+ f_domains = open("f_domains", "r")
+ for line in range(domains_nbr):
+ if (line >= (domains_nbr - 1)):
+ domain_renamed = f_domains.readline().strip('\n')
+ assert domain_renamed==new_name, "ERROR : Error while renaming domain %s" % (old_name)
+ else:
+ f_domains.readline()
+ f_domains.close()
+ log.I("New domain name %s conform to expected value" % (new_name))
+ temp = old_name
+ old_name = new_name
+ new_name = temp
+ os.remove("f_domains")
+
+ def test_Renaming_Error(self):
+ """
+ Renaming errors
+ ---------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - renaming a non existent domain
+ - renaming a domain with an already existent domain name
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [renameDomain] function
+ - [createDomain] function
+ - [renameDomain] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - domains names remain unchanged
+ """
+ log.D(self.test_Renaming_Error.__doc__)
+ # New domains creation
+ log.I("New domain creation : %s" % (self.domain_name))
+ log.I("command [createDomain]")
+ out, err = self.pfw.sendCmd("createDomain",self.domain_name, "")
+ assert out == "Done", out
+ assert err == None, "ERROR : command [createDomain] - Error while creating domain %s" % (self.domain_name)
+ log.I("command [createDomain] - correctly executed")
+ log.I("command Domain %s created" % (self.domain_name))
+
+ # Initial domains listing using "listDomains" command
+ log.I("Creating a domains listing backup")
+ log.I("command [listDomains]")
+ out, err = self.pfw.sendCmd("listDomains","","")
+ assert err == None, "INFO : command [listDomains] - Error while listing domains"
+ log.I("command [listDomains] correctly executed")
+ # Saving initial domains names
+ f_init_domains = open("f_init_domains", "w")
+ f_init_domains.write(out)
+ f_init_domains.close()
+ log.I("Domains listing backup created")
+
+ # Checking domains number
+ f_init_domains = open("f_init_domains", "r")
+ domains_nbr = 0
+ line=f_init_domains.readline()
+ while line!="":
+ line=f_init_domains.readline()
+ domains_nbr+=1
+ f_init_domains.close()
+ log.I("%s domains names saved" % domains_nbr)
+
+ # Domain renaming error : renamed domain does not exist
+ log.I("Renaming a non existent domain")
+ log.I("Renaming domain FAKE to NEW_NAME")
+ log.I("command [renameDomain]")
+ out, err = self.pfw.sendCmd("renameDomain",'FAKE','NEW_NAME')
+ assert out != "Done", out
+ assert err == None, "ERROR : command [renameDomain] - Error while renaming domain"
+ log.I("command [renameDomain] - renaming error correctly detected")
+ # Domains listing using "listDomains" command
+ log.I("Creating a domains listing")
+ log.I("command [listDomains]")
+ out, err = self.pfw.sendCmd("listDomains","","")
+ assert err == None, "ERROR : command [listDomains] - Error while listing domains"
+ log.I("command [listDomains] correctly executed")
+ # Saving domains names
+ f_domains = open("f_domains", "w")
+ f_domains.write(out)
+ f_domains.close()
+ log.I("Domains listing created")
+ # Checking domains names integrity
+ log.I("Checking domains names integrity")
+ f_domains = open("f_domains", "r")
+ f_init_domains = open("f_init_domains", "r")
+ for line in range(domains_nbr):
+ domain_name = f_domains.readline().strip('\n')
+ domain_backup_name = f_init_domains.readline().strip('\n')
+ assert domain_name==domain_backup_name, "ERROR : Domain name %s affected by the renaming error" % (domain_backup_name)
+ f_domains.close()
+ f_init_domains.close()
+ log.I("Domains names not affected by the renaming error")
+ os.remove("f_domains")
+
+ # Domain renaming error : renaming a domain with an already existent domain name
+ log.I("renaming a domain with an already existent domain name")
+ log.I("Renaming domain %s to %s" % (self.domain_name,self.new_domain_name) )
+ log.I("command [renameDomain]")
+ out, err = self.pfw.sendCmd("renameDomain",self.domain_name,self.new_domain_name)
+ assert out != "Done", out
+ assert err == None, "INFO : command [renameDomain] - Error while renaming domain"
+ log.I("command [renameDomain] - renaming error correctly detected")
+ # Domains listing using "listDomains" command
+ log.I("Creating a domains listing")
+ log.I("command [listDomains]")
+ out, err = self.pfw.sendCmd("listDomains","","")
+ assert err == None, "ERROR : command [listDomains] - Error while listing domains"
+ log.I("command [listDomains] correctly executed")
+ # Saving domains names
+ f_domains = open("f_domains", "w")
+ f_domains.write(out)
+ f_domains.close()
+ log.I("Domains listing created")
+ # Checking domains names integrity
+ log.I("Checking domains names integrity")
+ f_domains = open("f_domains", "r")
+ f_init_domains = open("f_init_domains", "r")
+ for line in range(domains_nbr):
+ domain_name = f_domains.readline().strip('\n')
+ domain_backup_name = f_init_domains.readline().strip('\n')
+ assert domain_name==domain_backup_name, "ERROR : domain name %s affected by the renaming error" % (domain_backup_name)
+ f_domains.close()
+ f_init_domains.close()
+ log.I("Domains names not affected by the renaming error")
+ os.remove("f_domains")
+ os.remove("f_init_domains")
+
+ def test_Special_Cases(self):
+ """
+ Special cases
+ -------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - renaming a domain with its own name
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [renameDomain] function
+ - [createDomain] function
+ - [listDomains] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - no error
+ - domains names remain unchanged
+ """
+ log.D(self.test_Special_Cases.__doc__)
+ # New domain creation
+ # Already created in previous test
+
+ # Initial domains listing using "listDomains" command
+ log.I("Creating a domains listing backup")
+ log.I("command [listDomains]")
+ out, err = self.pfw.sendCmd("listDomains","","")
+ assert err == None, "ERROR : command [listDomains] - Error while listing domains"
+ log.I("command [listDomains] correctly executed")
+ # Saving initial domains names
+ f_init_domains = open("f_init_domains", "w")
+ f_init_domains.write(out)
+ f_init_domains.close()
+ log.I("Domains listing backup created")
+
+ # Checking domains number
+ f_init_domains = open("f_init_domains", "r")
+ domains_nbr = 0
+ line=f_init_domains.readline()
+ while line!="":
+ line=f_init_domains.readline()
+ domains_nbr+=1
+ f_init_domains.close()
+ log.I("%s domains names saved" % domains_nbr)
+
+ # Domain renaming error : renaming a domain with its own name
+ log.I("renaming a domain with its own name")
+ log.I("Renaming domain %s to %s" % (self.domain_name,self.domain_name))
+ log.I("command [renameDomain]")
+ out, err = self.pfw.sendCmd("renameDomain",self.domain_name,self.domain_name)
+ assert out == "Done", out
+ assert err == None, "ERROR : command [renameDomain] - Error while renaming domain"
+ log.I("command [renameDomain] correctly executed")
+ # Domains listing using "listDomains" command
+ log.I("Creating a domains listing")
+ log.I("command [listDomains]")
+ out, err = self.pfw.sendCmd("listDomains","","")
+ assert err == None, "ERROR : command [listDomains] - Error while listing domains"
+ log.I("command [listDomains] correctly executed")
+ # Saving domains names
+ f_domains = open("f_domains", "w")
+ f_domains.write(out)
+ f_domains.close()
+ log.I("Domains listing created")
+ # Checking domains names integrity
+ log.I("Checking domains names integrity")
+ f_domains = open("f_domains", "r")
+ f_init_domains = open("f_init_domains", "r")
+ for line in range(domains_nbr):
+ domain_name = f_domains.readline().strip('\n')
+ domain_backup_name = f_init_domains.readline().strip('\n')
+ assert domain_name==domain_backup_name, "ERROR : domain name %s affected by the renaming" % (domain_backup_name)
+ f_domains.close()
+ f_init_domains.close()
+ log.I("Domains names not affected by the renaming")
+
+ os.remove("f_domains")
+ os.remove("f_init_domains")
diff --git a/test/functional-tests/PfwTestCase/Functions/__init__.py b/test/functional-tests/PfwTestCase/Functions/__init__.py
new file mode 100644
index 0000000..7b72df8
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Functions/__init__.py
@@ -0,0 +1,9 @@
+"""
+Functions Package : All testcases about main functions in PFW :
+ - listing functions
+ - help function
+ - status function
+ - export/import functions
+ - get/set parameter functions
+ - synchronization functions
+"""
\ No newline at end of file
diff --git a/test/functional-tests/PfwTestCase/Functions/tFunction_Export_Import_Domains.py b/test/functional-tests/PfwTestCase/Functions/tFunction_Export_Import_Domains.py
new file mode 100644
index 0000000..3af1395
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Functions/tFunction_Export_Import_Domains.py
@@ -0,0 +1,1143 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Export and import settings and domains from file testcases
+
+List of tested functions :
+--------------------------
+ - [exportDomainsWithSettingsXML] function
+ - [importDomainsWithSettingsXML] function
+ - [exportDomainsXML] function
+ - [importDomainsXML] function
+ - [importSettings] function
+ - [exportSettings] function
+
+Test cases :
+------------
+ - Testing importDomainsWithSettingsXML nominal case
+ - Testing exportDomainsWithSettingsXML nominal case
+ - Testing exportDomainsXML/importDomainsXML nominal case
+ - Testing importSettings/exportSettings nominal case
+ - Testing import errors
+ - Testing export errors
+"""
+import os, commands
+import unittest
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+class TestCases(PfwTestCase):
+
+ def setUp(self):
+
+ self.pfw.sendCmd("setTuningMode", "on")
+ self.param_name_01 = "/Test/Test/TEST_DIR/UINT16"
+ self.filesystem_01 = "$PFW_RESULT/UINT16"
+ self.param_name_02 = "/Test/Test/TEST_DOMAIN_0/Param_00"
+ self.filesystem_02 = "$PFW_RESULT/Param_00"
+ self.param_name_03 = "/Test/Test/TEST_DOMAIN_1/Param_12"
+ self.filesystem_03 = "$PFW_RESULT/Param_12"
+
+ pfw_test_tools=os.getenv("PFW_TEST_TOOLS")
+ self.reference_xml = pfw_test_tools+"/xml/XML_Test/Reference_Compliant.xml"
+ self.initial_xml = pfw_test_tools+"/xml/TestConfigurableDomains.xml"
+ self.temp_config="f_Config_Backup"
+ self.temp_domain="f_Domains_Backup"
+ self.temp_xml=pfw_test_tools+"/f_temp.xml"
+ self.temp_binary=pfw_test_tools+"/f_temp.binary"
+
+ self.nb_domains_in_reference_xml=3
+ self.nb_conf_per_domains_in_reference_xml=[2,2,2]
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+ if os.path.exists(self.temp_domain):
+ os.remove(self.temp_domain)
+ if os.path.exists(self.temp_config):
+ os.remove(self.temp_config)
+ if os.path.exists(self.temp_xml):
+ os.remove(self.temp_xml)
+ if os.path.exists(self.temp_binary):
+ os.remove(self.temp_binary)
+
+ def test_01_importDomainsWithSettingsXML_Nominal_Case(self):
+ """
+ Testing importDomainsWithSettingsXML nominal case
+ -------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - import a reference XML
+ - check Domains
+ - check Configuration
+ - restore Configuration
+ - check Parameters
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [createConfiguration] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [restoreConfiguration] function
+ - [listDomains] function
+ - [listConfiguration] function
+ - [getRules] function
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - all operations succeed
+ """
+ log.D(self.test_01_importDomainsWithSettingsXML_Nominal_Case.__doc__)
+
+ #Import a reference XML file
+ log.I("Import Domains with settings from %s"%(self.reference_xml))
+ out, err = self.pfw.sendCmd("importDomainsWithSettingsXML",self.reference_xml, "")
+ assert err == None, log.E("Command [importDomainsWithSettingsXML %s] : %s"%(self.reference_xml,err))
+ assert out == "Done", log.F("When using function importDomainsWithSettingsXML %s]"%(self.reference_xml))
+
+ #Check number of domain(3 domains are setup in the reference XML, initially only one domains is declared)
+ # Domains listing using "listDomains" command
+ log.I("Current domains listing")
+ log.I("Command [listDomains]")
+ out, err = self.pfw.sendCmd("listDomains","","")
+ assert err == None, log.E("Command [listDomains] : %s"%(err))
+ log.I("Command [listDomains] - correctly executed")
+ # Domains listing backup
+ f_Domains_Backup = open(self.temp_domain, "w")
+ f_Domains_Backup.write(out)
+ f_Domains_Backup.close()
+ f_Domains_Backup = open(self.temp_domain, "r")
+ domains_nbr = 0
+ line=f_Domains_Backup.readline()
+ while line!="":
+ line=f_Domains_Backup.readline()
+ domains_nbr+=1
+ f_Domains_Backup.close()
+ log.I("Actual domains number : %s" % domains_nbr)
+ assert domains_nbr==self.nb_domains_in_reference_xml, log.F("Number of listed domains is not compliant with the file %s - expected : %s - found : %s"%(self.reference_xml,self.nb_domains_in_reference_xml, domains_nbr))
+
+ #Check number of config per domain(2 config per domains are setup in the reference XML)
+ # Config listing
+ domain_basename="Domain_"
+ for index in range(self.nb_domains_in_reference_xml):
+ domain_name=domain_basename+str(index+1)
+ log.I("Listing config for domain %s"%(domain_name))
+ out, err = self.pfw.sendCmd("listConfigurations",domain_name,"")
+ assert err == None, log.E("Command [listConfigurations %s] : %s"%(domain_name,err))
+ log.I("Command [listConfigurations %s] - correctly executed"%(domain_name))
+ f_Config_Backup = open(self.temp_config, "w")
+ f_Config_Backup.write(out)
+ f_Config_Backup.close()
+ f_Config_Backup = open(self.temp_config, "r")
+ config_nbr = 0
+ line=f_Config_Backup.readline()
+ while line!="":
+ line=f_Config_Backup.readline()
+ config_nbr+=1
+ f_Config_Backup.close()
+ assert config_nbr==self.nb_conf_per_domains_in_reference_xml[index], log.F("Number of listed config for %s is not compliant with the file %s - expected : %s - found : %s"%(domain_name, self.reference_xml,self.nb_conf_per_domains_in_reference_xml[index], domains_nbr))
+ log.I("Config checking : OK")
+
+ #Check number of config per domain(2 config per domains are setup in the reference XML)
+ # Config listing
+ conf_basename="Conf_"
+ for index_domain in range(3):
+ for index_conf in range(2):
+ domain_name=domain_basename+str(index_domain+1)
+ conf_name=conf_basename+str(index_domain+1)+"_"+str(index_conf)
+ log.I("Get rule for domain %s - conf %s"%(domain_name,conf_name))
+ out, err = self.pfw.sendCmd("getRule",domain_name,conf_name)
+ assert err == None, log.E("Command [getRules %s %s] : %s"%(domain_name,conf_name,err))
+ assert out !="", log.F("No rules loaded for domain %s conf %s"%(domain_name,conf_name))
+ log.I("Rules checking : OK")
+
+ #Restore config
+ conf_basename="Conf_"
+ for index_domain in range(3):
+ for index_conf in range(2):
+ domain_name=domain_basename+str(index_domain+1)
+ conf_name=conf_basename+str(index_domain+1)+"_"+str(index_conf)
+ log.I("Restore config %s for domain %s"%(conf_name,domain_name))
+ out, err = self.pfw.sendCmd("restoreConfiguration",domain_name,conf_name)
+ assert err == None, log.E("Command [restoreConfiguration %s %s] : %s"%(domain_name,conf_name,err))
+ assert out =="Done", log.F("When restoring configuration %s for domain %s"%(conf_name,domain_name))
+ log.I("Restore configurations: OK")
+
+ #set Tuning Mode off to check parameter value
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ #Check parameter values
+ #UINT16
+ expected_value="0"
+ hex_value="0x0"
+ log.I("UINT16 parameter in the conf Conf_1_1= %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_01, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_01, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_01, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_01)) == hex_value, log.F("FILESYSTEM : parameter %s update error"%self.param_name_01)
+ #Param_00
+ expected_value="4"
+ hex_value="0x4"
+ log.I("Param_00 parameter in the conf Conf_2_1= %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_02, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_02, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_02, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_02)) == hex_value, log.F("FILESYSTEM : parameter %s update error"%self.param_name_02)
+ #Param_12
+ expected_value="4"
+ hex_value="0x4"
+ log.I("Param_12 parameter in the conf Conf_3_1= %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_03, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_03, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_03, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_03)) == hex_value, log.F("FILESYSTEM : parameter %s update error"%self.param_name_03)
+ log.I("Parameters checking : OK")
+
+ def test_02_exportDomainsWithSettingsXML_Nominal_Case(self):
+ """
+ Testing exportDomainsWithSettingsXML nominal case
+ -------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - export domains with settings in temp XML
+ - import a reference XML
+ - restore Configuration
+ - import the temp XML
+ - restore Configuration
+ - check Domains
+ - check Configuration
+ - check Parameters
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [exportDomainsWithSettingsXML] function
+ - [importDomainsWithSettingsXML] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [restoreConfiguration] function
+ - [listDomains] function
+ - [listConfiguration] function
+ - [getRules] function
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - all operations succeed
+ """
+ log.D(self.test_02_exportDomainsWithSettingsXML_Nominal_Case.__doc__)
+
+ ### INIT Domains Settings ####
+
+ #Import a reference XML file
+
+ log.I("Import Domains with initial settings from %s"%(self.reference_xml))
+ out, err = self.pfw.sendCmd("importDomainsWithSettingsXML",self.reference_xml, "")
+ assert err == None, log.E("Command [importDomainsWithSettingsXML %s] : %s"%(self.reference_xml,err))
+ assert out == "Done", log.F("When using function importDomainsWithSettingsXML %s]"%(self.reference_xml))
+ self.pfw.sendCmd("setTuningMode", "off","")
+ init_value_01, err = self.pfw.sendCmd("getParameter", self.param_name_01, "")
+ init_value_02, err = self.pfw.sendCmd("getParameter", self.param_name_02, "")
+ init_value_03, err = self.pfw.sendCmd("getParameter", self.param_name_03, "")
+ init_filesystem_01 = commands.getoutput("cat %s"%(self.filesystem_01))
+ init_filesystem_02 = commands.getoutput("cat %s"%(self.filesystem_02))
+ init_filesystem_03 = commands.getoutput("cat %s"%(self.filesystem_03))
+
+ ### END OF INIT ###
+
+ #Export in a temp XML file
+ log.I("Export Domains with initial settings in %s"%(self.temp_xml))
+ out, err = self.pfw.sendCmd("exportDomainsWithSettingsXML",self.temp_xml, "")
+ assert err == None, log.E("Command [exportDomainsWithSettingsXML %s] : %s"%(self.temp_xml,err))
+ assert out == "Done", log.F("When using function exportDomainsWithSettingsXML %s]"%(self.temp_xml))
+
+ #Change the value of checked parameters
+ self.pfw.sendCmd("setTuningMode", "on","")
+ out, err = self.pfw.sendCmd("setParameter", self.param_name_01, str(int(init_value_01)+1))
+ out, err = self.pfw.sendCmd("setParameter", self.param_name_02, str(int(init_value_02)+1))
+ out, err = self.pfw.sendCmd("setParameter", self.param_name_03, str(int(init_value_03)+1))
+ #save config
+ domain_basename="Domain_"
+ conf_basename="Conf_"
+ for index_domain in range(3):
+ for index_conf in range(2):
+ domain_name=domain_basename+str(index_domain+1)
+ conf_name=conf_basename+str(index_domain+1)+"_"+str(index_conf)
+ log.I("Save config %s for domain %s"%(conf_name,domain_name))
+ out, err = self.pfw.sendCmd("saveConfiguration",domain_name,conf_name)
+ assert err == None, log.E("Command [saveConfiguration %s %s] : %s"%(domain_name,conf_name,err))
+ assert out =="Done", log.F("When saving configuration %s for domain %s"%(conf_name,domain_name))
+ log.I("Save configurations: OK")
+ self.pfw.sendCmd("setTuningMode", "off","")
+
+ #Check parameter values
+ #UINT16
+ expected_value=str(int(init_value_01)+1)
+ log.I("UINT16 parameter = %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_01, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_01, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_01, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_01)) != init_filesystem_01, log.F("FILESYSTEM : parameter %s update error"%self.param_name_01)
+ #Param_00
+ expected_value=str(int(init_value_02)+1)
+ log.I("Param_00 parameter= %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_02, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_02, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_02, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_02)) != init_filesystem_02, log.F("FILESYSTEM : parameter %s update error"%self.param_name_02)
+ #Param_12
+ expected_value=str(int(init_value_03)+1)
+ log.I("Param_12 parameter= %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_03, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_03, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_03, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_03)) != init_filesystem_03, log.F("FILESYSTEM : parameter %s update error"%self.param_name_03)
+
+ #Import the temp XML file
+ self.pfw.sendCmd("setTuningMode", "on","")
+ log.I("Import Domains with settings from %s"%(self.temp_xml))
+ out, err = self.pfw.sendCmd("importDomainsWithSettingsXML",self.temp_xml, "")
+ assert err == None, log.E("Command [importDomainsWithSettingsXML %s] : %s"%(self.temp_xml,err))
+ assert out == "Done", log.F("When using function importDomainsWithSettingsXML %s]"%(self.temp_xml))
+ self.pfw.sendCmd("setTuningMode", "off","")
+
+ #Check parameter values
+ #UINT16
+ expected_value=init_value_01
+ log.I("UINT16 parameter = %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_01, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_01, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_01, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_01)) == init_filesystem_01, log.F("FILESYSTEM : parameter %s update error"%self.param_name_01)
+ #Param_00
+ expected_value=init_value_02
+ log.I("Param_00 parameter= %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_02, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_02, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_02, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_02)) == init_filesystem_02, log.F("FILESYSTEM : parameter %s update error"%self.param_name_02)
+ #Param_12
+ expected_value=init_value_03
+ log.I("Param_12 parameter= %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_03, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_03, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_03, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_03)) == init_filesystem_03, log.F("FILESYSTEM : parameter %s update error"%self.param_name_03)
+
+ def test_03_exportImportXML_withoutSettings_Nominal_Case(self):
+ """
+ Testing exportDomainsXML/importDomainsXML nominal case
+ ------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - export domains in temp XML
+ - import a reference XML
+ - restore Configuration
+ - import the temp XML
+ - restore Configuration
+ - check Domains
+ - check Configuration
+ - check Parameters
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [exportDomainsXML] function
+ - [importDomainsWithSettingsXML] function
+ - [importDomainsXML] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [restoreConfiguration] function
+ - [listDomains] function
+ - [listConfiguration] function
+ - [getRules] function
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - all operations succeed
+ - parameter must not change
+ """
+ log.D(self.test_03_exportImportXML_withoutSettings_Nominal_Case.__doc__)
+
+ ### INIT Domains Settings ####
+
+ #Import a reference XML file
+
+ log.I("Import Domains with initial settings from %s"%(self.reference_xml))
+ out, err = self.pfw.sendCmd("importDomainsWithSettingsXML",self.reference_xml, "")
+ assert err == None, log.E("Command [importDomainsWithSettingsXML %s] : %s"%(self.reference_xml,err))
+ assert out == "Done", log.F("When using function importDomainsWithSettingsXML %s]"%(self.reference_xml))
+ self.pfw.sendCmd("setTuningMode", "off","")
+ init_value_01, err = self.pfw.sendCmd("getParameter", self.param_name_01, "")
+ init_value_02, err = self.pfw.sendCmd("getParameter", self.param_name_02, "")
+ init_value_03, err = self.pfw.sendCmd("getParameter", self.param_name_03, "")
+ init_filesystem_01 = commands.getoutput("cat %s"%(self.filesystem_01))
+ init_filesystem_02 = commands.getoutput("cat %s"%(self.filesystem_02))
+ init_filesystem_03 = commands.getoutput("cat %s"%(self.filesystem_03))
+
+ ### END OF INIT ###
+
+ #Export domains without settings in a temp XML file
+ log.I("Export Domains without initial settings in %s"%(self.temp_xml))
+ out, err = self.pfw.sendCmd("exportDomainsXML",self.temp_xml, "")
+ assert err == None, log.E("Command [exportDomainsXML %s] : %s"%(self.temp_xml,err))
+ assert out == "Done", log.F("When using function exportDomainsXML %s]"%(self.temp_xml))
+
+ #Change the value of checked parameters
+ self.pfw.sendCmd("setTuningMode", "on","")
+ out, err = self.pfw.sendCmd("setParameter", self.param_name_01, str(int(init_value_01)+1))
+ out, err = self.pfw.sendCmd("setParameter", self.param_name_02, str(int(init_value_02)+1))
+ out, err = self.pfw.sendCmd("setParameter", self.param_name_03, str(int(init_value_03)+1))
+ #save config
+ domain_basename="Domain_"
+ conf_basename="Conf_"
+ for index_domain in range(3):
+ for index_conf in range(2):
+ domain_name=domain_basename+str(index_domain+1)
+ conf_name=conf_basename+str(index_domain+1)+"_"+str(index_conf)
+ log.I("Save config %s for domain %s"%(conf_name,domain_name))
+ out, err = self.pfw.sendCmd("saveConfiguration",domain_name,conf_name)
+ assert err == None, log.E("Command [saveConfiguration %s %s] : %s"%(domain_name,conf_name,err))
+ assert out =="Done", log.F("When saving configuration %s for domain %s"%(conf_name,domain_name))
+ log.I("Save configurations: OK")
+ self.pfw.sendCmd("setTuningMode", "off","")
+
+ #Check parameter values
+ #UINT16
+ expected_value=str(int(init_value_01)+1)
+ log.I("UINT16 parameter = %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_01, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_01, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_01, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_01)) != init_filesystem_01, log.F("FILESYSTEM : parameter %s update error"%self.param_name_01)
+ #Param_00
+ expected_value=str(int(init_value_02)+1)
+ log.I("Param_00 parameter= %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_02, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_02, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_02, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_02)) != init_filesystem_02, log.F("FILESYSTEM : parameter %s update error"%self.param_name_02)
+ #Param_12
+ expected_value=str(int(init_value_03)+1)
+ log.I("Param_12 parameter= %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_03, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_03, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_03, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_03)) != init_filesystem_03, log.F("FILESYSTEM : parameter %s update error"%self.param_name_03)
+
+ #Import the temp XML file without
+ self.pfw.sendCmd("setTuningMode", "on","")
+ log.I("Import Domains without settings from %s"%(self.temp_xml))
+ out, err = self.pfw.sendCmd("importDomainsXML",self.temp_xml, "")
+ assert err == None, log.E("Command [importDomainsXML %s] : %s"%(self.temp_xml,err))
+ assert out == "Done", log.F("When using function importDomainsXML %s]"%(self.temp_xml))
+ self.pfw.sendCmd("setTuningMode", "off","")
+
+ #Check parameter values
+ #UINT16
+ unexpected_value=init_value_01
+ log.I("UINT16 parameter = %s"%(unexpected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_01, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_01, err))
+ assert out != unexpected_value, log.F("BLACKBOARD : Unexpected value found for %s: %s" % (self.param_name_01, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_01)) != init_filesystem_01, log.F("FILESYSTEM : parameter %s update error"%self.param_name_01)
+ #Param_00
+ unexpected_value=init_value_02
+ log.I("Param_00 parameter= %s"%(unexpected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_02, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_02, err))
+ assert out != unexpected_value, log.F("BLACKBOARD : Unexpected value found for %s: %s" % (self.param_name_02, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_02)) != init_filesystem_02, log.F("FILESYSTEM : parameter %s update error"%self.param_name_02)
+ #Param_12
+ unexpected_value=init_value_03
+ log.I("Param_12 parameter= %s"%(unexpected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_03, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_03, err))
+ assert out != unexpected_value, log.F("BLACKBOARD : Unexpected value found for %s: %s"% (self.param_name_03, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_03)) != init_filesystem_03, log.F("FILESYSTEM : parameter %s update error"%self.param_name_03)
+
+ #Import the reference_XML file without settings
+ self.pfw.sendCmd("setTuningMode", "on","")
+ log.I("Import Domains without settings from %s"%(self.reference_xml))
+ out, err = self.pfw.sendCmd("importDomainsXML",self.reference_xml, "")
+ assert err == None, log.E("Command [importDomainsXML %s] : %s"%(self.reference_xml,err))
+ assert out == "Done", log.F("When using function importDomainsXML %s]"%(self.reference_xml))
+ self.pfw.sendCmd("setTuningMode", "off","")
+
+ #Check parameter values
+ #UINT16
+ unexpected_value=init_value_01
+ log.I("UINT16 parameter = %s"%(unexpected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_01, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_01, err))
+ assert out != unexpected_value, log.F("BLACKBOARD : Unexpected value found for %s: %s" % (self.param_name_01, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_01)) != init_filesystem_01, log.F("FILESYSTEM : parameter %s update error"%self.param_name_01)
+ #Param_00
+ unexpected_value=init_value_02
+ log.I("Param_00 parameter= %s"%(unexpected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_02, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_02, err))
+ assert out != unexpected_value, log.F("BLACKBOARD : Unexpected value found for %s: %s" % (self.param_name_02, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_02)) != init_filesystem_02, log.F("FILESYSTEM : parameter %s update error"%self.param_name_02)
+ #Param_12
+ unexpected_value=init_value_03
+ log.I("Param_12 parameter= %s"%(unexpected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_03, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_03, err))
+ assert out != unexpected_value, log.F("BLACKBOARD : Unexpected value found for %s: %s" % (self.param_name_03, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_03)) != init_filesystem_03, log.F("FILESYSTEM : parameter %s update error"%self.param_name_03)
+
+
+
+ def test_04_exportImportSettings_Binary_Nominal_Case(self):
+ """
+ Testing exportSettings/importSettings nominal case
+ --------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - export settings in temp binary files
+ - import a reference XML
+ - restore Configuration
+ - import the temp binary files
+ - restore Configuration
+ - check Domains
+ - check Configuration
+ - check Parameters
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [exportSettings] function
+ - [importDomainsWithSettingsXML] function
+ - [importSettings] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [restoreConfiguration] function
+ - [listDomains] function
+ - [listConfiguration] function
+ - [getRules] function
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - all operations succeed
+ """
+ log.D(self.test_04_exportImportSettings_Binary_Nominal_Case.__doc__)
+ ### INIT Domains Settings ####
+
+ #Import a reference XML file
+
+ log.I("Import Domains with initial settings from %s"
+ %(self.reference_xml))
+ out, err = self.pfw.sendCmd("importDomainsWithSettingsXML",self.reference_xml, "")
+ assert err == None, log.E("Command [importDomainsWithSettingsXML %s] : %s"%(self.reference_xml,err))
+ assert out == "Done", log.F("When using function importDomainsWithSettingsXML %s]"%(self.reference_xml))
+ self.pfw.sendCmd("setTuningMode", "off","")
+ init_value_01, err = self.pfw.sendCmd("getParameter", self.param_name_01, "")
+ init_value_02, err = self.pfw.sendCmd("getParameter", self.param_name_02, "")
+ init_value_03, err = self.pfw.sendCmd("getParameter", self.param_name_03, "")
+ init_filesystem_01 = commands.getoutput("cat %s"%(self.filesystem_01))
+ init_filesystem_02 = commands.getoutput("cat %s"%(self.filesystem_02))
+ init_filesystem_03 = commands.getoutput("cat %s"%(self.filesystem_03))
+
+ ### END OF INIT ###
+
+ #Export domains without settings in a temp XML file
+ log.I("Export Domains without initial settings in %s"%(self.temp_xml))
+ out, err = self.pfw.sendCmd("exportDomainsXML",self.temp_xml, "")
+ assert err == None, log.E("Command [exportDomainsXML %s] : %s"%(self.temp_xml,err))
+ assert out == "Done", log.F("When using function exportDomainsXML %s]"%(self.temp_xml))
+ #Export settings in a binary temp file
+ log.I("Export settings in the binary files %s"%(self.temp_binary))
+ out, err = self.pfw.sendCmd("exportSettings",self.temp_binary, "")
+ assert err == None, log.E("Command [exportSettings %s] : %s"%(self.temp_binary,err))
+ assert out == "Done", log.F("When using function exportSettings %s]"%(self.temp_binary))
+
+ #Change the value of checked parameters
+ self.pfw.sendCmd("setTuningMode", "on","")
+ out, err = self.pfw.sendCmd("setParameter", self.param_name_01, str(int(init_value_01)+1))
+ out, err = self.pfw.sendCmd("setParameter", self.param_name_02, str(int(init_value_02)+1))
+ out, err = self.pfw.sendCmd("setParameter", self.param_name_03, str(int(init_value_03)+1))
+ #save config
+ domain_basename="Domain_"
+ conf_basename="Conf_"
+ for index_domain in range(3):
+ for index_conf in range(2):
+ domain_name=domain_basename+str(index_domain+1)
+ conf_name=conf_basename+str(index_domain+1)+"_"+str(index_conf)
+ log.I("Save config %s for domain %s"%(conf_name,domain_name))
+ out, err = self.pfw.sendCmd("saveConfiguration",domain_name,conf_name)
+ assert err == None, log.E("Command [saveConfiguration %s %s] : %s"%(domain_name,conf_name,err))
+ assert out =="Done", log.F("When saving configuration %s for domain %s"%(conf_name,domain_name))
+ log.I("Save configurations: OK")
+ self.pfw.sendCmd("setTuningMode", "off","")
+
+ #Check parameter values
+ #UINT16
+ expected_value=str(int(init_value_01)+1)
+ log.I("UINT16 parameter = %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_01, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_01, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_01, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_01)) != init_filesystem_01, log.F("FILESYSTEM : parameter %s update error"%self.param_name_01)
+ #Param_00
+ expected_value=str(int(init_value_02)+1)
+ log.I("Param_00 parameter= %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_02, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_02, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_02, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_02)) != init_filesystem_02, log.F("FILESYSTEM : parameter %s update error"%self.param_name_02)
+ #Param_12
+ expected_value=str(int(init_value_03)+1)
+ log.I("Param_12 parameter= %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_03, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_03, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_03, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_03)) != init_filesystem_03, log.F("FILESYSTEM : parameter %s update error"%self.param_name_03)
+
+ #Import the temp XML file without
+ self.pfw.sendCmd("setTuningMode", "on","")
+ log.I("Import Domains without settings from %s"%(self.temp_xml))
+ out, err = self.pfw.sendCmd("importDomainsXML",self.temp_xml, "")
+ assert err == None, log.E("Command [importDomainsXML %s] : %s"%(self.temp_xml,err))
+ assert out == "Done", log.F("When using function importDomainsXML %s]"%(self.temp_xml))
+ self.pfw.sendCmd("setTuningMode", "off","")
+
+ #Check parameter values
+ #UINT16
+ unexpected_value=init_value_01
+ log.I("UINT16 parameter = %s"%(unexpected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_01, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_01, err))
+ assert out != unexpected_value, log.F("BLACKBOARD : Unexpected value found for %s: %s" % (self.param_name_01, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_01)) != init_filesystem_01, log.F("FILESYSTEM : parameter %s update error"%self.param_name_01)
+ #Param_00
+ unexpected_value=init_value_02
+ log.I("Param_00 parameter= %s"%(unexpected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_02, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_02, err))
+ assert out != unexpected_value, log.F("BLACKBOARD : Unexpected value found for %s: %s" % (self.param_name_02, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_02)) != init_filesystem_02, log.F("FILESYSTEM : parameter %s update error"%self.param_name_02)
+ #Param_12
+ unexpected_value=init_value_03
+ log.I("Param_12 parameter= %s"%(unexpected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_03, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_03, err))
+ assert out != unexpected_value, log.F("BLACKBOARD : Unexpected value found for %s: %s"% (self.param_name_03, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_03)) != init_filesystem_03, log.F("FILESYSTEM : parameter %s update error"%self.param_name_03)
+
+ #Import settings from the binary files
+ self.pfw.sendCmd("setTuningMode", "on","")
+ log.I("Import settings from %s"%(self.temp_binary))
+ out, err = self.pfw.sendCmd("importSettings",self.temp_binary, "")
+ assert err == None, log.E("Command [importSettings %s] : %s"%(self.temp_binary,err))
+ assert out == "Done", log.F("When using function importSettings %s]"%(self.temp_binary))
+ self.pfw.sendCmd("setTuningMode", "off","")
+
+ #Check parameter values
+ #UINT16
+ expected_value=init_value_01
+ log.I("UINT16 parameter = %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_01, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_01, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_01, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_01)) == init_filesystem_01, log.F("FILESYSTEM : parameter %s update error"%self.param_name_01)
+ #Param_00
+ expected_value=init_value_02
+ log.I("Param_00 parameter= %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_02, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_02, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_02, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_02)) == init_filesystem_02, log.F("FILESYSTEM : parameter %s update error"%self.param_name_02)
+ #Param_12
+ expected_value=init_value_03
+ log.I("Param_12 parameter= %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_03, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_03, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_03, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_03)) == init_filesystem_03, log.F("FILESYSTEM : parameter %s update error"%self.param_name_03)
+
+
+
+ @unittest.expectedFailure
+ def test_05_Import_XML_With_Settings_Error_Case(self):
+ """
+ Testing importDomainsWithSettingsXML error case
+ -----------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - import with settings non-compliant XML
+ - import with settings a non-existing XML file
+ - check Domains
+ - check Configuration
+ - check Parameters
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [importDomainsWithSettingsXML] function
+ - [importDomainsXML] function
+ - [importSettings] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [restoreConfiguration] function
+ - [listDomains] function
+ - [listConfiguration] function
+ - [getRules] function
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - all errors are detected, initial domains keep settings
+ """
+ log.D(self.test_05_Import_XML_With_Settings_Error_Case.__doc__)
+
+ ### INIT Domains Settings ####
+ #Import a reference XML file
+
+ log.I("Import Domains with initial settings from %s"%(self.reference_xml))
+ out, err = self.pfw.sendCmd("importDomainsWithSettingsXML",self.reference_xml, "")
+ assert err == None, log.E("Command [importDomainsWithSettingsXML %s] : %s"%(self.reference_xml,err))
+ assert out == "Done", log.F("When using function importDomainsWithSettingsXML %s]"%(self.reference_xml))
+
+ self.pfw.sendCmd("setTuningMode", "off","")
+ init_value_01, err = self.pfw.sendCmd("getParameter", self.param_name_01, "")
+ init_value_02, err = self.pfw.sendCmd("getParameter", self.param_name_02, "")
+ init_value_03, err = self.pfw.sendCmd("getParameter", self.param_name_03, "")
+ init_filesystem_01 = commands.getoutput("cat %s"%(self.filesystem_01))
+ init_filesystem_02 = commands.getoutput("cat %s"%(self.filesystem_02))
+ init_filesystem_03 = commands.getoutput("cat %s"%(self.filesystem_03))
+ xml_path="$PFW_TEST_TOOLS/xml/XML_Test/"
+ ### END OF INIT ###
+
+ self.pfw.sendCmd("setTuningMode", "on","")
+ #Import domains and settings from xml with outbound parameter value
+ xml_name="Uncompliant_OutboundParameter.xml"
+ log.I("Import %s with initial settings"%(xml_name))
+ out, err = self.pfw.sendCmd("importDomainsWithSettingsXML",xml_path+xml_name, "")
+ assert err == None, log.E("Command [importDomainsWithSettingsXML %s] : %s"%(xml_path+xml_name,err))
+ assert out != "Done", log.F("Error not detected when imported %s]"%(xml_path+xml_name))
+ log.I("Test OK : %s is not imported"%(xml_name))
+ #Import domains and settings from xml using undeclared configurable element
+ xml_name="Uncompliant_UndeclaredConfigurableElement.xml"
+ log.I("Import %s with initial settings"%(xml_name))
+ out, err = self.pfw.sendCmd("importDomainsWithSettingsXML",xml_path+xml_name, "")
+ assert err == None, log.E("Command [importDomainsWithSettingsXML %s] : %s"%(xml_path+xml_name,err))
+ assert out != "Done", log.F("Error not detected when imported %s]"%(xml_path+xml_name))
+ log.I("Test OK : %s is not imported"%(xml_name))
+ #Import domains and settings from xml using undeclared parameter
+ xml_name="Uncompliant_UndeclaredParameter.xml"
+ log.I("Import %s with initial settings"%(xml_name))
+ out, err = self.pfw.sendCmd("importDomainsWithSettingsXML",xml_path+xml_name, "")
+ assert err == None, log.E("Command [importDomainsWithSettingsXML %s] : %s"%(xml_path+xml_name,err))
+ assert out != "Done", log.F("Error not detected when imported %s]"%(xml_path+xml_name))
+ log.I("Test OK : %s is not imported"%(xml_name))
+ #Import domains and settings from xml using wrong order of configurable element
+ xml_name="Uncompliant_UnorderConfigurableElement.xml"
+ log.I("Import %s with initial settings"%(xml_name))
+ out, err = self.pfw.sendCmd("importDomainsWithSettingsXML",xml_path+xml_name, "")
+ assert err == None, log.E("Command [importDomainsWithSettingsXML %s] : %s"%(xml_path+xml_name,err))
+ assert out != "Done", log.F("Error not detected when imported %s]"%(xml_path+xml_name))
+ log.I("Test OK : %s is not imported"%(xml_name))
+ #Import domains and settings from unexistent xml
+ xml_name="Unexistent.xml"
+ log.I("Import %s with initial settings"%(xml_name))
+ out, err = self.pfw.sendCmd("importDomainsWithSettingsXML",xml_path+xml_name, "")
+ assert err == None, log.E("Command [importDomainsWithSettingsXML %s] : %s"%(xml_path+xml_name,err))
+ assert out != "Done", log.F("Error not detected when imported %s]"%(xml_path+xml_name))
+ log.I("Test OK : %s is not imported"%(xml_name))
+ self.pfw.sendCmd("setTuningMode", "off","")
+
+ #### check domains and settings ####
+
+ #Check number of domain(3 domains are setup in the reference XML, initially only one domains is declared)
+ # Domains listing using "listDomains" command
+ log.I("Current domains listing")
+ log.I("Command [listDomains]")
+ out, err = self.pfw.sendCmd("listDomains","","")
+ assert err == None, log.E("Command [listDomains] : %s"%(err))
+ log.I("Command [listDomains] - correctly executed")
+ # Domains listing backup
+ f_Domains_Backup = open(self.temp_domain, "w")
+ f_Domains_Backup.write(out)
+ f_Domains_Backup.close()
+ f_Domains_Backup = open(self.temp_domain, "r")
+ domains_nbr = 0
+ line=f_Domains_Backup.readline()
+ while line!="":
+ line=f_Domains_Backup.readline()
+ domains_nbr+=1
+ f_Domains_Backup.close()
+ log.I("Actual domains number : %s" % domains_nbr)
+ assert domains_nbr==self.nb_domains_in_reference_xml, log.F("Number of listed domains is not compliant with the file %s - expected : %s - found : %s"%(self.reference_xml,self.nb_domains_in_reference_xml, domains_nbr))
+ #Check number of config per domain(2 config per domains are setup in the reference XML)
+ # Config listing
+ domain_basename="Domain_"
+ for index in range(self.nb_domains_in_reference_xml):
+ domain_name=domain_basename+str(index+1)
+ log.I("Listing config for domain %s"%(domain_name))
+ out, err = self.pfw.sendCmd("listConfigurations",domain_name,"")
+ assert err == None, log.E("Command [listConfigurations %s] : %s"%(domain_name,err))
+ log.I("Command [listConfigurations %s] - correctly executed"%(domain_name))
+ f_Config_Backup = open(self.temp_config, "w")
+ f_Config_Backup.write(out)
+ f_Config_Backup.close()
+ f_Config_Backup = open(self.temp_config, "r")
+ config_nbr = 0
+ line=f_Config_Backup.readline()
+ while line!="":
+ line=f_Config_Backup.readline()
+ config_nbr+=1
+ f_Config_Backup.close()
+ assert config_nbr==self.nb_conf_per_domains_in_reference_xml[index], log.F("Number of listed config for %s is not compliant with the file %s - expected : %s - found : %s"%(domain_name, self.reference_xml,self.nb_conf_per_domains_in_reference_xml[index], domains_nbr))
+ log.I("Config checking : OK")
+ #Check parameter values
+ #UINT16
+ expected_value=init_value_01
+ hex_value=init_filesystem_01
+ log.I("UINT16 parameter in the conf Conf_1_1= %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_01, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_01, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_01, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_01)) == hex_value, log.F("FILESYSTEM : parameter %s update error"%self.param_name_01)
+ #Param_00
+ expected_value=init_value_02
+ hex_value=init_filesystem_02
+ log.I("Param_00 parameter in the conf Conf_2_1= %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_02, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_02, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_02, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_02)) == hex_value, log.F("FILESYSTEM : parameter %s update error"%self.param_name_02)
+ #Param_12
+ expected_value=init_value_03
+ hex_value=init_filesystem_03
+ log.I("Param_12 parameter in the conf Conf_3_1= %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_03, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_03, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_03, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_03)) == hex_value, log.F("FILESYSTEM : parameter %s update error"%self.param_name_03)
+ log.I("Parameters checking : OK")
+
+ #### END check domains and settings ####
+
+
+ @unittest.expectedFailure
+ def test_06_Import_XML_Without_Settings_Error_Case(self):
+ """
+ Testing import XML without settings error case
+ ----------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - import non-compliant XML
+ - import a non-existing XML files
+ - import a reference XML
+ - check Domains
+ - check Configuration
+ - check Parameters
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [importDomainsWithSettingsXML] function
+ - [importDomainsXML] function
+ - [importSettings] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [restoreConfiguration] function
+ - [listDomains] function
+ - [listConfiguration] function
+ - [getRules] function
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - all errors are detected, initial domains keep settings
+ """
+ log.D(self.test_06_Import_XML_Without_Settings_Error_Case.__doc__)
+
+ ### INIT Domains Settings ####
+ #Import a reference XML file
+
+ log.I("Import Domains with initial settings from %s"%(self.reference_xml))
+ out, err = self.pfw.sendCmd("importDomainsWithSettingsXML",self.reference_xml, "")
+ assert err == None, log.E("Command [importDomainsWithSettingsXML %s] : %s"%(self.reference_xml,err))
+ assert out == "Done", log.F("When using function importDomainsWithSettingsXML %s]"%(self.reference_xml))
+
+ self.pfw.sendCmd("setTuningMode", "off","")
+ xml_path="$PFW_TEST_TOOLS/xml/XML_Test/"
+ ### END OF INIT ###
+
+ self.pfw.sendCmd("setTuningMode", "on","")
+ #Import domains from xml with outbound parameter value
+ xml_name="Uncompliant_OutboundParameter.xml"
+ log.I("Import %s without settings"%(xml_name))
+ out, err = self.pfw.sendCmd("importDomainsXML",xml_path+xml_name, "")
+ assert err == None, log.E("Command [importDomainsXML %s] : %s"%(xml_path+xml_name,err))
+ assert out != "Done", log.F("Error not detected when imported %s]"%(xml_path+xml_name))
+ log.I("Test OK : %s is not imported"%(xml_name))
+ #Import domains from xml using undeclared configurable element
+ xml_name="Uncompliant_UndeclaredConfigurableElement.xml"
+ log.I("Import %s without settings"%(xml_name))
+ out, err = self.pfw.sendCmd("importDomainsXML",xml_path+xml_name, "")
+ assert err == None, log.E("Command [importDomainsXML %s] : %s"%(xml_path+xml_name,err))
+ assert out != "Done", log.F("Error not detected when imported %s]"%(xml_path+xml_name))
+ log.I("Test OK : %s is not imported"%(xml_name))
+ #Import domains from xml using undeclared parameter
+ #xml_name="Uncompliant_UndeclaredParameter.xml"
+ #log.I("Import %s without settings"%(xml_name))
+ #out, err = self.pfw.sendCmd("importDomainsXML",xml_path+xml_name, "")
+ #assert err == None, log.E("Command [importDomainsXML %s] : %s"%(xml_path+xml_name,err))
+ #assert out != "Done", log.F("Error not detected when imported %s]"%(xml_path+xml_name))
+ #log.I("Test OK : %s is not imported"%(xml_name))
+ #Import domains from xml using wrong order of configurable element
+ xml_name="Uncompliant_UnorderConfigurableElement.xml"
+ log.I("Import %s without settings"%(xml_name))
+ out, err = self.pfw.sendCmd("importDomainsXML",xml_path+xml_name, "")
+ assert err == None, log.E("Command [importDomainsXML %s] : %s"%(xml_path+xml_name,err))
+ assert out != "Done", log.F("Error not detected when imported %s]"%(xml_path+xml_name))
+ log.I("Test OK : %s is not imported"%(xml_name))
+ #Import domains from unexistent xml
+ xml_name="Unexistent.xml"
+ log.I("Import %s without settings"%(xml_name))
+ out, err = self.pfw.sendCmd("importDomainsXML",xml_path+xml_name, "")
+ assert err == None, log.E("Command [importDomainsXML %s] : %s"%(xml_path+xml_name,err))
+ assert out != "Done", log.F("Error not detected when imported %s]"%(xml_path+xml_name))
+ log.I("Test OK : %s is not imported"%(xml_name))
+ self.pfw.sendCmd("setTuningMode", "off","")
+
+ #### check domains and settings ####
+
+ #Check number of domain(3 domains are setup in the reference XML, initially only one domains is declared)
+ # Domains listing using "listDomains" command
+ log.I("Current domains listing")
+ log.I("Command [listDomains]")
+ out, err = self.pfw.sendCmd("listDomains","","")
+ assert err == None, log.E("Command [listDomains] : %s"%(err))
+ log.I("Command [listDomains] - correctly executed")
+ # Domains listing backup
+ f_Domains_Backup = open(self.temp_domain, "w")
+ f_Domains_Backup.write(out)
+ f_Domains_Backup.close()
+ f_Domains_Backup = open(self.temp_domain, "r")
+ domains_nbr = 0
+ line=f_Domains_Backup.readline()
+ while line!="":
+ line=f_Domains_Backup.readline()
+ domains_nbr+=1
+ f_Domains_Backup.close()
+ log.I("Actual domains number : %s" % domains_nbr)
+ assert domains_nbr==self.nb_domains_in_reference_xml, log.F("Number of listed domains is not compliant with the file %s - expected : %s - found : %s"%(self.reference_xml,self.nb_domains_in_reference_xml, domains_nbr))
+ #Check number of config per domain(2 config per domains are setup in the reference XML)
+ # Config listing
+ domain_basename="Domain_"
+ for index in range(self.nb_domains_in_reference_xml):
+ domain_name=domain_basename+str(index+1)
+ log.I("Listing config for domain %s"%(domain_name))
+ out, err = self.pfw.sendCmd("listConfigurations",domain_name,"")
+ assert err == None, log.E("Command [listConfigurations %s] : %s"%(domain_name,err))
+ log.I("Command [listConfigurations %s] - correctly executed"%(domain_name))
+ f_Config_Backup = open(self.temp_config, "w")
+ f_Config_Backup.write(out)
+ f_Config_Backup.close()
+ f_Config_Backup = open(self.temp_config, "r")
+ config_nbr = 0
+ line=f_Config_Backup.readline()
+ while line!="":
+ line=f_Config_Backup.readline()
+ config_nbr+=1
+ f_Config_Backup.close()
+ assert config_nbr==self.nb_conf_per_domains_in_reference_xml[index], log.F("Number of listed config for %s is not compliant with the file %s - expected : %s - found : %s"%(domain_name, self.reference_xml,self.nb_conf_per_domains_in_reference_xml[index], domains_nbr))
+ log.I("Config checking : OK")
+
+ #### END check domains and settings ####
+
+
+ @unittest.expectedFailure
+ def test_07_Import_Settings_From_Binary_Error_Case(self):
+ """
+ Testing importDomainsWithSettingsXML error case
+ ----------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - import settings from a non-compliant binary
+ - import settings from a non-existing file
+ - check Domains
+ - check Configuration
+ - check Parameters
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [importDomainsWithSettingsXML] function
+ - [importDomainsXML] function
+ - [importSettings] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [restoreConfiguration] function
+ - [listDomains] function
+ - [listConfiguration] function
+ - [getRules] function
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - all errors are detected, initial domains keep settings
+ """
+ log.D(self.test_07_Import_Settings_From_Binary_Error_Case.__doc__)
+
+ ### INIT Domains Settings ####
+ #Import the initial XML file
+ log.I("Import Domains with initial settings from %s"%(self.initial_xml))
+ out, err = self.pfw.sendCmd("importDomainsWithSettingsXML",self.initial_xml, "")
+ assert err == None, log.E("Command [importDomainsWithSettingsXML %s] : %s"%(self.initial_xml,err))
+ assert out == "Done", log.F("When using function importDomainsWithSettingsXML %s]"%(self.initial_xml))
+ #Export a binary files from the initial setting and config
+ log.I("Export settings in the binary files %s"%(self.temp_binary))
+ out, err = self.pfw.sendCmd("exportSettings",self.temp_binary, "")
+ assert err == None, log.E("Command [exportSettings %s] : %s"%(self.temp_binary,err))
+ assert out == "Done", log.F("When using function exportSettings %s]"%(self.temp_binary))
+ #Import the reference XML file with another configuration
+ log.I("Import Domains with initial settings from %s"%(self.reference_xml))
+ out, err = self.pfw.sendCmd("importDomainsWithSettingsXML",self.reference_xml, "")
+ assert err == None, log.E("Command [importDomainsWithSettingsXML %s] : %s"%(self.reference_xml,err))
+ assert out == "Done", log.F("When using function importDomainsWithSettingsXML %s]"%(self.reference_xml))
+
+ self.pfw.sendCmd("setTuningMode", "off","")
+ init_value_01, err = self.pfw.sendCmd("getParameter", self.param_name_01, "")
+ init_value_02, err = self.pfw.sendCmd("getParameter", self.param_name_02, "")
+ init_value_03, err = self.pfw.sendCmd("getParameter", self.param_name_03, "")
+ init_filesystem_01 = commands.getoutput("cat %s"%(self.filesystem_01))
+ init_filesystem_02 = commands.getoutput("cat %s"%(self.filesystem_02))
+ init_filesystem_03 = commands.getoutput("cat %s"%(self.filesystem_03))
+ xml_path="$PFW_TEST_TOOLS/xml/XML_Test/"
+ ### END OF INIT ###
+
+ self.pfw.sendCmd("setTuningMode", "on","")
+ #Import the temporary binary file, normaly uncompatible with this config
+ self.pfw.sendCmd("setTuningMode", "on","")
+ log.I("Import settings from %s"%(self.temp_binary))
+ out, err = self.pfw.sendCmd("importSettings",self.temp_binary, "")
+ assert err == None, log.E("Command [importSettings %s] : %s"%(self.temp_binary,err))
+ assert out != "Done", log.F("Error not detected when imported %s]"%(self.temp_binary))
+ log.I("Test OK : %s is not imported"%(self.temp_binary))
+ #Import setings from a non-existing binary files
+ name="Unexistent"
+ log.I("Import settings from %s"%(name))
+ out, err = self.pfw.sendCmd("importDomainsWithSettingsXML",xml_path+name, "")
+ assert err == None, log.E("Command [importDomainsWithSettingsXML %s] : %s"%(xml_path+name,err))
+ assert out != "Done", log.F("Error not detected when imported %s]"%(xml_path+name))
+ log.I("Test OK : %s is not imported"%(name))
+ self.pfw.sendCmd("setTuningMode", "off","")
+
+ #### check domains and settings ####
+
+ #Check number of domain(3 domains are setup in the reference XML, initially only one domains is declared)
+ # Domains listing using "listDomains" command
+ log.I("Current domains listing")
+ log.I("Command [listDomains]")
+ out, err = self.pfw.sendCmd("listDomains","","")
+ assert err == None, log.E("Command [listDomains] : %s"%(err))
+ log.I("Command [listDomains] - correctly executed")
+ # Domains listing backup
+ f_Domains_Backup = open(self.temp_domain, "w")
+ f_Domains_Backup.write(out)
+ f_Domains_Backup.close()
+ f_Domains_Backup = open(self.temp_domain, "r")
+ domains_nbr = 0
+ line=f_Domains_Backup.readline()
+ while line!="":
+ line=f_Domains_Backup.readline()
+ domains_nbr+=1
+ f_Domains_Backup.close()
+ log.I("Actual domains number : %s" % domains_nbr)
+ assert domains_nbr==self.nb_domains_in_reference_xml, log.F("Number of listed domains is not compliant with the file %s - expected : %s - found : %s"%(self.reference_xml,self.nb_domains_in_reference_xml, domains_nbr))
+ #Check number of config per domain(2 config per domains are setup in the reference XML)
+ # Config listing
+ domain_basename="Domain_"
+ for index in range(self.nb_domains_in_reference_xml):
+ domain_name=domain_basename+str(index+1)
+ log.I("Listing config for domain %s"%(domain_name))
+ out, err = self.pfw.sendCmd("listConfigurations",domain_name,"")
+ assert err == None, log.E("Command [listConfigurations %s] : %s"%(domain_name,err))
+ log.I("Command [listConfigurations %s] - correctly executed"%(domain_name))
+ f_Config_Backup = open(self.temp_config, "w")
+ f_Config_Backup.write(out)
+ f_Config_Backup.close()
+ f_Config_Backup = open(self.temp_config, "r")
+ config_nbr = 0
+ line=f_Config_Backup.readline()
+ while line!="":
+ line=f_Config_Backup.readline()
+ config_nbr+=1
+ f_Config_Backup.close()
+ assert config_nbr==self.nb_conf_per_domains_in_reference_xml[index], log.F("Number of listed config for %s is not compliant with the file %s - expected : %s - found : %s"%(domain_name, self.reference_xml,self.nb_conf_per_domains_in_reference_xml[index], domains_nbr))
+ log.I("Config checking : OK")
+ #Check parameter values
+ #UINT16
+ expected_value=init_value_01
+ hex_value=init_filesystem_01
+ log.I("UINT16 parameter in the conf Conf_1_1= %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_01, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_01, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_01, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_01)) == hex_value, log.F("FILESYSTEM : parameter %s update error"%self.param_name_01)
+ #Param_00
+ expected_value=init_value_02
+ hex_value=init_filesystem_02
+ log.I("Param_00 parameter in the conf Conf_2_1= %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_02, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_02, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_02, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_02)) == hex_value, log.F("FILESYSTEM : parameter %s update error"%self.param_name_02)
+ #Param_12
+ expected_value=init_value_03
+ hex_value=init_filesystem_03
+ log.I("Param_12 parameter in the conf Conf_3_1= %s"%(expected_value))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name_03, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name_03, err))
+ assert out == expected_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name_03, expected_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_03)) == hex_value, log.F("FILESYSTEM : parameter %s update error"%self.param_name_03)
+ log.I("Parameters checking : OK")
diff --git a/test/functional-tests/PfwTestCase/Functions/tFunction_Sync.py b/test/functional-tests/PfwTestCase/Functions/tFunction_Sync.py
new file mode 100644
index 0000000..993e8e1
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Functions/tFunction_Sync.py
@@ -0,0 +1,250 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+synchronization functions testcases
+
+List of tested functions :
+--------------------------
+ - [getAutoSync] function
+ - [setAutoSync] function
+ - [sync] function
+
+Test cases :
+------------
+ - Testing getAutoSync nominal case
+ - Testing setAutoSync nominal case
+ - Testing sync nominal case
+ - Testing errors
+"""
+import commands, os
+import unittest
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+class TestCases(PfwTestCase):
+
+ def setUp(self):
+
+ pfw_filesystem=os.getenv("PFW_RESULT")
+
+ self.pfw.sendCmd("setTuningMode", "on")
+ self.param_name_01 = "/Test/Test/TEST_DIR/BOOL"
+ self.filesystem_01 = pfw_filesystem+"/BOOL"
+ self.param_name_02 = "/Test/Test/TEST_DIR/INT16"
+ self.filesystem_02 = pfw_filesystem+"/INT16"
+ self.param_name_03 = "/Test/Test/TEST_DIR/UINT32"
+ self.filesystem_03 = pfw_filesystem+"/UINT32"
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_01_getAutoSync_Case(self):
+ """
+ Testing getAutoSync nominal case
+ ----------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - enable autosync
+ - get autosync state
+ - disable autosync
+ - get autosync state
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setAutoSync] function
+ - [getAutoSync] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - getAutoSync return expected state
+ """
+ log.D(self.test_01_getAutoSync_Case.__doc__)
+ value = "on"
+ log.I("Enable autosync")
+ out,err = self.pfw.sendCmd("setAutoSync", value)
+ assert err == None, log.E("When enabling autosync : %s" % (err))
+ assert out == "Done", log.F("setAutoSync - expected : Done , found : %s" % (out))
+ log.I("Check autosync state")
+ out, err = self.pfw.sendCmd("getAutoSync","")
+ assert err == None, log.E("When getting autosync state : %s" % (err))
+ assert out == value, log.F("setAutoSync - expected : %s , found : %s" % (value,out))
+ value = "off"
+ log.I("Disable autosync")
+ out,err = self.pfw.sendCmd("setAutoSync", value)
+ assert err == None, log.E("When enabling autosync : %s" % (err))
+ assert out == "Done", log.F("setAutoSync - expected : Done , found : %s" % (out))
+ log.I("Check autosync state")
+ out, err = self.pfw.sendCmd("getAutoSync","")
+ assert err == None, log.E("When getting autosync state : %s" % (err))
+ assert out == value, log.F("setAutoSync - expected : %s , found : %s" % (value,out))
+
+ def test_02_setAutoSync_Case(self):
+ """
+ Testing getAutoSync nominal case
+ -------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - enable autosync
+ - set differents parameters
+ - check the value on the filesystem
+ - disable autosync
+ - set differents parameters
+ - check the value on the filesystem
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setAutoSync] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getAutoSync] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - When autosync is enabled, the filesystem is automatically
+ synchronized with the blackboard.
+ """
+ log.D(self.test_02_setAutoSync_Case.__doc__)
+ #Check the initial parameter value
+ init_value_01, err = self.pfw.sendCmd("getParameter", self.param_name_01, "")
+ init_value_02, err = self.pfw.sendCmd("getParameter", self.param_name_02, "")
+ init_value_03, err = self.pfw.sendCmd("getParameter", self.param_name_03, "")
+ init_filesystem_01 = commands.getoutput("cat %s"%(self.filesystem_01))
+ init_filesystem_02 = commands.getoutput("cat %s"%(self.filesystem_02))
+ init_filesystem_03 = commands.getoutput("cat %s"%(self.filesystem_03))
+ #Implement a new value
+ if int(init_value_01)==0 :
+ new_value_01 = "1"
+ else :
+ new_value_01 = "0"
+ new_value_02 = str(int(init_value_02)+1)
+ new_value_03 = str(int(init_value_03)+1)
+ #Enable the autosync
+ value = "on"
+ log.I("Enable autosync")
+ out,err = self.pfw.sendCmd("setAutoSync", value)
+ assert err == None, log.E("When enabling autosync : %s" % (err))
+ assert out == "Done", log.F("setAutoSync - expected : Done , found : %s" % (out))
+ #Set the new parameter value
+ self.pfw.sendCmd("setParameter", self.param_name_01, new_value_01)
+ self.pfw.sendCmd("setParameter", self.param_name_02, new_value_02)
+ self.pfw.sendCmd("setParameter", self.param_name_03, new_value_03)
+ #Check the filesystem values
+ #BOOL
+ assert commands.getoutput("cat %s"%(self.filesystem_01)) != init_filesystem_01, log.F("FILESYSTEM : parameter %s update error"%self.param_name_01)
+ #INT16
+ assert commands.getoutput("cat %s"%(self.filesystem_02)) != init_filesystem_02, log.F("FILESYSTEM : parameter %s update error"%self.param_name_02)
+ #UINT32
+ assert commands.getoutput("cat %s"%(self.filesystem_03)) != init_filesystem_03, log.F("FILESYSTEM : parameter %s update error"%self.param_name_03)
+ log.I("test setAutoSync %s : OK"%(value))
+ #Enable the autosync
+ value = "off"
+ log.I("Disable autosync")
+ out,err = self.pfw.sendCmd("setAutoSync", value)
+ assert err == None, log.E("When enabling autosync : %s" % (err))
+ assert out == "Done", log.F("setAutoSync - expected : Done , found : %s" % (out))
+ #Set the new parameter value
+ self.pfw.sendCmd("setParameter", self.param_name_01, init_value_01)
+ self.pfw.sendCmd("setParameter", self.param_name_02, init_value_02)
+ self.pfw.sendCmd("setParameter", self.param_name_03, init_value_03)
+ #Check the filesystem values
+ #BOOL
+ assert commands.getoutput("cat %s"%(self.filesystem_01)) != init_filesystem_01, log.F("FILESYSTEM : parameter %s is updated, autosync is still enabled"%self.param_name_01)
+ #INT16
+ assert commands.getoutput("cat %s"%(self.filesystem_02)) != init_filesystem_02, log.F("FILESYSTEM : parameter %s is updated, autosync is still enabled"%self.param_name_02)
+ #UINT32
+ assert commands.getoutput("cat %s"%(self.filesystem_03)) != init_filesystem_03, log.F("FILESYSTEM : parameter %s is updated, autosync is still enabled"%self.param_name_03)
+ log.I("test setAutoSync %s : OK"%(value))
+
+
+ @unittest.expectedFailure
+ def test_03_Manual_Sync_Case(self):
+ """
+ Testing getAutoSync nominal case
+ -------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - disable autosync
+ - set differents parameters
+ - check the value on the filesystem
+ - sync
+ - check the value on the filesystem
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [sync] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [setAutoSync] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - sync should synchronized filessystem with blackboard
+ """
+ log.D(self.test_03_Manual_Sync_Case.__doc__)
+ #Check the initial parameter value
+ init_value_01, err = self.pfw.sendCmd("getParameter", self.param_name_01, "")
+ init_value_02, err = self.pfw.sendCmd("getParameter", self.param_name_02, "")
+ init_value_03, err = self.pfw.sendCmd("getParameter", self.param_name_03, "")
+ init_filesystem_01 = commands.getoutput("cat %s"%(self.filesystem_01))
+ init_filesystem_02 = commands.getoutput("cat %s"%(self.filesystem_02))
+ init_filesystem_03 = commands.getoutput("cat %s"%(self.filesystem_03))
+ #Implement a new value
+ if int(init_value_01)==0 :
+ new_value_01 = "1"
+ else :
+ new_value_01 = "0"
+ new_value_02 = str(int(init_value_02)+1)
+ new_value_03 = str(int(init_value_03)+1)
+ #Enable the autosync
+ value = "off"
+ log.I("Disable autosync")
+ out,err = self.pfw.sendCmd("setAutoSync", value)
+ assert err == None, log.E("When enabling autosync : %s" % (err))
+ assert out == "Done", log.F("setAutoSync - expected : Done , found : %s" % (out))
+ #Set the new parameter value
+ self.pfw.sendCmd("setParameter", self.param_name_01, new_value_01)
+ self.pfw.sendCmd("setParameter", self.param_name_02, new_value_02)
+ self.pfw.sendCmd("setParameter", self.param_name_03, new_value_03)
+ #Check the filesystem values, must not changed
+ #BOOL
+ assert commands.getoutput("cat %s"%(self.filesystem_01)) == init_filesystem_01, log.F("FILESYSTEM : parameter %s update error"%self.param_name_01)
+ #INT16
+ assert commands.getoutput("cat %s"%(self.filesystem_02)) == init_filesystem_02, log.F("FILESYSTEM : parameter %s update error"%self.param_name_02)
+ #UINT32
+ assert commands.getoutput("cat %s"%(self.filesystem_03)) == init_filesystem_03, log.F("FILESYSTEM : parameter %s update error"%self.param_name_03)
+ log.I("test setAutoSync %s : OK"%(value))
+ log.I("Sync")
+ out,err = self.pfw.sendCmd("sync", "")
+ assert err == None, log.E("When syncing : %s" % (err))
+ assert out == "Done", log.F("Sync - expected : Done , found : %s" % (out))
+ #Check the filesystem values
+ #BOOL
+ assert commands.getoutput("cat %s"%(self.filesystem_01)) != init_filesystem_01, log.F("FILESYSTEM : parameter %s is updated, autosync is still enabled"%self.param_name_01)
+ #INT16
+ assert commands.getoutput("cat %s"%(self.filesystem_02)) != init_filesystem_02, log.F("FILESYSTEM : parameter %s is updated, autosync is still enabled"%self.param_name_02)
+ #UINT32
+ assert commands.getoutput("cat %s"%(self.filesystem_03)) != init_filesystem_03, log.F("FILESYSTEM : parameter %s is updated, autosync is still enabled"%self.param_name_03)
+ log.I("test setAutoSync %s : OK"%(value))
diff --git a/test/functional-tests/PfwTestCase/Functions/tFunction_getParameter.py b/test/functional-tests/PfwTestCase/Functions/tFunction_getParameter.py
new file mode 100644
index 0000000..2e02713
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Functions/tFunction_getParameter.py
@@ -0,0 +1,76 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+getParameter testcase
+
+List of tested functions :
+--------------------------
+ - [getParameter] function
+
+Test cases :
+------------
+ This function is intensively tested through all the tests of data types.
+ We test only function commands errors in that script
+"""
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.pfw.sendCmd("setTuningMode", "on")
+ self.param_name = "/Test/Test/TEST_DIR/INT8"
+
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Function_Commands_Errors(self):
+ """
+ Testing importDomainsWithSettingsXML nominal case
+ -------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - getParameter with a wrong parameter name
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - errors correctly detected
+ """
+ log.D(self.test_Function_Commands_Errors.__doc__)
+ #Get undefined parameter value
+ log.I("Get undefined parameter value")
+ out, err = self.pfw.sendCmd("getParameter", "Undefined_parameter")
+ print str(out)
+ assert err == None, "Error when getting parameter : %s" % (err)
+ assert out != "Done", "Error not detected when getting an undefined parameter"
diff --git a/test/functional-tests/PfwTestCase/Functions/tFunction_listingFunctions.py b/test/functional-tests/PfwTestCase/Functions/tFunction_listingFunctions.py
new file mode 100644
index 0000000..5fa9fd0
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Functions/tFunction_listingFunctions.py
@@ -0,0 +1,551 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+All listing and dumping function testcases.
+
+List of tested functions :
+--------------------------
+ - [dumpDomains] function
+ - [dumpElement] function
+
+Test cases :
+------------
+ - Testing dumpDomains function on nominal case
+ - Testing dumpElements function on nominal case
+"""
+import commands, os
+import unittest
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+class TestCases(PfwTestCase):
+
+ def setUp(self):
+
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ pfw_test_tools=os.getenv("PFW_TEST_TOOLS")
+ self.reference_dumpDomains_xml = pfw_test_tools+"/xml/XML_Test/Reference_dumpDomains.xml"
+ self.reference_dumpDomains_file = pfw_test_tools+"/xml/XML_Test/Reference_dumpDomains"
+ self.initial_xml = pfw_test_tools+"/xml/TestConfigurableDomains.xml"
+
+ self.list_domains=[]
+ self.list_criteria=["Crit_0", "Crit_1"]
+ self.list_parameters=[]
+ self.temp_file="tempfile"
+
+ self.domain_name = "Domain_0"
+ self.config_name = "Conf_0"
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+ if os.path.exists(self.temp_file):
+ os.remove(self.temp_file)
+
+ def test_01_dumpDomains_Case(self):
+ """
+ Testing dumpDomains function
+ ----------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - import a reference XML : Reference_DumpDomains.xml
+ - dumpDomains
+ - compare out to a reference file : Reference_DumpDomains
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [dumpDomains] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [importDomainsWithSettingsXML] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - string stdout due to dumpDomains is the same than string in
+ the reference file
+ """
+ log.D(self.test_01_dumpDomains_Case.__doc__)
+
+ #Import a reference XML file
+ log.I("Import Domains with settings from %s"%(self.reference_dumpDomains_xml))
+ out, err = self.pfw.sendCmd("importDomainsWithSettingsXML",self.reference_dumpDomains_xml, "")
+ assert err == None, log.E("Command [importDomainsWithSettingsXML %s] : %s"%(self.reference_dumpDomains_xml,err))
+ assert out == "Done", log.F("When using function importDomainsWithSettingsXML %s]"%(self.reference_dumpDomains_xml))
+
+ log.I("Command [dumpDomains]")
+ out, err = self.pfw.sendCmd("dumpDomains","","")
+ assert err == None, log.E("Command [dumpDomains] : %s"%(err))
+ assert out == commands.getoutput("cat %s"%(self.reference_dumpDomains_file)), log.F("A diff is found between dumpDomains output and %s"%(self.reference_dumpDomains_file))
+ log.I("Command [dumpDomains] - correctly executed")
+
+ def test_03_help_Case(self):
+ """
+ Testing help function
+ ---------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - help
+ - check results
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [help] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - string stdout due to help is not empty
+ """
+ log.D(self.test_03_help_Case.__doc__)
+ log.I("Command [help]")
+ out, err = self.pfw.sendCmd("help","")
+ assert err == None, log.E("Command [help] : %s"%(err))
+ assert out != ""
+ log.I("Command [help] - correctly executed")
+
+ def test_04_status_Case(self):
+ """
+ Testing status function
+ -----------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - status
+ - check results
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [status] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - string stdout due to status is not empty
+ """
+ log.D(self.test_04_status_Case.__doc__)
+ log.I("Command [status]")
+ out, err = self.pfw.sendCmd("status","")
+ assert err == None, log.E("Command [help] : %s"%(err))
+ assert out != ""
+ log.I("Command [status] - correctly executed")
+
+ def test_05_listCriteria_Case(self):
+ """
+ Testing listCriteria function
+ -----------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - listCriteria
+ - check results
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [listCriteria] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - string stdout due to listCriteria is not empty
+ """
+ log.D(self.test_05_listCriteria_Case.__doc__)
+ log.I("Command [listCriteria]")
+ out, err = self.pfw.sendCmd("listCriteria","")
+ assert err == None, log.E("Command [listCriteria] : %s"%(err))
+ assert out != ""
+ log.I("Command [listCriteria] - correctly executed")
+
+ def test_06_listDomains_Case(self):
+ """
+ Testing listDomains function
+ ----------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - listDomains
+ - check results
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [listDomains] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - string stdout due to listDomains is not empty
+ """
+ log.D(self.test_06_listDomains_Case.__doc__)
+ log.I("Command [listDomains]")
+ out, err = self.pfw.sendCmd("listDomains")
+ assert err == None, log.E("Command [listDomains] : %s"%(err))
+ assert out != ""
+ log.I("Command [listDomains] - correctly executed")
+
+ @unittest.expectedFailure
+ def test_06_listDomainElements_Case(self):
+ """
+ Testing listDomains function
+ ----------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - listDomainElements
+ - check results
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [listDomainElements] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - string stdout due to listDomains is not empty
+ """
+ log.D(self.test_06_listDomainElements_Case.__doc__)
+ log.I("Command [listDomainElements]")
+ out, err = self.pfw.sendCmd("listDomainElements",self.domain_name)
+ assert err == None, log.E("Command [listDomainElements] : %s"%(err))
+ assert out != "", log.F("Fail when listDomainElements %s: stdout is empty"%(self.domain_name))
+ log.I("Command [listDomainElements] - correctly executed")
+
+ @unittest.expectedFailure
+ def test_07_listConfigurations_Case(self):
+ """
+ Testing listConfigurations function
+ -----------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - listConfigurations
+ - check results
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [listConfigurations] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - string stdout due to listConfigurations is not empty
+ """
+ log.D(self.test_07_listConfigurations_Case.__doc__)
+ log.I("Command [listConfigurations]")
+ out, err = self.pfw.sendCmd("listConfigurations",self.domain_name)
+ assert err == None, log.E("Command [listConfigurations] : %s"%(err))
+ assert out != "", log.F("Fail when listConfigurations %s: stdout is empty"%(self.domain_name))
+ log.I("Command [listConfigurations] - correctly executed")
+
+ def test_08_listElements_Case(self):
+ """
+ Testing listElements function
+ -----------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - listElements
+ - check results
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [listElements] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - string stdout due to listElements is not empty
+ """
+ log.D(self.test_08_listElements_Case.__doc__)
+ log.I("Command [listElements]")
+ out, err = self.pfw.sendCmd("listElements")
+ assert err == None, log.E("Command [listElements] : %s"%(err))
+ out, err = self.pfw.sendCmd("listElements","/Test/")
+ assert err == None, log.E("Command [listElements /Test/] : %s"%(err))
+ assert out != ""
+ log.I("Command [listElements] - correctly executed")
+
+ def test_09_listParameters_Case(self):
+ """
+ Testing listParameters function
+ -------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - listParameters
+ - check results
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [listParameters] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - string stdout due to listParameters is not empty
+ """
+ log.D(self.test_09_listParameters_Case.__doc__)
+ log.I("Command [listParameters]")
+ out, err = self.pfw.sendCmd("listParameters")
+ assert err == None, log.E("Command [listParameters] : %s"%(err))
+ out, err = self.pfw.sendCmd("listParameters","/Test/")
+ assert err == None, log.E("Command [listParameters /Test/] : %s"%(err))
+ assert out != ""
+ log.I("Command [listParameters] - correctly executed")
+
+ def test_10_getElementSize_Case(self):
+ """
+ Testing getElementSize function
+ -------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - listParameters
+ - getElementSize for all parameters
+ - check results
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [getElementSize] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [listParameters] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - string stdout due to getElementSize is not empty
+ """
+ log.D(self.test_10_getElementSize_Case.__doc__)
+ log.I("Command [listParameters]")
+ out, err = self.pfw.sendCmd("listParameters","/Test/")
+ assert err == None, log.E("Command [listParameters /Test/] : %s"%(err))
+ assert out != ""
+ log.I("Command [listParameters] - correctly executed")
+ # Write out in temp file
+ f_temp_file = open(self.temp_file, "w")
+ f_temp_file.write(out)
+ f_temp_file.close()
+
+ # Extract parameter from the temp file
+ f_temp_file = open(self.temp_file, "r")
+ lines = f_temp_file.readlines()
+ f_temp_file.close()
+
+ for line in lines :
+ if not line.find("/") == -1 :
+ final_position_in_line= line.find("[")-1
+ self.list_parameters.append(line[0:final_position_in_line])
+
+ for parameter in self.list_parameters :
+ out, err = self.pfw.sendCmd("getElementSize",parameter)
+ assert err == None, log.E("Command [getElementSize %s] : %s"%(parameter,err))
+ assert out != ""
+
+ out, err = self.pfw.sendCmd("getElementSize","/Test/")
+ assert err == None, log.E("Command [getElementSize /Test/] : %s"%(err))
+ assert out != ""
+
+ out, err = self.pfw.sendCmd("getElementSize")
+ assert err == None, log.E("Command [getElementSize /Test/] : %s"%(err))
+
+ def test_11_showProperties_Case(self):
+ """
+ Testing showProperties function
+ -------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - listParameters
+ - showProperties for all parameters
+ - check results
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [showProperties] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [listParameters] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - string stdout due to getElementSize is not empty
+ """
+ log.D(self.test_11_showProperties_Case.__doc__)
+ log.I("Command [listParameters]")
+ out, err = self.pfw.sendCmd("listParameters","/Test/")
+ assert err == None, log.E("Command [listParameters /Test/] : %s"%(err))
+ assert out != ""
+ log.I("Command [listParameters] - correctly executed")
+ # Write out in temp file
+ f_temp_file = open(self.temp_file, "w")
+ f_temp_file.write(out)
+ f_temp_file.close()
+
+ # Extract parameter from the temp file
+ f_temp_file = open(self.temp_file, "r")
+ lines = f_temp_file.readlines()
+ f_temp_file.close()
+
+ for line in lines :
+ if not line.find("/") == -1 :
+ final_position_in_line= line.find("[")-1
+ self.list_parameters.append(line[0:final_position_in_line])
+
+ for parameter in self.list_parameters :
+ out, err = self.pfw.sendCmd("showProperties",parameter)
+ assert err == None, log.E("Command [showProperties %s] : %s"%(parameter,err))
+ assert out != ""
+
+ out, err = self.pfw.sendCmd("showProperties","/Test/")
+ assert err == None, log.E("Command [showProperties /Test/] : %s"%(err))
+ assert out != ""
+
+ out, err = self.pfw.sendCmd("showProperties")
+ assert err == None, log.E("Command [showProperties] : %s"%(err))
+
+ def test_12_listBelongingDomains_Case(self):
+ """
+ Testing listBelongingDomains function
+ -------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - listParameters
+ - listBelongingDomains for all parameters
+ - check results
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [listBelongingDomains] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [listParameters] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - string stdout due to listBelongingDomains is not empty
+ """
+ log.D(self.test_12_listBelongingDomains_Case.__doc__)
+ log.I("Command [listParameters]")
+ out, err = self.pfw.sendCmd("listParameters","/Test/")
+ assert err == None, log.E("Command [listParameters /Test/] : %s"%(err))
+ assert out != ""
+ log.I("Command [listParameters] - correctly executed")
+ # Write out in temp file
+ f_temp_file = open(self.temp_file, "w")
+ f_temp_file.write(out)
+ f_temp_file.close()
+
+ # Extract parameter from the temp file
+ f_temp_file = open(self.temp_file, "r")
+ lines = f_temp_file.readlines()
+ f_temp_file.close()
+
+ for line in lines :
+ if not line.find("/") == -1 :
+ final_position_in_line= line.find("[")-1
+ self.list_parameters.append(line[0:final_position_in_line])
+
+ for parameter in self.list_parameters :
+ out, err = self.pfw.sendCmd("listBelongingDomains",parameter)
+ assert err == None, log.E("Command [listBelongingDomains %s] : %s"%(parameter,err))
+
+ out, err = self.pfw.sendCmd("listBelongingDomains","/Test/")
+ assert err == None, log.E("Command [listBelongingDomains /Test/] : %s"%(err))
+
+ out, err = self.pfw.sendCmd("listBelongingDomains")
+ assert err == None, log.E("Command [listBelongingDomains] : %s"%(err))
+
+ def test_13_listAssociatedDomains_Case(self):
+ """
+ Testing listAssociatedDomains function
+ -------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - listParameters
+ - listAssociatedDomains for all parameters
+ - check results
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [listAssociatedDomains] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [listParameters] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - string stdout due to listBelongingDomains is not empty
+ """
+ log.D(self.test_13_listAssociatedDomains_Case.__doc__)
+ log.I("Command [listParameters]")
+ out, err = self.pfw.sendCmd("listParameters","/Test/")
+ assert err == None, log.E("Command [listParameters /Test/] : %s"%(err))
+ log.I("Command [listParameters] - correctly executed")
+ # Write out in temp file
+ f_temp_file = open(self.temp_file, "w")
+ f_temp_file.write(out)
+ f_temp_file.close()
+
+ # Extract parameter from the temp file
+ f_temp_file = open(self.temp_file, "r")
+ lines = f_temp_file.readlines()
+ f_temp_file.close()
+
+ for line in lines :
+ if not line.find("/") == -1 :
+ final_position_in_line= line.find("[")-1
+ self.list_parameters.append(line[0:final_position_in_line])
+
+ for parameter in self.list_parameters :
+ out, err = self.pfw.sendCmd("listAssociatedDomains",parameter)
+ assert err == None, log.E("Command [listAssociatedDomains %s] : %s"%(parameter,err))
+
+ out, err = self.pfw.sendCmd("listAssociatedDomains","/Test/")
+ assert err == None, log.E("Command [listAssociatedDomains /Test/] : %s"%(err))
+
+ def test_14_listAssociatedElements_Case(self):
+ """
+ Testing listAssociatedElements function
+ -------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - listAssociatedElements
+ - check results
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [listAssociatedElements] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - string stdout due to listAssociatedElements is not empty
+ """
+ log.D(self.test_14_listAssociatedElements_Case.__doc__)
+ log.I("Command [listAssociatedElements]")
+ out, err = self.pfw.sendCmd("listAssociatedElements")
+ assert err == None, log.E("Command [listAssociatedElements] : %s"%(err))
+ log.I("Command [listAssociatedElements] - correctly executed")
+
+ def test_15_listConflictingElements_Case(self):
+ """
+ Testing listConflictingElements function
+ -------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - listConflictingElements
+ - check results
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [listConflictingElements] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - string stdout due to listConflictingElements is not empty
+ """
+ log.D(self.test_15_listConflictingElements_Case.__doc__)
+ log.I("Command [listConflictingElements]")
+ out, err = self.pfw.sendCmd("listConflictingElements")
+ assert err == None, log.E("Command [listConflictingElements] : %s"%(err))
+ log.I("Command [listConflictingElements] - correctly executed")
+
+ def test_16_listRogueElements_Case(self):
+ """
+ Testing listRogueElements function
+ -------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - listRogueElements
+ - check results
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [listRogueElements] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - string stdout due to listRogueElements is not empty
+ """
+ log.D(self.test_16_listRogueElements_Case.__doc__)
+ log.I("Command [listRogueElements]")
+ out, err = self.pfw.sendCmd("listRogueElements")
+ assert err == None, log.E("Command [listRogueElements] : %s"%(err))
+ log.I("Command [listRogueElements] - correctly executed")
diff --git a/test/functional-tests/PfwTestCase/Functions/tFunction_setParameter.py b/test/functional-tests/PfwTestCase/Functions/tFunction_setParameter.py
new file mode 100644
index 0000000..b5605dd
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Functions/tFunction_setParameter.py
@@ -0,0 +1,90 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+setParameter testcase
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+
+Test cases :
+------------
+ This function is intensively tested through all the tests of data types.
+ We test only function commands errors in that script
+"""
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.pfw.sendCmd("setTuningMode", "on")
+ self.domain_name = "Domain_0"
+ self.param_name = "/Test/Test/TEST_DIR/INT8"
+
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Function_Commands_Errors(self):
+ """
+ Testing function command errors
+ ----------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - setParameter with a wrong parameter name
+ - setParameter with a forbiden character value
+ - setParameter with a Float into an Integer parameter
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - errors correctly detected
+ """
+ log.D(self.test_Function_Commands_Errors.__doc__)
+ #Set undefined parameter value
+ log.I("Set undefined parameter value")
+ out, err = self.pfw.sendCmd("setParameter", "Undefined_parameter", "0")
+ assert err == None, "Error when setting parameter : %s" % (err)
+ assert out != "Done", "Error not detected when setting an undefined parameter"
+ #Set parameter with a forbiden character value
+ log.I("Set parameter with a forbiden character value")
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, "Wrong_Value")
+ assert err == None, "Error when setting parameter : %s" % (err)
+ assert out != "Done", "Error not detected when setting a parameter with a forbiden character value"
+ log.I("Errors correctly detected")
+ #Set parameter with a Float into an Integer parameter
+ log.I("Set parameter with a Float into an Integer parameter")
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, "1.2345")
+ assert err == None, "Error when setting parameter : %s" % (err)
+ assert out != "Done", "Error not detected when setting a Float into an Integer parameter"
+ log.I("Errors correctly detected")
diff --git a/test/functional-tests/PfwTestCase/Types/__init__.py b/test/functional-tests/PfwTestCase/Types/__init__.py
new file mode 100644
index 0000000..9fbd9f6
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/__init__.py
@@ -0,0 +1,32 @@
+"""
+Types Package : All testcases about differents types used in PFW :
+ - bit block
+ - boolean
+ - enum
+ - FP16_Q0_15 : 16bits Fixed point - 0 integer bits, 15 fractionnal bits
+ - FP16_Q15_0 : 16bits Fixed point - 15 integer bits, 0 fractionnal bits
+ - FP16_Q7_8 : 16bits Fixed point - 7 integer bits, 8 fractionnal bits
+ - FP32_Q0_31 : 32bits Fixed point - 0 integer bits, 31 fractionnal bits
+ - FP32_Q15_16 : 32bits Fixed point - 15 integer bits, 16 fractionnal bits
+ - FP32_Q31_0 : 32bits Fixed point - 31 integer bits, 0 fractionnal bits
+ - FP32_Q8_20 : 32bits Fixed point - 8 integer bits, 20 fractionnal bits
+ - FP8_Q0_7 : 8bits Fixed point - 0 integer bits, 7 fractionnal bits
+ - FP8_Q3_4 : 8bits Fixed point - 3 integer bits, 4 fractionnal bits
+ - FP8_Q7_0 : 8bits Fixed point - 7 integer bits, 0 fractionnal bits
+ - INT8 : signed integer 8 bits bounded
+ - INT8_MAX : signed integer 8 bits full range
+ - INT16 : signed integer 16 bits bounded
+ - INT16_MAX : signed integer 16 bits full range
+ - INT32 : signed integer 32 bits bounded
+ - INT32_MAX : signed integer 23 bits full range
+ - UINT8 : unsigned integer 8 bits bounded
+ - UINT8_MAX : unsigned integer 8 bits full range
+ - UINT16 : unsigned integer 16 bits bounded
+ - UINT16_MAX : unsigned integer 16 bits full range
+ - UINT32 : unsigned integer 32 bits bounded
+ - UINT32_MAX : unsigned integer 23 bits full range
+ - string
+ - raw data
+ - integer array
+ - parameter block
+"""
diff --git a/test/functional-tests/PfwTestCase/Types/tBit_Block.py b/test/functional-tests/PfwTestCase/Types/tBit_Block.py
new file mode 100644
index 0000000..512a1a7
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tBit_Block.py
@@ -0,0 +1,319 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Bit block parameter type testcases.
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ Block size = 8bits :
+ - BIT_0_3, size = 3, pos=0
+ - BIT_3_1, size = 1, pos=3
+ - BIT_4_1, size = 1, pos=4
+ - BIT_6_2, size = 2, pos=6
+ - BIT_7_1, size = 1, pos=7
+
+Test cases :
+------------
+ - Testing nominal TestCase : set bit to bit
+ - Testing error testcase : set block in one shot
+ - Testing out of bound TestCase
+ - Testing conflicting TestCase : two bits at the same position
+ - Testing out of size TestCase : Bit define on a wrong position
+"""
+
+import commands
+import unittest
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type UINT16 - range [0, 1000]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.block_name = "/Test/Test/TEST_TYPES/BLOCK_8BIT"
+ self.filesystem_name="$PFW_RESULT/BLOCK_8BIT"
+
+ self.bit_name=[]
+
+ #BIT_0_3, size = 3, pos = 0
+ self.bit_name.append("/Test/Test/TEST_TYPES/BLOCK_8BIT/BIT_0_3")
+ #BIT_3_1, size = 1, pos = 3
+ self.bit_name.append("/Test/Test/TEST_TYPES/BLOCK_8BIT/BIT_3_1")
+ #BIT_4_1, size = 1, pos = 4
+ self.bit_name.append("/Test/Test/TEST_TYPES/BLOCK_8BIT/BIT_4_1")
+ #BIT_6_2, size = 2, pos = 6
+ self.bit_name.append("/Test/Test/TEST_TYPES/BLOCK_8BIT/BIT_6_2")
+ #BIT_7_1, size = 1, pos = 7
+ self.bit_name.append("/Test/Test/TEST_TYPES/BLOCK_8BIT/BIT_7_1")
+
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+
+ def test_Nominal_Case(self):
+ """
+ Testing Bit block parameter in nominal case
+ -------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set Bit parameter in nominal case :
+ - BLOCK_BIT = 0b01011101, 0x5D, 93
+ - BIT_0_3 = 5
+ - BIT_3_1 = 1
+ - BIT_4_1 = 1
+ - BIT_6_1 = 1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - BIT parameters set to nominal value
+ - FILESYSTEM BLOCK_8BIT set to 0x5D
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+
+ value_bit=["5","1","1","1"]
+ filesystem_value=["0x5","0xd","0x1d","0x5d"]
+
+ for index_bit in range(4):
+ log.I("set parameter %s to %s"%(self.bit_name[index_bit],value_bit[index_bit]))
+ out,err = self.pfw.sendCmd("setParameter",self.bit_name[index_bit],value_bit[index_bit])
+ assert err == None, log.E("setParameter %s %s : %s" % (self.bit_name[index_bit],value_bit[index_bit], err))
+ assert out == "Done", log.F("setParameter %s %s" %(self.bit_name[index_bit],value_bit[index_bit]))
+ log.I("Check bit %s value"%(self.bit_name[index_bit]))
+ out,err = self.pfw.sendCmd("getParameter",self.bit_name[index_bit])
+ assert err == None, log.E("getParameter %s : %s" % (self.block_name, err))
+ assert out == value_bit[index_bit], log.F("getParameter %s - Expected : %s Found : %s" %(self.bit_name[index_bit],value_bit[index_bit], out))
+ log.I("Check filesystem value")
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == filesystem_value[index_bit], log.F("FILESYSTEM : parameter update error for %s after setting bit %s "%(self.block_name, self.bit_name[index_bit]))
+
+
+ def test_Set_Block_Directly_Case(self):
+ """
+ Testing setting Bit block parameter in one shot
+ -----------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set Bit block directly without setting bit to bit :
+ - BLOCK_BIT = 0b01011101, 0x5D, 93
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - Unable to set directly a block bit
+ - FILESYSTEM BLOCK_8BIT must not change
+ """
+ log.D(self.test_Set_Block_Directly_Case.__doc__)
+
+ value = "93"
+
+ log.I("Load the initial value of bit parameter")
+ init_value_bit=[]
+ for index_bit in range(4):
+ out,err=self.pfw.sendCmd("getParameter",self.bit_name[index_bit])
+ assert err == None, log.E("getParameter %s"%self.bit_name[index_bit])
+ init_value_bit.append(out)
+
+ init_filesystem_value=commands.getoutput("cat %s"%(self.filesystem_name))
+
+ log.I("Try to set parameter %s to %s, failed expected"%(self.block_name,value))
+ out,err = self.pfw.sendCmd("setParameter",self.block_name, value)
+ assert err == None, log.E("setParameter %s %s : %s" % (self.block_name, value, err))
+ assert out != "Done", log.F("Error not detected when setting directly the block %s" % (self.block_name))
+ log.I("Try to get parameter %s to %s, failed expected"%(self.block_name,value))
+ out,err = self.pfw.sendCmd("getParameter",self.block_name, value)
+ assert err == None, log.E("getParameter %s : %s" % (self.block_name, err))
+ assert out != value, log.F("Error not detected when getting directly the block %s" % (self.block_name))
+ log.I("Check filesystem value")
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == init_filesystem_value, log.F("FILESYSTEM : parameter update error for %s"%(self.block_name))
+
+ log.I("Check Bit value")
+ for index_bit in range(4):
+ out,err=self.pfw.sendCmd("getParameter",self.bit_name[index_bit])
+ assert out==init_value_bit[index_bit], log.F("BLACKBOARD: Forbidden change value for bit %s - Expected : %s Found : %s"%(self.bit_name[index_bit],init_value_bit[index_bit],out))
+
+ def test_Out_Of_Bound_Bit_Value_Case(self):
+ """
+ Testing setting bit in out of bound
+ -----------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set bit BIT_3_1 to 2
+ - check bit BIT_3_1 value
+ - check bit BIT_0_3 value
+ - check bit BIT_4_1 value
+ - check block bit Filesystem value
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - Error detected when setting BIT_3_1 to out of bound value
+ - FILESYSTEM BLOCK_8BIT must not change
+ """
+ log.D(self.test_Out_Of_Bound_Bit_Value_Case.__doc__)
+
+ bit_value="3"
+
+ log.I("Load the initial value of bit parameter")
+ init_value_bit=[]
+ for index_bit in range(4):
+ out,err=self.pfw.sendCmd("getParameter",self.bit_name[index_bit])
+ assert err == None, log.E("getParameter %s"%self.bit_name[index_bit])
+ init_value_bit.append(out)
+
+ init_filesystem_value=commands.getoutput("cat %s"%(self.filesystem_name))
+
+ log.I("set parameter %s to %s, failed expected"%(self.bit_name[1],bit_value))
+ out,err = self.pfw.sendCmd("setParameter",self.bit_name[1],bit_value)
+ assert err == None, log.E("setParameter %s %s : %s" % (self.bit_name[1],bit_value, err))
+ assert out != "Done", log.F("Error not detected when setting the bit %s to out of bound value %s" % (self.bit_name[1],bit_value))
+ log.I("Check Bit value")
+ for index_bit in range(4):
+ out,err=self.pfw.sendCmd("getParameter",self.bit_name[index_bit])
+ assert out==init_value_bit[index_bit], log.F("BLACKBOARD: Forbidden change value for bit %s - Expected : %s Found : %s"%(self.bit_name[index_bit],init_value_bit[index_bit],out))
+ log.I("Check filesystem value")
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == init_filesystem_value, log.F("FILESYSTEM : parameter update error for %s"%(self.block_name))
+
+ def test_Undefined_Bit_Case(self):
+ """
+ Testing setting an undefined bit
+ --------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set bit BIT_UNDEF to 1
+ - check block bit Filesystem value
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - Error detected when setting BIT_UNDEF
+ - FILESYSTEM BLOCK_8BIT must not change
+ """
+ log.D(self.test_Undefined_Bit_Case.__doc__)
+
+ bit_value="1"
+ bit_undefined_name="/Test/Test/TEST_TYPES/BLOCK_8BIT/BIT_UNDEF"
+
+ log.I("Load the initial value of bit parameter")
+ init_value_bit=[]
+ for index_bit in range(4):
+ out,err=self.pfw.sendCmd("getParameter",self.bit_name[index_bit])
+ assert err == None, log.E("getParameter %s"%self.bit_name[index_bit])
+ init_value_bit.append(out)
+
+ init_filesystem_value=commands.getoutput("cat %s"%(self.filesystem_name))
+
+ log.I("set parameter %s to %s, failed expected"%(bit_undefined_name,bit_value))
+ out,err = self.pfw.sendCmd("setParameter",bit_undefined_name,bit_value)
+ assert err == None, log.E("setParameter %s %s : %s" % (bit_undefined_name,bit_value, err))
+ assert out != "Done", log.F("Error not detected when setting the bit %s to out of bound value %s" % (bit_undefined_name,bit_value))
+ log.I("Check Bit value")
+ for index_bit in range(4):
+ out,err=self.pfw.sendCmd("getParameter",self.bit_name[index_bit])
+ assert out==init_value_bit[index_bit], log.F("BLACKBOARD: Forbidden change value for bit %s - Expected : %s Found : %s"%(self.bit_name[index_bit],init_value_bit[index_bit],out))
+ log.I("Check filesystem value")
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == init_filesystem_value, log.F("FILESYSTEM : parameter update error for %s"%(self.block_name))
+
+ @unittest.expectedFailure
+ def test_Position_Conflicting_Case(self):
+ """
+ Testing conflicting position
+ ----------------------------
+ Parameter :
+ ~~~~~~~~~~~
+ BIT_6_2 : Position = 6, size = 2 conflicting with
+ BIT_7_1 : Position = 7; size = 1
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set bit BIT_6_2 to 0
+ - set bit BIT_7_1 to 1
+ - check bit BIT_6_2 value
+ - check block bit Filesystem value
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - Unable to define 2 bits at the same position
+ """
+ log.D(self.test_Position_Conflicting_Case.__doc__)
+
+ bit_value_6_2="0"
+ bit_value_7_1="1"
+
+ log.I("set parameter %s to %s"%(self.bit_name[3],bit_value_6_2))
+ out,err = self.pfw.sendCmd("setParameter",self.bit_name[3],bit_value_6_2)
+ assert err == None, log.E("setParameter %s %s : %s" % (self.bit_name[3],bit_value_6_2, err))
+ assert out == "Done", log.F("setParameter %s %s" %(self.bit_name[3],bit_value_6_2))
+
+ log.I("Load the value of bit parameter")
+ init_value_bit=[]
+ for index_bit in range(4):
+ out,err=self.pfw.sendCmd("getParameter",self.bit_name[index_bit])
+ init_value_bit.append(out)
+
+ init_filesystem_value=commands.getoutput("cat %s"%(self.filesystem_name))
+
+ log.I("set parameter %s to %s, failed expected"%(self.bit_name[4],bit_value_7_1))
+ out,err = self.pfw.sendCmd("setParameter",self.bit_name[4],bit_value_7_1)
+ assert err == None, log.E("setParameter %s %s : %s" % (self.bit_name[4],bit_value_7_1, err))
+ assert out != "Done", log.F("Error not detected when setting the conflicting bit %s" % (self.bit_name[4]))
+ log.I("Check Bit value")
+ for index_bit in range(4):
+ out,err=self.pfw.sendCmd("getParameter",self.bit_name[index_bit])
+ assert out==init_value_bit[index_bit], log.F("BLACKBOARD: Forbidden change value for bit %s - Expected : %s Found : %s"%(self.bit_name[index_bit],init_value_bit[index_bit],out))
+ log.I("Check filesystem value")
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == init_filesystem_value, log.F("FILESYSTEM : parameter update error for %s"%(self.block_name))
diff --git a/test/functional-tests/PfwTestCase/Types/tBoolean.py b/test/functional-tests/PfwTestCase/Types/tBoolean.py
new file mode 100644
index 0000000..0658964
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tBoolean.py
@@ -0,0 +1,161 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Boolean parameter type testcases.
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+
+Test cases :
+------------
+ - Testing minimum
+ - Testing maximum
+ - Testing negative value
+ - Testing overflow
+"""
+
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Class containing SET/GET tests on a Boolean parameter
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/BOOL"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def testBooleanMaximum(self):
+ """
+ Testing maximum value for boolean parameter
+ -------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set a boolean parameter to the max value 1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - Boolean set to 1
+ """
+ log.D(self.testBooleanMaximum.__doc__)
+ value = "1"
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name, err))
+ assert out == "Done", log.F("When setting parameter %s : %s" % (self.param_name, out))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert out == value, log.F("incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out))
+
+ def testBooleanMinimum(self):
+ """
+ Testing minimum value for boolean parameter
+ -------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set a boolean parameter to the min value 0
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - Boolean set to 0
+ """
+ log.D(self.testBooleanMinimum.__doc__)
+ value = "0"
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name, err))
+ assert out == "Done", log.F("When setting parameter %s : %s" % (self.param_name, out))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("Error when setting parameter %s : %s" % (self.param_name, err))
+ assert out == value, log.F("Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out))
+
+ def testBooleanNegative(self):
+ """
+ Testing negative value for boolean parameter
+ --------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set a boolean parameter to -1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - Error detected, boolean not updated
+ """
+ print self.testBooleanNegative.__doc__
+ value = "-1"
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name, err))
+ assert out != "Done", log.F("When setting parameter %s : %s" % (self.param_name, out))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert out != value, log.F("incorrect value for %s, expected: %s, found: %s") % (self.param_name, value, out)
+
+
+ def testBooleanOverflow(self):
+ """
+ Testing overflowed value for boolean parameter
+ ----------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set a boolean parameter to 2
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - Error detected, boolean not updated
+ """
+ print self.testBooleanOverflow.__doc__
+ value = "2"
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name, err))
+ assert out != "Done", log.F("When setting parameter %s : %s" % (self.param_name, out))
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert out != value, log.F("incorrect value for %s, expected: %s, found: %s") % (self.param_name, value, out)
diff --git a/test/functional-tests/PfwTestCase/Types/tEnum.py b/test/functional-tests/PfwTestCase/Types/tEnum.py
new file mode 100644
index 0000000..095b57d
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tEnum.py
@@ -0,0 +1,265 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Enum parameter type testcases.
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ Enum size = 8bits; 5 components :
+ - max range [-127,128]
+
+Test cases :
+------------
+ - Enum parameter nominal value = ENUM_NOMINAL : 5
+ - Enum parameter min value = ENUM_MIN : -127
+ - Enum parameter max value = ENUM_MAX : 128
+ - Enum parameter out of bound value = ENUM_OOB : 255
+ - Enum parameter out of size value = ENUM_OOS : 256
+ - Enum parameter undefined value = UNDEF
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type UINT16 - range [0, 1000]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_TYPES/ENUM"
+ self.filesystem_name="$PFW_RESULT/ENUM"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+
+ def test_Nominal_Case(self):
+ """
+ Testing Enum parameter in nominal case
+ --------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - ENUM parameter in nominal case = ENUM_NOMINAL
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - ENUM parameter set to ENUM_NOMINAL
+ - FILESYSTEM set to 0x5
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ value = "ENUM_NOMINAL"
+ filesystem_value="0x5"
+ log.I("Set parameter %s to %s"%(self.param_name,value))
+ out,err = self.pfw.sendCmd("setParameter",self.param_name, value)
+ assert err == None, log.E("setParameter %s %s : %s" % (self.param_name, value, err))
+ assert out == "Done", log.F("setParameter %s %s - expected : Done : %s" % (self.param_name, value,out))
+ log.I("Check Enum parameter state")
+ out, err = self.pfw.sendCmd("getParameter",self.param_name)
+ assert err == None, log.E("getParameter %s : %s" % (self.param_name, err))
+ assert out == value, log.F("getParameter %s - expected : %s , found : %s" % (self.param_name,value,out))
+ log.I("Check filesystem value")
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == filesystem_value, log.F("FILESYSTEM : parameter update error for %s"%(self.param_name))
+
+ def test_TypeMin(self):
+ """
+ Testing minimal value for Enum parameter
+ ----------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - ENUM parameter in min case = ENUM_MIN
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - ENUM parameter set to ENUM_MIN
+ - FILESYSTEM set to 0x80
+ """
+ log.D(self.test_TypeMin.__doc__)
+ value = "ENUM_MIN"
+ filesystem_value="0x80"
+ log.I("Set parameter %s to %s"%(self.param_name,value))
+ out,err = self.pfw.sendCmd("setParameter",self.param_name, value)
+ assert err == None, log.E("setParameter %s %s : %s" % (self.param_name, value, err))
+ assert out == "Done", log.F("setParameter %s %s - expected : Done : %s" % (self.param_name, value,out))
+ log.I("Check Enum parameter state")
+ out, err = self.pfw.sendCmd("getParameter",self.param_name)
+ assert err == None, log.E("getParameter %s : %s" % (self.param_name, err))
+ assert out == value, log.F("getParameter %s - expected : %s , found : %s" % (self.param_name,value,out))
+ log.I("Check filesystem value")
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == filesystem_value, log.F("FILESYSTEM : parameter update error for %s"%(self.param_name))
+
+ def test_TypeMax(self):
+ """
+ Testing maximal value for Enum parameter
+ ----------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - ENUM parameter in max case = ENUM_MAX
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - ENUM parameter set to ENUM_MAX
+ - FILESYSTEM set to 0x7F
+ """
+ log.D(self.test_TypeMax.__doc__)
+ value = "ENUM_MAX"
+ filesystem_value="0x7f"
+ log.I("Set parameter %s to %s"%(self.param_name,value))
+ out,err = self.pfw.sendCmd("setParameter",self.param_name, value)
+ assert err == None, log.E("setParameter %s %s : %s" % (self.param_name, value, err))
+ assert out == "Done", log.F("setParameter %s %s - expected : Done : %s" % (self.param_name, value,out))
+ log.I("Check Enum parameter state")
+ out, err = self.pfw.sendCmd("getParameter",self.param_name)
+ assert err == None, log.E("getParameter %s : %s" % (self.param_name, err))
+ assert out == value, log.F("getParameter %s - expected : %s , found : %s" % (self.param_name,value,out))
+ log.I("Check filesystem value")
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == filesystem_value, log.F("FILESYSTEM : parameter update error for %s"%(self.param_name))
+
+ def test_TypeUndefined(self):
+ """
+ Testing ENUM parameter in undefined reference case
+ --------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - ENUM parameter = UNDEF
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected, parameter must not change
+ - FILESYSTEM must not change
+ """
+ log.D(self.test_TypeUndefined.__doc__)
+ value = "UNDEF"
+ log.I("Check parameter %s initial value"%(self.param_name))
+ init_parameter_value, err=self.pfw.sendCmd("getParameter",self.param_name)
+ init_filesystem_value=commands.getoutput("cat %s"%(self.filesystem_name))
+ log.I("Set parameter %s to %s"%(self.param_name,value))
+ out,err = self.pfw.sendCmd("setParameter",self.param_name, value)
+ assert err == None, log.E("setParameter %s %s : %s" % (self.param_name, value, err))
+ assert out != "Done", log.F("Error not detected when setParameter %s %s" % (self.param_name, value))
+ log.I("Check Enum parameter state")
+ out, err = self.pfw.sendCmd("getParameter",self.param_name)
+ assert err == None, log.E("getParameter %s : %s" % (self.param_name, err))
+ assert out == init_parameter_value, log.F("getParameter %s - expected : %s , found : %s" % (self.param_name,init_parameter_value,out))
+ log.I("Check filesystem value")
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == init_filesystem_value, log.F("FILESYSTEM : parameter update error for %s"%(self.param_name))
+
+ def test_TypeOutOfBound(self):
+ """
+ Testing ENUM parameter in out of range case
+ -------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - ENUM parameter in max case = ENUM_OOB : 255
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected, parameter must not change
+ - FILESYSTEM must not change
+ """
+ log.D(self.test_TypeOutOfBound.__doc__)
+ value = "ENUM_OOB"
+ log.I("Check parameter %s initial value"%(self.param_name))
+ init_parameter_value, err=self.pfw.sendCmd("getParameter",self.param_name)
+ init_filesystem_value=commands.getoutput("cat %s"%(self.filesystem_name))
+ log.I("Set parameter %s to %s"%(self.param_name,value))
+ out,err = self.pfw.sendCmd("setParameter",self.param_name, value)
+ assert err == None, log.E("setParameter %s %s : %s" % (self.param_name, value, err))
+ assert out != "Done", log.F("Error not detected when setParameter %s %s" % (self.param_name, value))
+ log.I("Check Enum parameter state")
+ out, err = self.pfw.sendCmd("getParameter",self.param_name)
+ assert err == None, log.E("getParameter %s : %s" % (self.param_name, err))
+ assert out == init_parameter_value, log.F("getParameter %s - expected : %s , found : %s" % (self.param_name,init_parameter_value,out))
+ log.I("Check filesystem value")
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == init_filesystem_value, log.F("FILESYSTEM : parameter update error for %s"%(self.param_name))
+
+ def test_TypeOutOfSize(self):
+ """
+ Testing ENUM parameter in out of size case
+ ------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - ENUM parameter in max case = ENUM_OOS : 256
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected, parameter must not change
+ - FILESYSTEM must not change
+ """
+ log.D(self.test_TypeOutOfBound.__doc__)
+ value = "ENUM_OOS"
+ log.I("Check parameter %s initial value"%(self.param_name))
+ init_parameter_value, err=self.pfw.sendCmd("getParameter",self.param_name)
+ init_filesystem_value=commands.getoutput("cat %s"%(self.filesystem_name))
+ log.I("Set parameter %s to %s"%(self.param_name,value))
+ out,err = self.pfw.sendCmd("setParameter",self.param_name, value)
+ assert err == None, log.E("setParameter %s %s : %s" % (self.param_name, value, err))
+ assert out != "Done", log.F("Error not detected when setParameter %s %s" % (self.param_name, value))
+ log.I("Check Enum parameter state")
+ out, err = self.pfw.sendCmd("getParameter",self.param_name)
+ assert err == None, log.E("getParameter %s : %s" % (self.param_name, err))
+ assert out == init_parameter_value, log.F("getParameter %s - expected : %s , found : %s" % (self.param_name,init_parameter_value,out))
+ log.I("Check filesystem value")
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == init_filesystem_value, log.F("FILESYSTEM : parameter update error for %s"%(self.param_name))
diff --git a/test/functional-tests/PfwTestCase/Types/tFP16_Q0_15.py b/test/functional-tests/PfwTestCase/Types/tFP16_Q0_15.py
new file mode 100755
index 0000000..11a7df3
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tFP16_Q0_15.py
@@ -0,0 +1,232 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Fixed-Point parameter type testcases - FP16_Q0.15
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ FP16_Q0.15 :
+ - size = 16 bits
+ - 0 integer bits, 15 fractionnal bits
+ - range : [-1, 0.999969]
+
+Test cases :
+------------
+ - FP16_Q0.15 parameter min value = -1
+ - FP16_Q0.15 parameter min value out of bounds = -1.00001
+ - FP16_Q0.15 parameter max value = 0.999969
+ - FP16_Q0.15 parameter max value out of bounds = 0.99997
+ - FP16_Q0.15 parameter in nominal case = 0.2453
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type FP16_Q0.15 - range [-1, 0.999969]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/FP16_Q0.15"
+ self.pfw.sendCmd("setTuningMode", "on")
+ self.type_name = "FP16_Q0.15"
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing FP16_Q0.15 in nominal case = 0.2453
+ -------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q0.15 parameter in nominal case = 0.2453
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP16_Q0.15 parameter set to 0.2453
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ value = "0.2453"
+ hex_value = "0x1f66"
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s" % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert round(float(out),4) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP16_Q0.15') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin(self):
+ """
+ Testing FP16_Q0.15 minimal value = -1
+ -------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q0.15 parameter min value = -1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP16_Q0.15 parameter set to -1
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ value = "-1"
+ hex_value = "0x8000"
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s" % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert round(float(out), 6) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s") % (self.param_name, value, out)
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP16_Q0.15') == hex_value, "FILESYSTEM : parameter update error"
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing FP16_Q0.15 parameter value out of negative range
+ --------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q0.15 to -1.00001
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP16_Q0.15 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ value = "-1.00001"
+ param_check = commands.getoutput('cat $PFW_RESULT/FP16_Q0.15')
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert out != "Done", log.F("Error not detected when setting parameter %s out of bounds" % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP16_Q0.15') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
+
+ def test_TypeMax(self):
+ """
+ Testing FP16_Q0.15 parameter maximum value
+ ------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q0.15 to 0.999969
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP16_Q0.15 parameter set to 0.999969
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ value = "0.999969"
+ hex_value = "0x7fff"
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s" % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert round(float(out), 6) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, round(float(out), 5)))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP16_Q0.15') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing FP16_Q0.15 parameter value out of positive range
+ --------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q0.15 to 0.99997
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP16_Q0.15 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ value = "0.99997"
+ param_check = commands.getoutput('cat $PFW_RESULT/FP16_Q0.15')
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert out != "Done", log.F("Error not detected when setting parameter %s out of bounds" % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP16_Q0.15') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/Types/tFP16_Q15_0.py b/test/functional-tests/PfwTestCase/Types/tFP16_Q15_0.py
new file mode 100755
index 0000000..f833efa
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tFP16_Q15_0.py
@@ -0,0 +1,230 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Fixed-Point parameter type testcases - FP16_Q15.0
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ FP16_Q15.0 :
+ - size = 16 bits
+ - 15 integer bits, 0 fractionnal bits
+ - range : [-32768,32767]
+
+Test cases :
+------------
+ - FP16_Q15.0 parameter min value = -32768
+ - FP16_Q15.0 parameter min value out of bounds = -32768.1
+ - FP16_Q15.0 parameter max value = 32767
+ - FP16_Q15.0 parameter max value out of bounds = 32767.1
+ - FP16_Q15.0 parameter in nominal case = 2222
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type FP16_Q15.0 - range [-32768,32767]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/FP16_Q15.0"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+ def test_Nominal_Case(self):
+ """
+ Testing FP16_Q15.2 in nominal case = 2222
+ -----------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q15.0 parameter in nominal case = 2222
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP16_Q15.0 parameter set to 2222
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ log.I("FP16_Q15.0 parameter in nominal case = 2222")
+ value = "2222"
+ hex_value = "0x8ae"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s" % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert float(out) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP16_Q15.0') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin(self):
+ """
+ Testing FP16_Q15.0 minimal value = -32768
+ -----------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q15.0 parameter min value = -32768
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP16_Q15.0 parameter set to -32768
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ log.I("FP16_Q15.0 parameter min value = -32768")
+ value = "-32768"
+ hex_value = "0x8000"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("Error when setting parameter %s : %s" % (self.param_name, err))
+ assert out == "Done", log.F("Error when setting parameter %s : %s" % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("PFW : Error when setting parameter %s : %s" % (self.param_name, err))
+ assert float(out) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP16_Q15.0') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing FP16_Q15.0 parameter value out of negative range
+ --------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q15.0 to -32768.1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP16_Q15.0 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ log.I("FP16_Q15.0 parameter min value out of bounds = -32768.1")
+ value = "-32768.1"
+ param_check = commands.getoutput('cat $PFW_RESULT/FP16_Q15.0')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("Error when setting parameter %s : %s" % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds" % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP16_Q15.0') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
+
+ def test_TypeMax(self):
+ """
+ Testing FP16_Q15.0 parameter maximum value
+ ------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q15.0 to 32767
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP16_Q15.0 parameter set to 32767
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ log.I("FP16_Q15.0 parameter max value = 32767")
+ value = "32767"
+ hex_value = "0x7fff"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, "Error when setting parameter %s : %s" % (self.param_name, err)
+ assert out == "Done", out
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.F("when setting parameter %s : %s" % (self.param_name, err))
+ assert float(out) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP16_Q15.0') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing FP16_Q15.0 parameter value out of positive range
+ --------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q15.0 to 32767.1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP16_Q15.0 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ log.I("FP16_Q15.0 parameter max value out of bounds = 32767.1")
+ value = "32767.1"
+ param_check = commands.getoutput('cat $PFW_RESULT/FP16_Q15.0')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds" % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP16_Q15.0') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/Types/tFP16_Q7_8.py b/test/functional-tests/PfwTestCase/Types/tFP16_Q7_8.py
new file mode 100755
index 0000000..7229a6b
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tFP16_Q7_8.py
@@ -0,0 +1,235 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Fixed-Point parameter type testcases - FP16_Q7.8
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ FP16_Q7.8 :
+ - size = 16 bits
+ - 7 integer bits, 8 fractionnal bits
+ - range : [-128, 127.996]
+
+Test cases :
+------------
+ - FP16_Q7.8 parameter min value = -128
+ - FP16_Q7.8 parameter min value out of bounds = -128.001
+ - FP16_Q7.8 parameter max value = 127.996
+ - FP16_Q7.8 parameter max value out of bounds = 127.997
+ - FP16_Q7.8 parameter in nominal case = 23.59
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type FP16_Q7.8 - range [-128, 127.996]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/FP16_Q7.8"
+ self.pfw.sendCmd("setTuningMode", "on")
+ self.type_name = "FP16_Q7.8"
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing FP16_Q7.8 in nominal case = 23.59
+ -----------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q7.8 parameter in nominal case = 23.59
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP16_Q7.8 parameter set to 23.59
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ log.I("FP16_Q7.8 parameter in nominal case = 23.59")
+ value = "23.590"
+ hex_value = "0x1797"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s" % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert round(float(out),2) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP16_Q7.8') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin(self):
+ """
+ Testing FP16_Q7.8 minimal value = -128
+ --------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q7.8 parameter min value = -128
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP16_Q7.8 parameter set to -128
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ log.I("FP16_Q7.8 parameter min value = -128")
+ value = "-128"
+ hex_value = "0x8000"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s" % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert round(float(out), 3) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP16_Q7.8') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing FP16_Q7.8 parameter value out of negative range
+ -------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q7.8 to -128.001
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP16_Q7.8 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ log.I("FP16_Q7.8 parameter min value out of bounds = -128.001")
+ value = "-128.001"
+ param_check = commands.getoutput('cat $PFW_RESULT/FP16_Q7.8')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP16_Q7.8') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
+
+ def test_TypeMax(self):
+ """
+ Testing FP16_Q7.8 parameter maximum value
+ -----------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q7.8 to 127.996
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP16_Q7.8 parameter set to 127.996
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ log.I("FP16_Q7.8 parameter max value = 127.996")
+ value = "127.996"
+ hex_value = "0x7fff"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s" % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert round(float(out), 3) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP16_Q7.8') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing FP16_Q7.8 parameter value out of positive range
+ -------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q7.8 to 127.997
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP16_Q7.8 parameter not updated
+
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ log.I("FP16_Q7.8 parameter max value out of bounds = 127.997")
+ value = "127.997"
+ param_check = commands.getoutput('cat $PFW_RESULT/FP16_Q7.8')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds" % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP16_Q7.8') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/Types/tFP32_Q0_31.py b/test/functional-tests/PfwTestCase/Types/tFP32_Q0_31.py
new file mode 100755
index 0000000..9267ff2
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tFP32_Q0_31.py
@@ -0,0 +1,236 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Fixed-Point parameter type testcases - FP16_Q0.31
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ FP16_Q0.31 :
+ - size = 32 bits
+ - 0 integer bits, 31 fractionnal bits
+ - range : [-1, 0.9999999995343387126922607421875]
+
+Test cases :
+------------
+ - FP16_Q0.31 parameter min value = -1
+ - FP16_Q0.31 parameter min value out of bounds = -1.0000000001
+ - FP16_Q0.31 parameter max value = 0.9999999995
+ - FP16_Q0.31 parameter max value out of bounds = 1
+ - FP16_Q0.31 parameter in nominal case = 0.5000000000
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type FP32_Q0.31 - range [-1,0.9999999995343387126922607421875]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/FP32_Q0.31"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing FP16_Q0.31 in nominal case = 0.500000000
+ ------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q0.31 parameter in nominal case = 0.500000000
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP16_Q0.31 parameter set to 0.500000000
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ log.I("FP32_Q0.31 parameter in nominal case = 0.500000000")
+ value = "0.5000000000"
+ hex_value = "0x40000000"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s" % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert round(float(out),10) == round(float(value),10), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q0.31') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin(self):
+ """
+ Testing FP16_Q0.31 minimal value = -1
+ -------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q0.31 parameter min value = -1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP16_Q0.31 parameter set to -1
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ log.I("FP32_Q0.31 parameter min value = -1")
+ value = "-1"
+ hex_value = "0x80000000"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s" % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert round(float(out),10) == round(float(value),10), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q0.31') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing FP16_Q0.31 parameter value out of negative range
+ --------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q0.31 to -1.000000001
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP16_Q0.31 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ log.I("FP32_Q0.31 parameter min value out of bounds = -1.000000001")
+ value = "-1.0000000001"
+ param_check = commands.getoutput('cat $PFW_RESULT/FP32_Q0.31')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q0.31') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
+
+ def test_TypeMax(self):
+ """
+ Testing FP16_Q0.31 parameter maximum value
+ ------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q0.31 to 0.9999999995
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP16_Q0.31 parameter set to 0.9999999995
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ log.I("FP32_Q0.31 parameter max value = 0.9999999995")
+ value = "0.9999999995"
+ hex_value = "0x7fffffff"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s" % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert round(float(out),10) == round(float(value),10), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q0.31') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing FP16_Q0.31 parameter value out of positive range
+ --------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP16_Q0.31 to 1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP16_Q0.31 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ log.I("FP32_Q0.31 parameter max value out of bounds = 1")
+ value = "1"
+ param_check = commands.getoutput('cat $PFW_RESULT/FP32_Q0.31')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q0.31') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/Types/tFP32_Q15_16.py b/test/functional-tests/PfwTestCase/Types/tFP32_Q15_16.py
new file mode 100755
index 0000000..d83ace9
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tFP32_Q15_16.py
@@ -0,0 +1,238 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Fixed-Point parameter type testcases - FP32_Q15.16
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ FP32_Q15.16 :
+ - size = 32 bits
+ - 15 integer bits, 16 fractionnal bits
+ - range : [-32768, 32767.9999847412109375]
+
+Test cases :
+------------
+ - FP32_Q15.16 parameter min value = -32768
+ - FP32_Q15.16 parameter min value out of bounds = -32768.00001
+ - FP32_Q15.16 parameter max value = 32767.99998
+ - FP32_Q15.16 parameter max value out of bounds = 32767.999985
+ - FP32_Q15.16 parameter in nominal case = 12345.12345
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type FP32_Q15.16 - range [-32768,32767.9999847412109375]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/FP32_Q15.16"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing FP32_Q15.16 in nominal case = 12345.12345
+ -------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP32_Q15.16 parameter in nominal case = 12345.12345
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP32_Q15.16 parameter set to 12345.12345
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ log.I("FP32_Q15.16 parameter in nominal case = 12345.12345")
+ value = "12345.1234"
+ hex_value = "0x30391f97"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s" % (self.param_name, err))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert round(float(out),4) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q15.16') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+
+ def test_TypeMin(self):
+ """
+ Testing FP32_Q15.16 minimal value = -32768
+ ------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP32_Q15.16 parameter min value = -32768
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP32_Q15.16 parameter set to -32768
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ log.I("FP32_Q15.16 parameter min value = -32768")
+ value = "-32768"
+ hex_value = "0x80000000"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s" % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None,log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert round(float(out),5) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q15.16') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing FP32_Q15.16 parameter value out of negative range
+ ---------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP32_Q15.16 to -32768.00001
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP32_Q15.16 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ log.I("FP32_Q15.16 parameter min value out of bounds = -32768.000001")
+ value = "-32768.00001"
+ param_check = commands.getoutput('cat $PFW_RESULT/FP32_Q15.16')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q15.16') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
+
+ def test_TypeMax(self):
+ """
+ Testing FP32_Q15.16 parameter maximum value
+ -------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP32_Q15.16 to 32767.99998
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP32_Q15.16 parameter set to 32767.99998
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ log.I("FP32_Q15.16 parameter max value = 32767.99998")
+ value = "32767.99998"
+ hex_value = "0x7fffffff"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s" % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert round(float(out),5) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q15.16') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing FP32_Q15.16 parameter value out of positive range
+ ---------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP32_Q15.16 to 32767.999985
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP32_Q15.16 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ log.I("FP32_Q15.16 parameter max value out of bounds = 32767.999985")
+ value = "32767.999985"
+ param_check = commands.getoutput('cat $PFW_RESULT/FP32_Q15.16')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q15.16') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/Types/tFP32_Q31_0.py b/test/functional-tests/PfwTestCase/Types/tFP32_Q31_0.py
new file mode 100755
index 0000000..f91dcca
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tFP32_Q31_0.py
@@ -0,0 +1,246 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Fixed-Point parameter type testcases - FP32_Q31.0
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ FP32_Q31.0 :
+ - size = 32 bits
+ - 31 integer bits, 0 fractionnal bits
+ - range : [-2147483648, 2147483647]
+
+Test cases :
+------------
+ - FP32_Q31.0 parameter min value = -2147483648
+ - FP32_Q31.0 parameter min value out of bounds = -4147483649
+ - FP32_Q31.0 parameter max value = 2147483647
+ - FP32_Q31.0 parameter max value out of bounds = 12147483648
+ - FP32_Q31.0 parameter in nominal case = 2222
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type FP32_Q31.0 - range [-2147483648,2147483647]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/FP32_Q31.0"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing FP32_Q31.0 in nominal case = 2222
+ -----------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP32_Q31.0 parameter in nominal case = 2222
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP32_Q31.0 parameter set to 2222
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ log.I("FP32_Q31.0 parameter in nominal case = 2222")
+ value = "2222"
+ hex_value = "0x8ae"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert float(out) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q31.0') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin(self):
+ """
+ Testing FP32_Q31.0 minimal value = -2147483648
+ ----------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP32_Q31.0 parameter min value = -2147483648
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP32_Q31.0 parameter set to -2147483648
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ log.I("FP32_Q31.0 parameter min value = -2147483648")
+ value = "-2147483648"
+ hex_value = "0x80000000"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert float(out) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q31.0') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing FP32_Q31.0 parameter value out of negative range
+ --------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP32_Q31.0 to -4147483649
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP32_Q31.0 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ log.I("FP32_Q31.0 parameter min value out of bounds = -4147483649")
+ value = "-4147483649"
+ param_check = commands.getoutput('cat $PFW_RESULT/FP32_Q31.0')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q31.0') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
+
+ def test_TypeMax(self):
+ """
+ Testing FP32_Q31.0 parameter maximum value
+ ------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP32_Q31.0 to 2147483647
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP32_Q31.0 parameter set to 2147483647
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ log.I("FP32_Q31.0 parameter max value = 2147483647")
+ value = "2147483647"
+ hex_value = "0x7fffffff"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert float(out) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q31.0') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing FP32_Q31.0 parameter value out of positive range
+ --------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP32_Q31.0 to 12147483648
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP32_Q31.0 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ log.I("FP32_Q31.0 parameter max value out of bounds = 12147483648")
+ value = "12147483648"
+ param_check = commands.getoutput('cat $PFW_RESULT/FP32_Q31.0')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q31.0') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/Types/tFP32_Q8_20.py b/test/functional-tests/PfwTestCase/Types/tFP32_Q8_20.py
new file mode 100755
index 0000000..567acce
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tFP32_Q8_20.py
@@ -0,0 +1,244 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Fixed-Point parameter type testcases - FP32_Q8.20
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ FP32_Q8.20 :
+ - size = 32 bits
+ - 8 integer bits, 20 fractionnal bits
+ - range : [-256, 255.999999]
+
+Test cases :
+------------
+ - FP32_Q8.20 parameter min value = -256
+ - FP32_Q8.20 parameter min value out of bounds = -500
+ - FP32_Q8.20 parameter max value = 255.999999
+ - FP32_Q8.20 parameter max value out of bounds = 3200.8888
+ - FP32_Q8.20 parameter in nominal case = -128.123456
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type FP32_Q8.20 - range [-256,255,999999046]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/FP32_Q8.20"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing FP32_Q8.20 in nominal case = -128.123456
+ ------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP32_Q8.20 parameter in nominal case = -128.123456
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP32_Q8.20 parameter set to -128.123456
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ log.I("FP32_Q8.20 parameter in nominal case = -128.123456")
+ value = "-128.123456"
+ hex_value = "0xbff03298"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert round(float(out),6) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q8.20') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin(self):
+ """
+ Testing FP32_Q8.20 minimal value = -256
+ ---------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP32_Q8.20 parameter min value = -256
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP32_Q8.20 parameter set to -256
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ log.I("FP32_Q8.20 parameter min value = -256")
+ value = "-256"
+ hex_value = "0x80000000"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s" % (self.param_name, err))
+ assert round(float(out),6) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q8.20') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing FP32_Q8.20 parameter value out of negative range
+ --------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP32_Q8.20 to -500
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP32_Q8.20 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ log.I("FP32_Q8.20 parameter min value out of bounds = -500")
+ value = "-500"
+ param_check = commands.getoutput('cat $PFW_RESULT/FP32_Q8.20')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q8.20') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
+
+ def test_TypeMax(self):
+ """
+ Testing FP32_Q8.20 parameter maximum value
+ ------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP32_Q8.20 to 255.999999
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP32_Q8.20 parameter set to 255.999999
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ log.I("FP32_Q8.20 parameter max value = 255.999999")
+ value = "255.999999"
+ hex_value = "0x7ffffff8"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert round(float(out),6) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q8.20') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing FP32_Q8.20 parameter value out of positive range
+ --------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP32_Q8.20 to 3200.8888
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP32_Q8.20 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ log.I("FP32_Q8.20 parameter max value out of bounds = 3200.8888")
+ value = "3200.8888"
+ param_check = commands.getoutput('cat $PFW_RESULT/FP32_Q8.20')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds" % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP32_Q8.20') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/Types/tFP8_Q0_7.py b/test/functional-tests/PfwTestCase/Types/tFP8_Q0_7.py
new file mode 100755
index 0000000..876cb7f
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tFP8_Q0_7.py
@@ -0,0 +1,248 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Fixed-Point parameter type testcases - FP8_Q0.7
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ FP8_Q0.7 :
+ - size = 8 bits
+ - 0 integer bits, 7 fractionnal bits
+ - range : [-1, 0.992188]
+
+Test cases :
+------------
+ - FP8_Q0.7 parameter min value = -1
+ - FP8_Q0.7 parameter min value out of bounds = -1.000001
+ - FP8_Q0.7 parameter max value = 0.992188
+ - FP8_Q0.7 parameter max value out of bounds = 0.992189
+ - FP8_Q0.7 parameter in nominal case = 0.50
+"""
+import commands
+import unittest
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type FP8_Q0.7 - range [-1, 0.992188]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/FP8_Q0.7"
+ self.pfw.sendCmd("setTuningMode", "on")
+ self.type_name = "FP8_Q0.7"
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing FP8_Q0.7 in nominal case = 0.50
+ ---------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP8_Q0.7 parameter in nominal case = 0.50
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP8_Q0.7 parameter set to 0.50
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ value = "0.50"
+ hex_value = "0x40"
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert round(float(out), 2) == float(value), log.F("BLACKBOARD - Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP8_Q0.7') == hex_value, log.F("FILESYSTEM - parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin(self):
+ """
+ Testing FP8_Q0.7 minimal value = -1
+ -----------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP8_Q0.7 parameter min value = -1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP8_Q0.7 parameter set to -1
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ value = "-1"
+ hex_value = "0x80"
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert round(float(out), 6) == float(value), log.F("BLACKBOARD - Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP8_Q0.7') == hex_value, log.F("FILESYSTEM - parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing FP8_Q0.7 parameter value out of negative range
+ ------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP8_Q0.7 to -1.00001
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP8_Q0.7 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ value = "-1.000001"
+ param_check = commands.getoutput('cat $PFW_RESULT/FP8_Q0.7')
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP8_Q0.7') == param_check, log.F("FILESYSTEM - Forbiden parameter change")
+ log.I("test OK")
+
+ @unittest.expectedFailure
+ def test_TypeMax(self):
+ """
+ Testing FP8_Q0.7 parameter maximum value
+ ----------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP8_Q0.7 to 0.992188
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP8_Q0.7 parameter set to 0.992188
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ value = "0.992188"
+ hex_value = "0x7f"
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert round(float(out), 6) == float(value), "ERROR : BLACKBOARD - Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out)
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP8_Q0.7') == hex_value, "ERROR : FILESYSTEM - parameter update error"
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing FP8_Q0.7 parameter value out of positive range
+ ------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP8_Q0.7 to 0.992189
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP8_Q0.7 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ value = "0.992189"
+ param_check = commands.getoutput('cat $PFW_RESULT/FP8_Q0.7')
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP8_Q0.7') == param_check, log.F("FILESYSTEM - Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/Types/tFP8_Q3_4.py b/test/functional-tests/PfwTestCase/Types/tFP8_Q3_4.py
new file mode 100755
index 0000000..83269ef
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tFP8_Q3_4.py
@@ -0,0 +1,247 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Fixed-Point parameter type testcases - FP8_Q0.7
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ FP8_Q0.7 :
+ - size = 8 bits
+ - 3 integer bits, 4 fractionnal bits
+ - range : [-8, 7.9375]
+
+Test cases :
+------------
+ - FP8_Q0.7 parameter min value = -8
+ - FP8_Q0.7 parameter min value out of bounds = -8.0001
+ - FP8_Q0.7 parameter max value = 7.9375
+ - FP8_Q0.7 parameter max value out of bounds = 7.9376
+ - FP8_Q0.7 parameter in nominal case = 4.3
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type FP8_Q3.4 - range [-8, 7.9375]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/FP8_Q3.4"
+ self.pfw.sendCmd("setTuningMode", "on")
+ self.type_name = "FP8_Q3.4"
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing FP8_Q3.4 in nominal case = 4.3
+ --------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP8_Q3.4 parameter in nominal case = 4.3
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP8_Q3.4 parameter set to 4.3
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ value = "4.3"
+ hex_value = "0x45"
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert round(float(out), 1) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP8_Q3.4') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin(self):
+ """
+ Testing FP8_Q3.4 minimal value = -8
+ -----------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP8_Q3.4 parameter min value = -8
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP8_Q3.4 parameter set to -8
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ value = "-8"
+ hex_value = "0x80"
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert round(float(out), 4) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP8_Q3.4') == hex_value, "FILESYSTEM : parameter update error"
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing FP8_Q3.4 parameter value out of negative range
+ ------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP8_Q3.4 to -8.0001
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP8_Q3.4 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ value = "-8.0001"
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ param_check = commands.getoutput('cat $PFW_RESULT/FP8_Q3.4')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP8_Q3.4') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
+
+ def test_TypeMax(self):
+ """
+ Testing FP8_Q3.4 parameter maximum value
+ ----------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP8_Q3.4 to 7.9375
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP8_Q3.4 parameter set to 7.9375
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ value = "7.9375"
+ hex_value = "0x7f"
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert round(float(out), 4) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP8_Q3.4') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing FP8_Q3.4 parameter value out of positive range
+ ------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP8_Q3.4 to 7.9376
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP8_Q3.4 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ value = "7.9376"
+ param_check = commands.getoutput('cat $PFW_RESULT/FP8_Q3.4')
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP8_Q3.4') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/Types/tFP8_Q7_0.py b/test/functional-tests/PfwTestCase/Types/tFP8_Q7_0.py
new file mode 100755
index 0000000..029af64
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tFP8_Q7_0.py
@@ -0,0 +1,247 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Fixed-Point parameter type testcases - FP8_Q7.0
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ FP8_Q7.0 :
+ - size = 8 bits
+ - 7 integer bits, 0 fractionnal bits
+ - range : [-128, 127]
+
+Test cases :
+------------
+ - FP8_Q7.0 parameter min value = -128
+ - FP8_Q7.0 parameter min value out of bounds = -128.1
+ - FP8_Q7.0 parameter max value = 127
+ - FP8_Q7.0 parameter max value out of bounds = 127.1
+ - FP8_Q7.0 parameter in nominal case = 64
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type FP8_Q7.0 - range [-128,127]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/FP8_Q7.0"
+ self.pfw.sendCmd("setTuningMode", "on")
+ self.type_name = "FP8_Q7.0"
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing FP8_Q7.0 in nominal case = 64
+ -------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP8_Q7.0 parameter in nominal case = 64
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP8_Q7.0 parameter set to 64
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ value = "64"
+ hex_value = "0x40"
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert float(out) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP8_Q7.0') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin(self):
+ """
+ Testing FP8_Q7.0 minimal value = -128
+ -------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP8_Q7.0 parameter min value = -128
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP8_Q7.0 parameter set to -128
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ value = "-128"
+ hex_value = "0x80"
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert float(out) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP8_Q7.0') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing FP8_Q7.0 parameter value out of negative range
+ ------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP8_Q7.0 to -128.1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP8_Q7.0 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ value = "-128.1"
+ param_check = commands.getoutput('cat $PFW_RESULT/FP8_Q7.0')
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP8_Q7.0') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
+
+ def test_TypeMax(self):
+ """
+ Testing FP8_Q7.0 parameter maximum value
+ ----------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP8_Q7.0 to 127
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - FP8_Q7.0 parameter set to 127
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ value = "127"
+ hex_value = "0x7f"
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert float(out) == float(value), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP8_Q7.0') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing FP8_Q7.0 parameter value out of positive range
+ ------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set FP8_Q7.0 to 127.1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - FP8_Q7.0 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ value = "127.1"
+ param_check = commands.getoutput('cat $PFW_RESULT/FP8_Q7.0')
+ log.I("Setting %s to value %s" % (self.type_name, value))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/FP8_Q7.0') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/Types/tINT16.py b/test/functional-tests/PfwTestCase/Types/tINT16.py
new file mode 100644
index 0000000..f927cda
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tINT16.py
@@ -0,0 +1,245 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Integer parameter type testcases - INT16
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ INT16 :
+ - size = 16
+ - range : [-1000, 1000]
+
+Test cases :
+------------
+ - INT16 parameter min value = -1000
+ - INT16 parameter min value out of bounds = -1001
+ - INT16 parameter max value = 1000
+ - INT16 parameter max value out of bounds = 1001
+ - INT16 parameter in nominal case = 50
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type INT16 - range [-1000, 1000]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/INT16"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing INT16 in nominal case = 50
+ ----------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT16 parameter in nominal case = 50
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT16 parameter set to 50
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ log.I("INT16 parameter in nominal case = 50")
+ value = "50"
+ hex_value = "0x32"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT16') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin(self):
+ """
+ Testing INT16 minimal value = -1000
+ -----------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT16 parameter min value = -1000
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT16 parameter set to -1000
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ log.I("INT16 parameter min value = -1000")
+ value = "-1000"
+ hex_value = "0xfc18"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT16') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing INT16 parameter value out of negative range
+ ---------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT16 to -1001
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - INT16 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ log.I("INT16 parameter min value out of bounds = -1001")
+ value = "-1001"
+ param_check = commands.getoutput('cat $PFW_RESULT/INT16')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT16') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
+
+ def test_TypeMax(self):
+ """
+ Testing INT16 parameter maximum value
+ -------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT16 to 1000
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT16 parameter set to 1000
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ log.I("INT16 parameter max value = 1000")
+ value = "1000"
+ hex_value = "0x3e8"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT16') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing INT16 parameter value out of positive range
+ ---------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT16 to 1001
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - INT16 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ log.I("INT16 parameter max value out of bounds = 1001")
+ value = "1001"
+ param_check = commands.getoutput('cat $PFW_RESULT/INT16')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT16') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/Types/tINT16_ARRAY.py b/test/functional-tests/PfwTestCase/Types/tINT16_ARRAY.py
new file mode 100644
index 0000000..50a19bc
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tINT16_ARRAY.py
@@ -0,0 +1,323 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Array parameter type testcases : INT16 Array
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ UINT16 Array = 16bits signed int array :
+ - Array size : 5
+ - values range : [-50, 50]
+
+Test cases :
+------------
+ - Testing nominal case
+ - Testing minimum
+ - Testing minimum overflow
+ - Testing maximum
+ - Testing maximum overflow
+ - Testing array index out of bounds
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+
+from ctypes import c_uint16
+
+
+class TestCases(PfwTestCase):
+
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/INT16_ARRAY"
+ self.param_short_name = "$PFW_RESULT/INT16_ARRAY"
+ print '\r'
+ self.pfw.sendCmd("setTuningMode", "on")
+ print '\r'
+ self.array_size = 5
+ self.array_min = -50
+ self.array_max = 50
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing INT16_ARRAY Nominal Case
+ --------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set every INT16_ARRAY elements to autorized values
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT16_ARRAY array elements correctly recorded
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+
+ for index in range (self.array_size):
+ indexed_array_value = index + self.array_min
+ if indexed_array_value>self.array_max:
+ indexed_array_value=self.array_max
+ hex_indexed_array_value = hex(c_uint16(indexed_array_value).value)
+ #Check parameter value setting
+ indexed_array_value_path = "".join([self.param_name, "/", str(index)])
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.F("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", str(indexed_array_value_path), "")
+ assert err == None, log.E("when setting parameter %s[%s] : %s"
+ % (self.param_name, str(index), err))
+ assert out == str(indexed_array_value), log.F("BLACKBOARD : Incorrect value for %s[%s], expected: %s, found: %s"
+ % (self.param_name, str(index), str(indexed_array_value), out))
+ #Check parameter value on filesystem
+ files_system_check = "awk -v ligne="+str(index)+" 'NR == ligne+1 { print $0}' "+self.param_short_name
+ indexed_files_system_array_value = commands.getoutput(files_system_check)
+ assert indexed_files_system_array_value == hex_indexed_array_value, log.F("FILESSYSTEM : %s[%s] update error"
+ % (self.param_name, str(index)))
+
+ def test_Min_Value(self):
+ """
+ Testing INT16_ARRAY minimum value
+ ---------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set every INT16_ARRAY elements to minimum values : 0
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT16_ARRAY array elements correctly recorded
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Min_Value.__doc__)
+ index = 0
+ indexed_array_value = self.array_min
+ indexed_array_value_path = "".join([self.param_name, "/", str(index)])
+ hex_indexed_array_value = hex(c_uint16(indexed_array_value).value)
+ #Check parameter value setting
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", str(indexed_array_value_path), "")
+ assert err == None, log.E("when setting parameter %s[%s] : %s"
+ % (self.param_name, str(index), err))
+ assert out == str(indexed_array_value), log.F("BLACKBOARD : Incorrect value for %s[%s], expected: %s, found: %s"
+ % (self.param_name, str(index), str(indexed_array_value), out))
+ #Check parameter value on filesystem
+ files_system_check = "awk -v ligne="+str(index)+" 'NR == ligne+1 { print $0}' "+self.param_short_name
+ indexed_files_system_array_value = commands.getoutput(files_system_check)
+ assert indexed_files_system_array_value == hex_indexed_array_value, log.F("FILESSYSTEM : %s[%s] update error"
+ % (self.param_name, str(index)))
+
+ def test_Min_Value_Overflow(self):
+ """
+ Testing INT16_ARRAY parameter values out of negative range
+ ----------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set every INT16_ARRAY elements to -1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT16_ARRAY array elements not recorded
+ - Error correctly detected
+ """
+ log.D(self.test_Min_Value_Overflow.__doc__)
+ index = 0
+ indexed_array_value = self.array_min
+ indexed_array_value_path = "".join([self.param_name, "/", str(index)])
+ #Check initial parameter value setting
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.F("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ files_system_check = "awk -v ligne="+str(index)+" 'NR == ligne+1 { print $0}' "+self.param_short_name
+ param_check = commands.getoutput(files_system_check)
+ #Check final parameter value setting
+ indexed_array_value = indexed_array_value - 1
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out != "Done", log.F("Error not detected when setting parameter %s[%s] out of bounds"
+ % (self.param_name, str(index)))
+ #Check parameter value on filesystem
+ indexed_files_system_array_value = commands.getoutput(files_system_check)
+ assert indexed_files_system_array_value == param_check, log.F("FILESSYSTEM : %s[%s] forbiden update"
+ % (self.param_name, str(index)))
+
+ def test_Max_Value(self):
+ """
+ Testing INT16_ARRAY maximum value
+ ---------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set every INT16_ARRAY elements to maximum values : 15
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT16_ARRAY array elements correctly recorded
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Max_Value.__doc__)
+ index = 0
+ indexed_array_value = self.array_max
+ indexed_array_value_path = "".join([self.param_name, "/", str(index)])
+ hex_indexed_array_value = hex(c_uint16(indexed_array_value).value)
+ #Check parameter value setting
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.F("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", str(indexed_array_value_path), "")
+ assert err == None, log.E("when setting parameter %s[%s] : %s"
+ % (self.param_name, str(index), err))
+ assert out == str(indexed_array_value), log.F("BLACKBOARD : Incorrect value for %s[%s], expected: %s, found: %s"
+ % (self.param_name, str(index), str(indexed_array_value), out))
+ #Check parameter value on filesystem
+ files_system_check = "awk -v ligne="+str(index)+" 'NR == ligne+1 { print $0}' "+self.param_short_name
+ indexed_files_system_array_value = commands.getoutput(files_system_check)
+ assert indexed_files_system_array_value == hex_indexed_array_value, log.F("FILESSYSTEM : %s[%s] update error"
+ % (self.param_name, str(index)))
+
+ def test_Max_Value_Overflow(self):
+ """
+ Testing INT16_ARRAY parameter values out of positive range
+ ----------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set every INT16_ARRAY elements to 16
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT16_ARRAY array elements not recorded
+ - Error correctly detected
+ """
+ log.D(self.test_Max_Value_Overflow.__doc__)
+ index = 0
+ indexed_array_value = self.array_max
+ indexed_array_value_path = "".join([self.param_name, "/", str(index)])
+ #Check initial parameter value setting
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.F("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ files_system_check = "awk -v ligne="+str(index)+" 'NR == ligne+1 { print $0}' "+self.param_short_name
+ param_check = commands.getoutput(files_system_check)
+ #Check final parameter value setting
+ indexed_array_value = indexed_array_value + 1
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out != "Done", log.F("Error not detected when setting parameter %s[%s] out of bounds"
+ % (self.param_name, str(index)))
+ #Check parameter value on filesystem
+ indexed_files_system_array_value = commands.getoutput(files_system_check)
+ assert indexed_files_system_array_value == param_check, log.F("FILESSYSTEM : %s[%s] forbiden update"
+ % (self.param_name, str(index)))
+
+ def test_Array_Index_Overflow(self):
+ """
+ Testing Array index out of bounds
+ ---------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set an out of bounds array indexed element
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT16_ARRAY array elements not recorded
+ - Error correctly detected
+ """
+ log.D(self.test_Array_Index_Overflow.__doc__)
+ index_values = (self.array_size-1, self.array_size+1, -1)
+ for index in index_values:
+ print index
+ indexed_array_value = self.array_max
+ indexed_array_value_path = "".join([self.param_name, "/", str(index)])
+ #Check parameter value setting
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ if index in [0, self.array_size-1]:
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.F("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ else:
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out != "Done", log.F("Error not detected when setting array %s index out of bounds"
+ % (self.param_name))
diff --git a/test/functional-tests/PfwTestCase/Types/tINT16_Max.py b/test/functional-tests/PfwTestCase/Types/tINT16_Max.py
new file mode 100644
index 0000000..968f3d2
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tINT16_Max.py
@@ -0,0 +1,245 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Integer parameter type testcases - INT16_Max
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ INT16_Max :
+ - size = 16
+ - range : [-32768, 32767]
+
+Test cases :
+------------
+ - INT16_Max parameter min value = -32768
+ - INT16_Max parameter min value out of bounds = -32769
+ - INT16_Max parameter max value = 32767
+ - INT16_Max parameter max value out of bounds = 32768
+ - INT16_Max parameter in nominal case = 50
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type INT16_Max - range [-32768, 32767]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/INT16_Max"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing INT16_Max in nominal case = 50
+ --------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT16_Max parameter in nominal case = 50
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT16_Max parameter set to 50
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ log.I("INT16_Max parameter in nominal case = 50")
+ value = "50"
+ hex_value = "0x32"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT16_Max') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin(self):
+ """
+ Testing INT16_Max minimal value = -32768
+ ----------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT16_Max parameter min value = -32768
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT16_Max parameter set to -32768
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ log.I("INT16_Max parameter min value = -32768")
+ value = "-32768"
+ hex_value = "0x8000"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT16_Max') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing INT16_Max parameter value out of negative range
+ -------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT16_Max to -32769
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - INT16_Max parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ log.I("INT16_Max parameter min value out of bounds = -32769")
+ value = "-32769"
+ param_check = commands.getoutput('cat $PFW_RESULT/INT16_Max')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT16_Max') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
+
+ def test_TypeMax(self):
+ """
+ Testing INT16_Max parameter maximum value
+ -----------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT16_Max to 32767
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT16_Max parameter set to 32767
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ log.I("INT16_Max parameter max value = 32767")
+ value = "32767"
+ hex_value = "0x7fff"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT16_Max') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing INT16_Max parameter value out of positive range
+ -------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT16_Max to 32768
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - INT16_Max parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ log.I("INT16_Max parameter max value out of bounds = 32768")
+ value = "32768"
+ param_check = commands.getoutput('cat $PFW_RESULT/INT16_Max')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT16_Max') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/Types/tINT32.py b/test/functional-tests/PfwTestCase/Types/tINT32.py
new file mode 100644
index 0000000..579e4f8
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tINT32.py
@@ -0,0 +1,229 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Integer parameter type testcases - INT32
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ INT32 :
+ - size = 32
+ - range : [-1000, 1000]
+
+Test cases :
+------------
+ - INT32 parameter min value = -1000
+ - INT32 parameter min value out of bounds = -1001
+ - INT32 parameter max value = 1000
+ - INT32 parameter max value out of bounds = 1001
+ - INT32 parameter in nominal case = 50
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type INT32 - range [-1000, 1000]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/INT32"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing INT32 in nominal case = 50
+ ----------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT32 parameter in nominal case = 50
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT32 parameter set to 50
+ - Blackboard and filesystem values checked
+ """
+ print self.test_Nominal_Case.__doc__
+ print "INFO : INT32 parameter in nominal case = 50"
+ value = "50"
+ hex_value = "0x32"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, "Error when setting parameter %s : %s" % (self.param_name, err)
+ assert out == "Done", out
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, "Error when setting parameter %s : %s" % (self.param_name, err)
+ assert out == value, "BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out)
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT32') == hex_value, "FILESYSTEM : parameter update error"
+ print "INFO : test OK"
+
+ def test_TypeMin(self):
+ """
+ Testing INT32 minimal value = -1000
+ -----------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT32 parameter min value = -1000
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT32 parameter set to -1000
+ - Blackboard and filesystem values checked
+ """
+ print self.test_TypeMin.__doc__
+ print "INFO : INT32 parameter min value = -1000"
+ value = "-1000"
+ hex_value = "0xfffffc18"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, "Error when setting parameter %s : %s" % (self.param_name, err)
+ assert out == "Done", out
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, "PFW : Error when setting parameter %s : %s" % (self.param_name, err)
+ assert out == value, "BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out)
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT32') == hex_value, "FILESYSTEM : parameter update error"
+ print "INFO : test OK"
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing INT32 parameter value out of negative range
+ ---------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT32 to -1001
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - INT32 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ print self.test_TypeMin_Overflow.__doc__
+ print "INFO : INT32 parameter min value out of bounds = -1001"
+ value = "-1001"
+ param_check = commands.getoutput('cat $PFW_RESULT/INT32')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, "Error when setting parameter %s : %s" % (self.param_name, err)
+ assert out != "Done", "PFW : Error not detected when setting parameter %s out of bounds" % (self.param_name)
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT32') == param_check, "FILESYSTEM : Forbiden parameter change"
+ print "INFO : test OK"
+
+ def test_TypeMax(self):
+ """
+ Testing INT32 parameter maximum value
+ -------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT32 to 1000
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT32 parameter set to 1000
+ - Blackboard and filesystem values checked
+ """
+ print self.test_TypeMax.__doc__
+ print "INFO : INT32 parameter max value = 1000"
+ value = "1000"
+ hex_value = "0x3e8"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, "Error when setting parameter %s : %s" % (self.param_name, err)
+ assert out == "Done", out
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, "Error when setting parameter %s : %s" % (self.param_name, err)
+ assert out == value, "BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out)
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT32') == hex_value, "FILESYSTEM : parameter update error"
+ print "INFO : test OK"
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing INT32 parameter value out of positive range
+ ---------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT32 to 1001
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - INT32 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ print self.test_TypeMax_Overflow.__doc__
+ print "INFO : INT32 parameter max value out of bounds = 1001"
+ value = "1001"
+ param_check = commands.getoutput('cat $PFW_RESULT/INT32')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, "Error when setting parameter %s : %s" % (self.param_name, err)
+ assert out != "Done", "PFW : Error not detected when setting parameter %s out of bounds" % (self.param_name)
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT32') == param_check, "FILESYSTEM : Forbiden parameter change"
+ print "INFO : test OK"
diff --git a/test/functional-tests/PfwTestCase/Types/tINT32_Max.py b/test/functional-tests/PfwTestCase/Types/tINT32_Max.py
new file mode 100644
index 0000000..147e7d4
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tINT32_Max.py
@@ -0,0 +1,244 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Integer parameter type testcases - INT32_Max
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ INT32_Max :
+ - size = 16
+ - range : [-2147483648, 2147483647]
+
+Test cases :
+------------
+ - INT32_Max parameter min value = -2147483648
+ - INT32_Max parameter min value out of bounds = -2147483649
+ - INT32_Max parameter max value = 2147483647
+ - INT32_Max parameter max value out of bounds = 2147483648
+ - INT32_Max parameter in nominal case = 50
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type INT32_Max - range [-2147483648, 2147483647]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/INT32_Max"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing INT32_Max in nominal case = 50
+ --------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT32_Max parameter in nominal case = 50
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT32_Max parameter set to 50
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ log.I("INT32_Max parameter in nominal case = 50")
+ value = "50"
+ hex_value = "0x32"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT32_Max') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin(self):
+ """
+ Testing INT32_Max minimal value = -2147483648
+ ---------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT32_Max parameter min value = -2147483648
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT32_Max parameter set to -2147483648
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ log.I("INT32_Max parameter min value = -2147483648")
+ value = "-2147483648"
+ hex_value = "0x80000000"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT32_Max') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing INT32_Max parameter value out of negative range
+ -------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT32_Max to -2147483649
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - INT32_Max parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ log.I("INT32_Max parameter min value out of bounds = -2147483649")
+ value = "-2147483649"
+ param_check = commands.getoutput('cat $PFW_RESULT/INT32_Max')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT32_Max') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
+
+ def test_TypeMax(self):
+ """
+ Testing INT32_Max parameter maximum value
+ -----------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT32_Max to 2147483647
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT32_Max parameter set to 1000
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ log.I("INT32_Max parameter max value = 2147483647")
+ value = "2147483647"
+ hex_value = "0x7fffffff"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT32_Max') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing INT32_Max parameter value out of positive range
+ -------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT32_Max to 2147483648
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - INT32_Max parameter not updated
+
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ log.I("INT32_Max parameter max value out of bounds = 2147483648")
+ value = "2147483648"
+ param_check = commands.getoutput('cat $PFW_RESULT/INT32_Max')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT32_Max') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/Types/tINT8.py b/test/functional-tests/PfwTestCase/Types/tINT8.py
new file mode 100644
index 0000000..55612c5
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tINT8.py
@@ -0,0 +1,245 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Integer parameter type testcases - INT8
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ INT8 :
+ - size = 8
+ - range : [-100, 100]
+
+Test cases :
+------------
+ - INT8 parameter min value = -100
+ - INT8 parameter min value out of bounds = -101
+ - INT8 parameter max value = 100
+ - INT8 parameter max value out of bounds = 101
+ - INT8 parameter in nominal case = 50
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type INT8 - range [-100, 100]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/INT8"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing INT8 in nominal case = 50
+ ---------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT8 parameter in nominal case = 50
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT8 parameter set to 50
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ log.I("INT8 parameter in nominal case = 50")
+ value = "50"
+ hex_value = "0x32"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT8') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin(self):
+ """
+ Testing INT8 minimal value = -100
+ ---------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT8 parameter min value = -100
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT8 parameter set to -100
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ log.I("INT8 parameter min value = -100")
+ value = "-100"
+ hex_value = "0x9c"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT8') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing INT8 parameter value out of negative range
+ --------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT8 to -101
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - INT8 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ log.I("INT8 parameter min value out of bounds = -101")
+ value = "-101"
+ param_check = commands.getoutput('cat $PFW_RESULT/INT8')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT8') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
+
+ def test_TypeMax(self):
+ """
+ Testing INT8 parameter maximum value
+ ------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT8 to 100
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT8 parameter set to 100
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ log.I("INT8 parameter max value = 100")
+ value = "100"
+ hex_value = "0x64"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT8') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing INT8 parameter value out of positive range
+ --------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT8 to 101
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - INT8 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ log.I("INT8 parameter max value out of bounds = 101")
+ value = "101"
+ param_check = commands.getoutput('cat $PFW_RESULT/INT8')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT8') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/Types/tINT8_Max.py b/test/functional-tests/PfwTestCase/Types/tINT8_Max.py
new file mode 100644
index 0000000..2c42d96
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tINT8_Max.py
@@ -0,0 +1,229 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Integer parameter type testcases - INT8_Max
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ INT8_Max :
+ - size = 8
+ - range : [-128, 127]
+
+Test cases :
+------------
+ - INT8_Max parameter min value = -128
+ - INT8_Max parameter min value out of bounds = -129
+ - INT8_Max parameter max value = 127
+ - INT8_Max parameter max value out of bounds = 128
+ - INT8_Max parameter in nominal case = 50
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type INT8_Max - range [-128, 127]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/INT8_Max"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing INT8_Max in nominal case = 50
+ -------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT8_Max parameter in nominal case = 50
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT8_Max parameter set to 50
+ - Blackboard and filesystem values checked
+ """
+ print self.test_Nominal_Case.__doc__
+ print "INFO : INT8_Max parameter in nominal case = 50"
+ value = "50"
+ hex_value = "0x32"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, "Error when setting parameter %s : %s" % (self.param_name, err)
+ assert out == "Done", out
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, "Error when setting parameter %s : %s" % (self.param_name, err)
+ assert out == value, "BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out)
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT8_Max') == hex_value, "FILESYSTEM : parameter update error"
+ print "INFO : test OK"
+
+ def test_TypeMin(self):
+ """
+ Testing INT8_Max minimal value = -128
+ -------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT8_Max parameter min value = -128
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT8_Max parameter set to -128
+ - Blackboard and filesystem values checked
+ """
+ print self.test_TypeMin.__doc__
+ print "INFO : INT8_Max parameter min value = -128"
+ value = "-128"
+ hex_value = "0x80"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, "Error when setting parameter %s : %s" % (self.param_name, err)
+ assert out == "Done", out
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, "PFW : Error when setting parameter %s : %s" % (self.param_name, err)
+ assert out == value, "BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out)
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT8_Max') == hex_value, "FILESYSTEM : parameter update error"
+ print "INFO : test OK"
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing INT8_Max parameter value out of negative range
+ ------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT8_Max to -129
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - INT8_Max parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ print self.test_TypeMin_Overflow.__doc__
+ print "INFO : INT8_Max parameter min value out of bounds = -129"
+ value = "-129"
+ param_check = commands.getoutput('cat $PFW_RESULT/INT8_Max')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, "Error when setting parameter %s : %s" % (self.param_name, err)
+ assert out != "Done", "PFW : Error not detected when setting parameter %s out of bounds" % (self.param_name)
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT8_Max') == param_check, "FILESYSTEM : Forbiden parameter change"
+ print "INFO : test OK"
+
+ def test_TypeMax(self):
+ """
+ Testing INT8_Max parameter maximum value
+ ----------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT8_Max to 127
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - INT8_Max parameter set to 127
+ - Blackboard and filesystem values checked
+ """
+ print self.test_TypeMax.__doc__
+ print "INFO : INT8_Max parameter max value = 127"
+ value = "127"
+ hex_value = "0x7f"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, "Error when setting parameter %s : %s" % (self.param_name, err)
+ assert out == "Done", out
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, "Error when setting parameter %s : %s" % (self.param_name, err)
+ assert out == value, "BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out)
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT8_Max') == hex_value, "FILESYSTEM : parameter update error"
+ print "INFO : test OK"
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing INT8_Max parameter value out of positive range
+ ------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set INT8_Max to 128
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - INT8_Max parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ print self.test_TypeMax_Overflow.__doc__
+ print "INFO : INT8_Max parameter max value out of bounds = 128"
+ value = "128"
+ param_check = commands.getoutput('cat $PFW_RESULT/INT8_Max')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, "Error when setting parameter %s : %s" % (self.param_name, err)
+ assert out != "Done", "PFW : Error not detected when setting parameter %s out of bounds" % (self.param_name)
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/INT8_Max') == param_check, "FILESYSTEM : Forbiden parameter change"
+ print "INFO : test OK"
diff --git a/test/functional-tests/PfwTestCase/Types/tParameter_Block.py b/test/functional-tests/PfwTestCase/Types/tParameter_Block.py
new file mode 100644
index 0000000..dcbe098
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tParameter_Block.py
@@ -0,0 +1,292 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Parameter block type testcases.
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ Block component - 3 UINT:
+ - UINT8, size = 8 bits, range : [0, 100]
+ - UINT16, size = 16 bits, range : [0, 1000]
+ - UINT16, size = 32 bits, range : [0, 1000]
+
+Test cases :
+------------
+ - Testing nominal situation
+ - Testing one-shot setting (setting directly a value for the block)
+ - Testing error : Out of range TestCase
+ - Testing error : Try to set an undefined param
+"""
+import commands
+import unittest
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type UINT16 - range [0, 1000]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.block_name = "/Test/Test/TEST_TYPES/BLOCK_PARAMETER"
+
+ self.param_name = []
+ self.filesystem_name = []
+
+ #UINT8_0, size = 8
+ self.param_name.append(self.block_name+"/UINT8")
+ self.filesystem_name.append("$PFW_RESULT/BLOCK_UINT8")
+ #UINT16_1, size = 16
+ self.param_name.append(self.block_name+"/UINT16")
+ self.filesystem_name.append("$PFW_RESULT/BLOCK_UINT16")
+ #UINT32_2, size = 32
+ self.param_name.append(self.block_name+"/UINT32")
+ self.filesystem_name.append("$PFW_RESULT/BLOCK_UINT32")
+
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+
+ @unittest.expectedFailure
+ def test_Nominal_Case(self):
+ """
+ Testing BLOCK_PARAMETER in nominal case
+ ---------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT parameters in nominal case :
+ - UINT8 = 5
+ - UINT16 = 5
+ - UINT32 = 5
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - Parameters set to nominal value
+ - FILESYSTEM parameters set to nominal value
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+
+ value_param = ["5", "5", "5"]
+ filesystem_value = ["0x5", "0x5", "0x5"]
+
+ for index_param in range(len(self.param_name)) :
+ log.I("set parameter %s to %s"
+ %(self.param_name[index_param],value_param[index_param]))
+ out,err = self.pfw.sendCmd("setParameter",self.param_name[index_param],value_param[index_param])
+ assert err == None, log.E("setParameter %s %s : %s"
+ % (self.param_name[index_param],value_param[index_param], err))
+ assert out == "Done", log.F("setParameter %s %s"
+ %(self.param_name[index_param],value_param[index_param]))
+ log.I("Check parameter %s value"
+ %(self.param_name[index_param]))
+ out,err = self.pfw.sendCmd("getParameter",self.param_name[index_param])
+ assert err == None, log.E("getParameter %s : %s"
+ % (self.block_name, err))
+ assert out == value_param[index_param], log.F("getParameter %s - Expected : %s Found : %s"
+ %(self.param_name[index_param],value_param[index_param], out))
+ log.I("Check filesystem value")
+ assert (commands.getoutput("cat %s" % (self.filesystem_name[index_param]))
+ == filesystem_value[index_param]), log.F("FILESYSTEM : parameter update error for %s after setting %s "
+ %(self.block_name, self.param_name[index_param]))
+
+
+ def test_Set_Block_Directly_Case(self):
+ """
+ Testing error BLOCK_PARAMETER : set block value directly
+ --------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set Param block directly without setting parameters :
+ - BLOCK_PARAMETER = Dec : 1000000 Hexa : 0xF4240
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - Unable to set directly a parameter block
+ - FILESYSTEM parameters set to nominal value
+ """
+ log.D(self.test_Set_Block_Directly_Case.__doc__)
+
+ value = "1000000"
+
+ log.I("Load the initial value of parameters")
+ init_value_param = []
+ init_filesystem_value = []
+
+ for index_param in range(len(self.param_name)):
+ out,err = self.pfw.sendCmd("getParameter",self.param_name[index_param])
+ init_value_param.append(out)
+ init_filesystem_value.append(commands.getoutput("cat %s"
+ %(self.filesystem_name[index_param])))
+
+ log.I("Try to set parameter %s to %s, failed expected"
+ %(self.block_name,value))
+ out,err = self.pfw.sendCmd("setParameter",self.block_name, value)
+ assert err == None, log.E("setParameter %s %s : %s"
+ % (self.block_name, value, err))
+ assert out != "Done", log.F("Error not detected when setting directly the block %s"
+ % (self.block_name))
+ log.I("Try to get parameter %s to %s, failed expected"
+ %(self.block_name,value))
+ out,err = self.pfw.sendCmd("getParameter",self.block_name, value)
+ assert err == None, log.E("getParameter %s : %s"
+ % (self.block_name, err))
+ assert out != value, log.F("Error not detected when getting directly the block %s"
+ % (self.block_name))
+ log.I("Check filesystem value")
+ for index_param in range(len(self.param_name)):
+ assert (commands.getoutput("cat %s"%(self.filesystem_name[index_param]))
+ == init_filesystem_value[index_param]), log.F("FILESYSTEM : parameter update error for %s"
+ %(self.block_name))
+
+ log.I("Check Param value")
+ for index_param in range(len(self.param_name)):
+ out,err = self.pfw.sendCmd("getParameter",self.param_name[index_param])
+ assert (out == init_value_param[index_param]), log.F("BLACKBOARD: Forbidden change value for parameter %s - Expected : %s Found : %s"
+ %(self.param_name[index_param],init_value_param[index_param],out))
+
+ def test_Out_Of_Bound_Param_Value_Case(self):
+ """
+ Testing error BLOCK_PARAMETER : Out of range TestCase
+ -----------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set param UINT16 to 65536
+ - check parameter UINT16 value
+ - check parameter UINT8 value
+ - check parameter UINT32 value
+ - check block Filesystem value
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - Error detected when setting UINT16_1 to wrong value
+ - FILESYSTEM parameters set to nominal value
+ """
+ log.D(self.test_Out_Of_Bound_Param_Value_Case.__doc__)
+
+ param_value = "65536"
+
+ log.I("Load the initial value of parameters")
+ init_value_param = []
+ init_filesystem_value = []
+
+ for index_param in range(len(self.param_name)):
+ out,err = self.pfw.sendCmd("getParameter",self.param_name[index_param])
+ init_value_param.append(out)
+ init_filesystem_value.append(commands.getoutput("cat %s"
+ %(self.filesystem_name[index_param])))
+
+ log.I("set parameter %s to %s, failed expected"
+ %(self.param_name[1],param_value))
+ out,err = self.pfw.sendCmd("setParameter",self.param_name[1],param_value)
+ assert err == None, log.E("setParameter %s %s : %s"
+ % (self.param_name[1],param_value, err))
+ assert out != "Done", log.F("Error not detected when setting parameter %s to out of bound value %s"
+ % (self.param_name[1],param_value))
+ log.I("Check parameter value")
+ for index_param in range(len(self.param_name)):
+ out,err = self.pfw.sendCmd("getParameter",self.param_name[index_param])
+ assert out == init_value_param[index_param], log.F("BLACKBOARD: Forbidden change value for %s - Expected : %s Found : %s"
+ %(self.param_name[index_param],init_value_param[index_param],out))
+ log.I("Check filesystem value")
+ assert (commands.getoutput("cat %s"%(self.filesystem_name[index_param]))
+ == init_filesystem_value[index_param]), log.F("FILESYSTEM : parameter update error for %s"
+ %(self.block_name))
+
+ def test_Undefined_Param_Case(self):
+ """
+ Testing error BLOCK_PARAMETER : Out of range TestCase
+ -----------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set parameter PARAM_UNDEF to 1
+ - check block parameter Filesystem value
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - Error detected when setting PARAM_UNDEF
+ - FILESYSTEM parameters set to nominal value
+ """
+ log.D(self.test_Undefined_Param_Case.__doc__)
+
+ param_value = "1"
+ param_undefined_name = self.block_name + "/PARAM_UNDEF"
+
+ log.I("Load the initial value of parameters")
+ init_value_param=[]
+ init_filesystem_value=[]
+
+ for index_param in range(len(self.param_name)) :
+ out,err = self.pfw.sendCmd("getParameter",self.param_name[index_param])
+ init_value_param.append(out)
+ init_filesystem_value.append(commands.getoutput("cat %s"
+ %(self.filesystem_name[index_param])))
+
+ log.I("set parameter %s to %s, failed expected"
+ %(param_undefined_name,param_value))
+ out,err = self.pfw.sendCmd("setParameter",param_undefined_name,param_value)
+ assert err == None, log.E("setParameter %s %s : %s"
+ % (param_undefined_name,param_value, err))
+ assert out != "Done", log.F("Error not detected when setting parameter %s to out of bound value %s"
+ % (param_undefined_name,param_value))
+ log.I("Check parameter value")
+ for index_param in range(len(self.param_name)):
+ out,err = self.pfw.sendCmd("getParameter",self.param_name[index_param])
+ assert out == init_value_param[index_param], log.F("BLACKBOARD: Forbidden change value for %s - Expected : %s Found : %s"
+ %(self.param_name[index_param],init_value_param[index_param],out))
+ log.I("Check filesystem value")
+ assert (commands.getoutput("cat %s"%(self.filesystem_name[index_param]))
+ == init_filesystem_value[index_param]), log.F("FILESYSTEM : parameter update error for %s"
+ %(self.block_name))
diff --git a/test/functional-tests/PfwTestCase/Types/tRAW.py b/test/functional-tests/PfwTestCase/Types/tRAW.py
new file mode 100644
index 0000000..dc3a037
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tRAW.py
@@ -0,0 +1,723 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Raw Value testcases.
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ UINT16_MAX :
+ - 16 bits Unsigned Integer
+ - range [0x0, 0xFFFF]
+ UINT_16 :
+ - 16 bits Unsigned Integer
+ - range [0x0, 0x03E8]
+
+Test cases :
+------------
+ - Testing setValueSpace/getValueSpace functions
+ - Testing setOutputRawFormat/getOutputRawFormat functions
+ - UINT16_max parameter in nominal case = 50 / 0x32 :
+ - Writing Raw / Reading Hex
+ - Writing Raw / Reading Dec
+ - Writing Real / Reading Hex
+ - UINT16_max parameter min value = 0 :
+ - Writing Raw / Reading Hex
+ - Writing Raw / Reading Dec
+ - Writing Real / Reading Hex
+ - UINT16_max parameter max value = 65535 / 0xFFFF :
+ - Writing Raw / Reading Hex
+ - Writing Raw / Reading Dec
+ - Writing Real / Reading Hex
+ - UINT16_max parameter max value out of bounds = 0x10000 :
+ - Writing Raw
+ - UINT16 parameter max value out of bounds = 0x03E9 :
+ - Writing Raw
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type UINT16 - range [0, 1000]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/UINT16_Max"
+ self.filesystem_name="$PFW_RESULT/UINT16_Max"
+ self.param_name_2 = "/Test/Test/TEST_DIR/UINT16"
+ self.filesystem_name_2="$PFW_RESULT/UINT16"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+
+ def test_01_SettingOutputRawFormat(self):
+ """
+ Testing RAW - setOutputRawFormat/getOutputRawFormat functions
+ -------------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set hex in output raw format
+ - get output raw format
+ - set dec in output raw format
+ - get output raw format
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setOutputRawFormat] function
+ - [getOutputRawFormat] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - getOutputRawFormat return hex after setting hex
+ - getOutputRawFormat return dec after setting dec
+ """
+ log.D(self.test_01_SettingOutputRawFormat.__doc__)
+ value = "hex"
+ log.I("Setting %s in output raw format"
+ %(value))
+ out, err = self.pfw.sendCmd("setOutputRawFormat", value)
+ assert err == None, log.E("When setting output raw format : %s"
+ % (err))
+ assert out == "Done", log.F("setOutputRawFormat - expected : Done , found : %s"
+ % (out))
+ log.I("Check output raw format state")
+ out, err = self.pfw.sendCmd("getOutputRawFormat","")
+ assert err == None, log.E("When getting output raw format : %s"
+ % (err))
+ assert out == value, log.F("getOutputRawFormat - expected : %s , found : %s"
+ % (value,out))
+ value = "dec"
+ log.I("Setting %s in output raw format"
+ %(value))
+ out, err = self.pfw.sendCmd("setOutputRawFormat", value)
+ assert err == None, log.E("When setting output raw format : %s"
+ % (err))
+ assert out == "Done", log.F("setOutputRawFormat - expected : Done , found : %s"
+ % (out))
+ log.I("Check output raw format state")
+ out, err = self.pfw.sendCmd("getOutputRawFormat","")
+ assert err == None, log.E("When getting output raw format : %s"
+ % (err))
+ assert out == value, log.F("getOutputRawFormat - expected : %s , found : %s"
+ % (value,out))
+
+ def test_02_SettingValueSpace(self):
+ """
+ Testing RAW - setValueSpace/getValueSpace functions
+ ---------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set raw in value space
+ - get value space
+ - set real in value space
+ - get value space
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setValueSpace] function
+ - [getValueSpace] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - getValueSpace return 'raw' after setting raw
+ - getValueSpace return 'real' after setting real
+ """
+ log.D(self.test_02_SettingValueSpace.__doc__)
+ value = "raw"
+ log.I("Setting %s in value space"
+ % (value))
+ out, err = self.pfw.sendCmd("setValueSpace", value)
+ assert err == None, log.E("When setting value space : %s"
+ % (err))
+ assert out == "Done", log.F("setValueSpace - expected : done , found : %s"
+ % (out))
+ log.I("check value space state")
+ out, err = self.pfw.sendCmd("getValueSpace","")
+ assert err == None, log.E("When setting value space : %s"
+ % (err))
+ assert out == value, log.F("getValueSpace - expected : %s , found : %s"
+ % (value,out))
+ value = "real"
+ log.I("Setting %s in value space" % (value))
+ out, err = self.pfw.sendCmd("setValueSpace", value)
+ assert err == None, log.E("When setting value space : %s"
+ % (err))
+ assert out == "Done", log.F("setValueSpace - expected : done , found : %s"
+ % (out))
+ log.I("check value space state")
+ out, err = self.pfw.sendCmd("getValueSpace","")
+ assert err == None, log.E("When setting value space : %s"
+ % (err))
+ assert out == value, log.F("getValueSpace - expected : %s , found : %s"
+ % (value,out))
+
+ def test_03_WRaw_RHex_Nominal_Case(self):
+ """
+ Testing RAW - Nominal Case - UINT16_Max - Writing Raw / Reading Hex
+ -------------------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter in nominal case = 0x32
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter set to 0x32
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_03_WRaw_RHex_Nominal_Case.__doc__)
+ value = "0xFF00"
+ # When read back, parameter value will be in lowercase
+ filesystem_value = "0xff00"
+ blackboard_value = "0xFF00"
+ value_space = "raw"
+ outputraw_format = "hex"
+
+ log.I("UINT16_Max parameter in nominal case = %s"
+ %(value))
+ log.I("Value space = %s - Output Raw Format = %s"
+ %(value_space,outputraw_format))
+ self.pfw.sendCmd("setValueSpace", value_space)
+ self.pfw.sendCmd("setOutputRawFormat", outputraw_format)
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("When setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("setParameter - Unable to set the value %s for the parameter %s"
+ % (value,self.param_name))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("When setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == blackboard_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, blackboard_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == filesystem_value, log.F("FILESYSTEM : parameter update error for %s"
+ % (self.param_name))
+
+ def test_04_WReal_RHex_Nominal_Case(self):
+ """
+ Testing RAW - Nominal Case - UINT16_Max - Writing Real / Reading Hex
+ --------------------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter in nominal case = 0x32
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter set to 0x32
+ - Blackboard and filesystem values checked
+ - When value space setting to Real, Output Raw Format is
+ disabled. Even if Output Raw Format is setting to Hex, the
+ output is in decimal.
+ """
+ log.D(self.test_04_WReal_RHex_Nominal_Case.__doc__)
+ value = "50"
+ filesystem_value = "0x32"
+ blackboard_value = "50"
+ value_space = "real"
+ outputraw_format = "hex"
+
+ log.I("UINT16_Max parameter in nominal case = %s"
+ %(value))
+ log.I("Value space = %s - Output Raw Format = %s"
+ %(value_space,outputraw_format))
+ self.pfw.sendCmd("setValueSpace", value_space)
+ self.pfw.sendCmd("setOutputRawFormat", outputraw_format)
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("When setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("setParameter - Unable to set the value %s for the parameter %s"
+ % (value,self.param_name))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("When setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == blackboard_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, blackboard_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == filesystem_value, log.F("FILESYSTEM : parameter update error for %s"
+ %(self.param_name))
+
+ def test_05_WRaw_RDec_Nominal_Case(self):
+ """
+ Testing RAW - Nominal Case - UINT16_Max - Writing Raw / Reading Dec
+ -------------------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter in nominal case = 0x32
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ - [setValueSpace] function
+ - [setOutputRawFormat] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter set to 0x32
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_05_WRaw_RDec_Nominal_Case.__doc__)
+ value = "0x32"
+ filesystem_value = "0x32"
+ blackboard_value = "50"
+ value_space = "raw"
+ outputraw_format = "dec"
+
+ log.I("UINT16_Max parameter in nominal case = %s"
+ %(value))
+ log.I("Value space = %s - Output Raw Format = %s"
+ %(value_space,outputraw_format))
+ self.pfw.sendCmd("setValueSpace", value_space)
+ self.pfw.sendCmd("setOutputRawFormat", outputraw_format)
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("When setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("setParameter - Unable to set the value %s for the parameter %s"
+ % (value,self.param_name))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("When setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == blackboard_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, blackboard_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == filesystem_value, log.F("FILESYSTEM : parameter update error for %s"
+ %(self.param_name))
+
+
+
+ def test_06_WRaw_RHex_TypeMin_Case(self):
+ """
+ Testing RAW - Minimum Case - UINT16_Max - Writing Raw / Reading Hex
+ -------------------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter in nominal case = 0x0
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ - [setValueSpace] function
+ - [setOutputRawFormat] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter set to 0x0
+ - Blackboard and filesystem values checked
+
+ """
+ log.D(self.test_06_WRaw_RHex_TypeMin_Case.__doc__)
+ value = "0x0"
+ filesystem_value = "0x0"
+ blackboard_value = "0x0000"
+ value_space = "raw"
+ outputraw_format = "hex"
+
+ log.I("UINT16_Max parameter in nominal case = %s"
+ %(value))
+ log.I("Value space = %s - Output Raw Format = %s"
+ %(value_space,outputraw_format))
+ self.pfw.sendCmd("setValueSpace", value_space)
+ self.pfw.sendCmd("setOutputRawFormat", outputraw_format)
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("When setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("setParameter - Unable to set the value %s for the parameter %s"
+ %(value,self.param_name))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("When setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == blackboard_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, blackboard_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == filesystem_value, log.F("FILESYSTEM : parameter update error for %s"
+ %(self.param_name))
+
+ def test_07_WReal_RHex_TypeMin_Case(self):
+ """
+ Testing RAW - Minimum Case - UINT16_Max - Writing Real / Reading Hex
+ --------------------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter in nominal case = 0x0
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ - [setValueSpace] function
+ - [setOutputRawFormat] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter set to 0x0
+ - Blackboard and filesystem values checked
+ - When value space setting to Real, Output Raw Format is
+ disabled. Even if Output Raw Format is setting to Hex, the
+ output is in decimal.
+ """
+ log.D(self.test_07_WReal_RHex_TypeMin_Case.__doc__)
+ value = "0"
+ filesystem_value = "0x0"
+ blackboard_value = "0"
+ value_space = "real"
+ outputraw_format = "hex"
+
+ log.I("UINT16_Max parameter in nominal case = %s"
+ %(value))
+ log.I("Value space = %s - Output Raw Format = %s"
+ %(value_space,outputraw_format))
+ self.pfw.sendCmd("setValueSpace", value_space)
+ self.pfw.sendCmd("setOutputRawFormat", outputraw_format)
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("When setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("setParameter - Unable to set the value %s for the parameter %s"
+ % (value,self.param_name))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("When setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == blackboard_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, blackboard_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == filesystem_value, log.F("FILESYSTEM : parameter update error for %s"
+ %(self.param_name))
+
+ def test_08_WRaw_RDec_TypeMin_Case(self):
+ """
+ Testing RAW - Minimum Case - UINT16_Max - Writing raw / Reading dec
+ -------------------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter in nominal case = 0x0
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ - [setValueSpace] function
+ - [setOutputRawFormat] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter set to 0x0
+ - Blackboard and filesystem values checked
+ - When value space setting to Real, Output Raw Format is
+ disabled. Even if Output Raw Format is setting to Hex, the
+ output is in decimal.
+ """
+ log.D(self.test_08_WRaw_RDec_TypeMin_Case.__doc__)
+ value = "0x0"
+ filesystem_value = "0x0"
+ blackboard_value = "0"
+ value_space = "raw"
+ outputraw_format = "dec"
+
+ log.I("UINT16_Max parameter in nominal case = %s"
+ %(value))
+ log.I("Value space = %s - Output Raw Format = %s"
+ %(value_space,outputraw_format))
+ self.pfw.sendCmd("setValueSpace", value_space)
+ self.pfw.sendCmd("setOutputRawFormat", outputraw_format)
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("When setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("setParameter - Unable to set the value %s for the parameter %s"
+ % (value,self.param_name))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("When setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == blackboard_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, blackboard_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == filesystem_value, log.F("FILESYSTEM : parameter update error for %s"
+ %(self.param_name))
+
+
+ def test_09_WRaw_RHex_TypeMax_Case(self):
+ """
+ Testing RAW - Maximum Case - UINT16_Max - Writing Raw / Reading Hex
+ -------------------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter in nominal case = 0xFFFF / 65535
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ - [setValueSpace] function
+ - [setOutputRawFormat] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter set to 0xFFFF
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_09_WRaw_RHex_TypeMax_Case.__doc__)
+ value = "0xFFFF"
+ filesystem_value = "0xffff"
+ blackboard_value = "0xFFFF"
+ value_space = "raw"
+ outputraw_format = "hex"
+
+ log.I("UINT16_Max parameter in nominal case = %s"
+ %(value))
+ log.I("Value space = %s - Output Raw Format = %s"
+ %(value_space,outputraw_format))
+ self.pfw.sendCmd("setValueSpace", value_space)
+ self.pfw.sendCmd("setOutputRawFormat", outputraw_format)
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("When setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("setParameter - Unable to set the value %s for the parameter %s"
+ % (value,self.param_name))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("When setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == blackboard_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, blackboard_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == filesystem_value, log.F("FILESYSTEM : parameter update error for %s"
+ %(self.param_name))
+
+ def test_10_WReal_RHex_TypeMax_Case(self):
+ """
+ Testing RAW - Maximum Case - UINT16_Max - Writing Real / Reading Hex
+ --------------------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter in nominal case = 0xFFFF / 65535
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ - [setValueSpace] function
+ - [setOutputRawFormat] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter set to 0xFFFF
+ - Blackboard and filesystem values checked
+ - When value space setting to Real, Output Raw Format is
+ disabled. Even if Output Raw Format is setting to Hex, the
+ output is in decimal.
+ """
+ log.D(self.test_10_WReal_RHex_TypeMax_Case.__doc__)
+ value = "65535"
+ filesystem_value = "0xffff"
+ blackboard_value = "65535"
+ value_space = "real"
+ outputraw_format = "hex"
+
+ log.I("UINT16_Max parameter in nominal case = %s"
+ %(value))
+ log.I("Value space = %s - Output Raw Format = %s"
+ %(value_space,outputraw_format))
+ self.pfw.sendCmd("setValueSpace", value_space)
+ self.pfw.sendCmd("setOutputRawFormat", outputraw_format)
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("When setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("setParameter - Unable to set the value %s for the parameter %s"
+ % (value,self.param_name))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("When setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == blackboard_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, blackboard_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == filesystem_value, log.F("FILESYSTEM : parameter update error for %s"
+ %(self.param_name))
+
+ def test_11_WRaw_RDec_TypeMax_Case(self):
+ """
+ Testing RAW - Maximum Case - UINT16_Max - Writing Real / Reading Hex
+ --------------------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter in nominal case = 0xFFFF / 65535
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ - [setValueSpace] function
+ - [setOutputRawFormat] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter set to 0xFFFF
+ - Blackboard and filesystem values checked
+ - When value space setting to Real, Output Raw Format is
+ disabled. Even if Output Raw Format is setting to Hex, the
+ output is in decimal.
+ """
+ log.D(self.test_11_WRaw_RDec_TypeMax_Case.__doc__)
+ value = "0xFFFF"
+ filesystem_value = "0xffff"
+ blackboard_value = "65535"
+ value_space = "raw"
+ outputraw_format = "dec"
+
+ log.I("UINT16_Max parameter in nominal case = %s"
+ %(value))
+ log.I("Value space = %s - Output Raw Format = %s"
+ %(value_space,outputraw_format))
+ self.pfw.sendCmd("setValueSpace", value_space)
+ self.pfw.sendCmd("setOutputRawFormat", outputraw_format)
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("When setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("setParameter - Unable to set the value %s for the parameter %s"
+ % (value,self.param_name))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("When setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == blackboard_value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, blackboard_value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == filesystem_value, log.F("FILESYSTEM : parameter update error for %s"
+ %(self.param_name))
+
+
+ def test_12_WRaw_UINT16_Max_OutOfBound(self):
+ """
+ Testing RAW - Out of range Case - UINT16_Max - Writing Raw
+ ----------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter in nominal case = 0x10000 / 65536
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ - [setValueSpace] function
+ - [setOutputRawFormat] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - UINT16_max parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_12_WRaw_UINT16_Max_OutOfBound.__doc__)
+ value = "0x10000"
+ filesystem_value = commands.getoutput("cat %s"%(self.filesystem_name))
+ value_space = "raw"
+ outputraw_format = "hex"
+
+ log.I("UINT16_Max parameter max value out of bound = %s"%(value))
+ log.I("Value space = %s - Output Raw Format = %s"
+ %(value_space,outputraw_format))
+ self.pfw.sendCmd("setValueSpace", value_space)
+ self.pfw.sendCmd("setOutputRawFormat", outputraw_format)
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s -> %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("Error not detected when setting parameter %s out of bound"
+ % (self.param_name))
+ #Check parameter value on blackboard
+ assert commands.getoutput("cat %s"%(self.filesystem_name)) == filesystem_value, "FILESYSTEM : Forbiden parameter change"
+
+
+ def test_13_WRaw_UINT16_OutOfBound(self):
+ """
+ Testing RAW - Out of range Case - UINT16 - Writing Raw
+ ------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter in nominal case = 0x03E9 / 1001
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ - [setValueSpace] function
+ - [setOutputRawFormat] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - UINT16 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_13_WRaw_UINT16_OutOfBound.__doc__)
+ value = "0x03E9"
+ filesystem_value = commands.getoutput("cat %s"%(self.filesystem_name_2))
+ value_space = "raw"
+ outputraw_format = "hex"
+
+ log.I("UINT16_Max parameter max value out of bound = %s"%(value))
+ log.I("Value space = %s - Output Raw Format = %s"
+ %(value_space,outputraw_format))
+ self.pfw.sendCmd("setValueSpace", value_space)
+ self.pfw.sendCmd("setOutputRawFormat", outputraw_format)
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name_2, value)
+ assert err == None, log.E("when setting parameter %s -> %s"
+ % (self.param_name_2, err))
+ assert out != "Done", log.F("Error not detected when setting parameter %s out of bound"
+ % (self.param_name_2))
+ #Check parameter value on blackboard
+ assert commands.getoutput("cat %s"%(self.filesystem_name_2)) == filesystem_value, "FILESYSTEM : Forbiden parameter change"
diff --git a/test/functional-tests/PfwTestCase/Types/tSTRING_128.py b/test/functional-tests/PfwTestCase/Types/tSTRING_128.py
new file mode 100644
index 0000000..26c5bc0
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tSTRING_128.py
@@ -0,0 +1,298 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import commands, string, random
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type UINT8_S - range [-100, 100]
+class TestCases(PfwTestCase):
+
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/STR_CHAR128"
+ self.pfw.sendCmd("setTuningMode", "on")
+ self.size_max=128
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Digits_String_Case(self):
+ """
+ |============================================================|
+ | Testing data types - String |
+ | max number of char = 128 |
+ |============================================================|
+ | File : tSTRING_128.py |
+ | Version : 01 |
+ | |
+ | Test cases : |
+ | - STR_CHAR128 parameter nominal value = string_Conf_0 |
+ | - STR_CHAR128 parameter empty value = '' |
+ | - STR_CHAR128 parameter full value = generate randomly 128 |
+ | letters characters |
+ | - STR_CHAR128 parameter space character value = test string|
+ | - STR_CHAR128 parameter full digits value = generate |
+ | randomly 128 digits char |
+ | - STR_CHAR128 parameter oversize value = generate randomly |
+ | 129 char |
+ | |
+ |============================================================|
+ | STR_CHAR128 parameter in digits case = 128 digits char |
+ |============================================================|
+ | Test Case description : |
+ | - STR_CHAR128 parameter in digit case = 128 digits char |
+ | Tested commands : |
+ | * setParameter |
+ | - getParameter |
+ | Expected result : |
+ | - STR_CHAR128 parameter set to the same 128 digits char |
+ | (blackboard and filesystem values checked) |
+ |============================================================|
+ """
+ log.D(self.test_Digits_String_Case.__doc__)
+ log.I("STR_CHAR128 parameter initial state = string_Conf_0")
+ value = ""
+ for i in range(self.size_max-1):
+ value=value+str(random.choice(string.digits))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s -> %s" % (self.param_name, err))
+ assert out == "Done", log.F(out)
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when getting parameter %s -> %s" % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/STR_CHAR128') == value, log.F("FILESYSTEM : parameter update error")
+
+ def test_Empty_String_Case(self):
+ """
+ |============================================================|
+ | STR_CHAR128 parameter empty string = \'\' |
+ |============================================================|
+ | Test Case description : |
+ | - STR_CHAR128 parameter in empty string case = \'\' |
+ | Tested commands : |
+ | * setParameter |
+ | - getParameter |
+ | Expected result : |
+ | - STR_CHAR128 parameter set empty |
+ | (blackboard and filesystem values checked) |
+ |============================================================|
+ """
+ log.D(self.test_Empty_String_Case.__doc__)
+ log.I("STR_CHAR128 parameter empty string = \'\'")
+ value = "\"\""
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s -> %s" % (self.param_name, err))
+ assert out == "Done", log.F(out)
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when getting parameter %s -> %s" % (self.param_name, err))
+ assert out == "", log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/STR_CHAR128') == "", log.F("FILESYSTEM : parameter update error")
+
+ def test_OverSize_String_Case(self):
+ """
+ |============================================================|
+ | STR_CHAR128 parameter oversize |
+ |============================================================|
+ | Test Case description : |
+ | - STR_CHAR128 parameter in oversize case = 129 random char |
+ | Tested commands : |
+ | * setParameter |
+ | - getParameter |
+ | Expected result : |
+ | - error detected |
+ | - STR_CHAR128 parameter not updated |
+ |============================================================|
+ """
+ log.D(self.test_OverSize_String_Case.__doc__)
+ log.I("STR_CHAR128 parameter size max=128 character")
+ value=""
+ for i in range(self.size_max+1):
+ value=value+str(random.choice(string.letters))
+ param_check = commands.getoutput('cat $PFW_RESULT/STR_CHAR128')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s -> %s" % (self.param_name, err))
+ assert out != "Done", log.F("Error not detected when setting parameter %s over size" % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/STR_CHAR128') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+
+ def test_Full_Letters_String_Case(self):
+ """
+ |============================================================|
+ | STR_CHAR128 parameter full size test case |
+ |============================================================|
+ | Test Case description : |
+ | - STR_CHAR128 parameter in fullsize case = 128 random char |
+ | Tested commands : |
+ | * setParameter |
+ | - getParameter |
+ | Expected result : |
+ | - STR_CHAR128 parameter set to the same 128 letters char |
+ | (blackboard and filesystem values checked) |
+ |============================================================|
+ """
+ log.D(self.test_Full_Letters_String_Case.__doc__)
+ log.I("STR_CHAR128 parameter initial state : string")
+ value = ""
+ for i in range(self.size_max-1):
+ value=value+str(random.choice(string.letters))
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s -> %s" % (self.param_name, err))
+ assert out == "Done", log.F("Expected : Done, result : %s" % (out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/STR_CHAR128') == value, log.F("FILESYSTEM : parameter update error")
+
+ def test_Nominal_String_Case(self):
+ """
+ |============================================================|
+ | STR_CHAR128 parameter Nominal test case |
+ |============================================================|
+ | Test Case description : |
+ | - STR_CHAR128 parameter in nominal case = TestString |
+ | Tested commands : |
+ | * setParameter |
+ | - getParameter |
+ | Expected result : |
+ | - STR_CHAR128 parameter set to TestString |
+ | (blackboard and filesystem values checked) |
+ |============================================================|
+ """
+ log.D(self.test_Nominal_String_Case.__doc__)
+ log.I("STR_CHAR128 parameter nominal string = TestString")
+ value = "TestString"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("When setting parameter %s -> %s" % (self.param_name, err))
+ assert out == "Done", log.F("Expected : Done, found : %s" % (out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("When setting parameter %s -> %s" % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/STR_CHAR128') == value, log.F("FILESYSTEM : parameter update error")
+
+ def test_Punctuation_Empty_Parenthese_String_Case(self):
+ """
+ |============================================================|
+ | STR_CHAR128 parameter empty Parenthese char test case |
+ |============================================================|
+ | Test Case description : |
+ | - STR_CHAR128 parameter = TestParenthese() |
+ | Tested commands : |
+ | * setParameter |
+ | - getParameter |
+ | Expected result : |
+ | - Not Determined now |
+ |============================================================|
+ """
+ log.D(self.test_Punctuation_Empty_Parenthese_String_Case.__doc__)
+ value = "ParentheseTest()"
+ log.I("STR_CHAR128 parameter Parenthese Char = %s" % (value))
+ param_check = commands.getoutput('cat $PFW_RESULT/STR_CHAR128')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, "'%s'" % (value))
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name, err))
+ assert out == "Done", log.F("Expected : Done, found : %s" % (out))
+ #Get parameter value
+ out, err = self.pfw.sendCmd("getParameter", self.param_name)
+ assert err == None, log.E("When getting parameter %s : %s" % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/STR_CHAR128') == value, log.F("FILESYSTEM : parameter update error")
+
+ def test_Punctuation_Full_Parenthese_String_Case(self):
+ """
+ |============================================================|
+ | STR_CHAR128 parameter full Parenthese char test case |
+ |============================================================|
+ | Test Case description : |
+ | - STR_CHAR128 parameter = TestParenthese(test) |
+ | Tested commands : |
+ | * setParameter |
+ | - getParameter |
+ | Expected result : |
+ | - Not Determined now |
+ |============================================================|
+ """
+ log.D(self.test_Punctuation_Full_Parenthese_String_Case.__doc__)
+ value = "ParentheseTest(test)"
+ log.I("STR_CHAR128 parameter Parenthese Char = %s" % (value))
+ param_check = commands.getoutput('cat $PFW_RESULT/STR_CHAR128')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, "'%s'" % value)
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name, err))
+ assert out == "Done", log.F("Expected : Done, found : %s" % (out))
+ #Get parameter value
+ out, err = self.pfw.sendCmd("getParameter", self.param_name)
+ assert err == None, log.E("When getting parameter %s : %s" % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/STR_CHAR128') == value, log.F("FILESYSTEM : parameter update error")
+
+ def test_SpaceChar_String_Case(self):
+ """
+ |============================================================|
+ | STR_CHAR128 parameter space char test case |
+ |============================================================|
+ | Test Case description : |
+ | - STR_CHAR128 parameter = Test String |
+ | Tested commands : |
+ | * setParameter |
+ | - getParameter |
+ | Expected result : |
+ | - Not Determined now |
+ |============================================================|
+ """
+ log.D(self.test_SpaceChar_String_Case.__doc__)
+ value = "Test String"
+ log.I("STR_CHAR128 parameter Parenthese Char = %s" % (value))
+ value_check = "Test String"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name, err))
+ assert out == "Done", log.F("Expected : Done, found : %s" % (out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("When setting parameter %s : %s" % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" % (self.param_name, value_check, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/STR_CHAR128') == value_check, log.F("FILESYSTEM : parameter update error")
diff --git a/test/functional-tests/PfwTestCase/Types/tUINT16.py b/test/functional-tests/PfwTestCase/Types/tUINT16.py
new file mode 100644
index 0000000..5237a3d
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tUINT16.py
@@ -0,0 +1,249 @@
+#!/usr/bin/python2
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+"""
+Integer parameter type testcases - UINT16
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ UINT16 :
+ - unsigned
+ - size = 16
+ - range : [0, 1000]
+
+Test cases :
+------------
+ - UINT16 parameter min value = 0
+ - UINT16 parameter min value out of bounds = -1
+ - UINT16 parameter max value = 1000
+ - UINT16 parameter max value out of bounds = 1001
+ - UINT16 parameter in nominal case = 50
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+
+# Test of type UINT16 - range [0, 1000]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/UINT16"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing UINT16 in nominal case = 50
+ -----------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT16 parameter in nominal case = 50
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT16 parameter set to 50
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ log.I("UINT16 parameter in nominal case = 50")
+ value = "50"
+ hex_value = "0x32"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT16') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin(self):
+ """
+ Testing UINT16 minimal value = 0
+ --------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT16 parameter min value = 0
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT16 parameter set to 0
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ log.I("UINT16 parameter min value = 0")
+ value = "0"
+ hex_value = "0x0"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT16') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing UINT16 parameter value out of negative range
+ ----------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT16 to -1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - UINT16 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ log.I("UINT16 parameter min value out of bounds = -1")
+ value = "-1"
+ param_check = commands.getoutput('cat $PFW_RESULT/UINT16')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT16') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
+
+ def test_TypeMax(self):
+ """
+ Testing UINT16 parameter maximum value
+ --------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT16 to 1000
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT16 parameter set to 1000
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ log.I("UINT16 parameter max value = 1000")
+ value = "1000"
+ hex_value = "0x3e8"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT16') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing UINT16 parameter value out of positive range
+ ----------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT16 to 1001
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - UINT16 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ log.I("UINT16 parameter max value out of bounds = 1001")
+ value = "1001"
+ param_check = commands.getoutput('cat $PFW_RESULT/UINT16')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT16') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/Types/tUINT16_Max.py b/test/functional-tests/PfwTestCase/Types/tUINT16_Max.py
new file mode 100644
index 0000000..cf9939c
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tUINT16_Max.py
@@ -0,0 +1,248 @@
+#!/usr/bin/python2
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Integer parameter type testcases - UINT16_Max
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ UINT16_Max :
+ - unsigned
+ - size = 16
+ - range : [0, 65535]
+
+Test cases :
+------------
+ - UINT16_Max parameter min value = 0
+ - UINT16_Max parameter min value out of bounds = -1
+ - UINT16_Max parameter max value = 65535
+ - UINT16_Max parameter max value out of bounds = 65536
+ - UINT16_Max parameter in nominal case = 50
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+
+# Test of type UINT16_Max - range [0, 65535]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/UINT16_Max"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing UINT16_Max in nominal case = 50
+ ---------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT16_Max parameter in nominal case = 50
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter set to 50
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ log.I("UINT16_Max parameter in nominal case = 50")
+ value = "50"
+ hex_value = "0x32"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT16_Max') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin(self):
+ """
+ Testing UINT16_Max minimal value = 0
+ ------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT16_Max parameter min value = 0
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter set to 0
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ log.I("UINT16_Max parameter min value = 0")
+ value = "0"
+ hex_value = "0x0"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT16_Max') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing UINT16_Max parameter value out of negative range
+ --------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT16_Max to -1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - UINT16_Max parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ log.I("UINT16_Max parameter min value out of bounds = -1")
+ value = "-1"
+ param_check = commands.getoutput('cat $PFW_RESULT/UINT16_Max')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT16_Max') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
+
+ def test_TypeMax(self):
+ """
+ Testing UINT16_Max parameter maximum value
+ ------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT16_Max to 65535
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT16_Max parameter set to 65535
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ log.I("UINT16_Max parameter max value = 65535")
+ value = "65535"
+ hex_value = "0xffff"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT16_Max') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing UINT16_Max parameter value out of positive range
+ --------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT16_Max to 65536
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - UINT16_Max parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ log.I("UINT16_Max parameter max value out of bounds = 65536")
+ value = "65536"
+ param_check = commands.getoutput('cat $PFW_RESULT/UINT16_Max')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT16_Max') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/Types/tUINT32.py b/test/functional-tests/PfwTestCase/Types/tUINT32.py
new file mode 100644
index 0000000..f31361a
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tUINT32.py
@@ -0,0 +1,248 @@
+#!/usr/bin/python2
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Integer parameter type testcases - UINT32
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ UINT32 :
+ - unsigned
+ - size = 32
+ - range : [0, 1000]
+
+Test cases :
+------------
+ - UINT32 parameter min value = 0
+ - UINT32 parameter min value out of bounds = -1
+ - UINT32 parameter max value = 1000
+ - UINT32 parameter max value out of bounds = 1001
+ - UINT32 parameter in nominal case = 50
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+
+# Test of type UINT32 - range [0, 1000]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/UINT32"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing UINT32 in nominal case = 50
+ -----------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT32 parameter in nominal case = 50
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT32 parameter set to 50
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ log.I("UINT32 parameter in nominal case = 50")
+ value = "50"
+ hex_value = "0x32"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT32') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin(self):
+ """
+ Testing UINT32 minimal value = 0
+ --------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT32 parameter min value = 0
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT32 parameter set to 0
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ log.I("UINT32 parameter min value = 0")
+ value = "0"
+ hex_value = "0x0"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT32') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing UINT32 parameter value out of negative range
+ ----------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT32 to -1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - UINT32 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ log.I("UINT32 parameter min value out of bounds = -1")
+ value = "-1"
+ param_check = commands.getoutput('cat $PFW_RESULT/UINT32')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT32') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
+
+ def test_TypeMax(self):
+ """
+ Testing UINT32 parameter maximum value
+ --------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT32 to 1000
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT32 parameter set to 1000
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ log.I("UINT32 parameter max value = 1000")
+ value = "1000"
+ hex_value = "0x3e8"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT32') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing UINT32 parameter value out of positive range
+ ----------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT32 to 1001
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - UINT32 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ log.I("UINT32 parameter max value out of bounds = 1001")
+ value = "1001"
+ param_check = commands.getoutput('cat $PFW_RESULT/UINT32')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT32') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/Types/tUINT32_ARRAY.py b/test/functional-tests/PfwTestCase/Types/tUINT32_ARRAY.py
new file mode 100644
index 0000000..a20d404
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tUINT32_ARRAY.py
@@ -0,0 +1,324 @@
+#!/usr/bin/python2
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Array parameter type testcases : UINT32 Array
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ UINT8 Array = 32bits unsigned int array :
+ - Array size : 10
+ - values range : [0, 100]
+
+Test cases :
+------------
+ - Testing nominal case
+ - Testing minimum
+ - Testing minimum overflow
+ - Testing maximum
+ - Testing maximum overflow
+ - Testing array index out of bounds
+ - Testing value format error
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+from ctypes import c_uint16
+
+
+class TestCases(PfwTestCase):
+
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/UINT32_ARRAY"
+ self.param_short_name = "$PFW_RESULT/UINT32_ARRAY"
+ print '\r'
+ self.pfw.sendCmd("setTuningMode", "on")
+ print '\r'
+ self.array_size = 100
+ self.array_min = 0
+ self.array_max = 100
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing UINT32_ARRAY Nominal Case
+ ---------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set every UINT32_ARRAY elements to autorized values
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT32_ARRAY array elements correctly recorded
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+
+ for index in range (self.array_size):
+ indexed_array_value = index + self.array_min
+ if indexed_array_value>self.array_max:
+ indexed_array_value=self.array_max
+ hex_indexed_array_value = hex(c_uint16(indexed_array_value).value)
+ #Check parameter value setting
+ indexed_array_value_path = "".join([self.param_name, "/", str(index)])
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.F("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", str(indexed_array_value_path), "")
+ assert err == None, log.E("when setting parameter %s[%s] : %s"
+ % (self.param_name, str(index), err))
+ assert out == str(indexed_array_value), log.F("BLACKBOARD : Incorrect value for %s[%s], expected: %s, found: %s"
+ % (self.param_name, str(index), str(indexed_array_value), out))
+ #Check parameter value on filesystem
+ files_system_check = "awk -v ligne="+str(index)+" 'NR == ligne+1 { print $0}' "+self.param_short_name
+ indexed_files_system_array_value = commands.getoutput(files_system_check)
+ assert indexed_files_system_array_value == hex_indexed_array_value, log.F("FILESSYSTEM : %s[%s] update error"
+ % (self.param_name, str(index)))
+
+ def test_Min_Value(self):
+ """
+ Testing UINT32_ARRAY minimum value
+ ----------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set every UINT32_ARRAY elements to minimum values : 0
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT32_ARRAY array elements correctly recorded
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Min_Value.__doc__)
+ index = 0
+ indexed_array_value = self.array_min
+ indexed_array_value_path = "".join([self.param_name, "/", str(index)])
+ hex_indexed_array_value = hex(c_uint16(indexed_array_value).value)
+ #Check parameter value setting
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", str(indexed_array_value_path), "")
+ assert err == None, log.E("when setting parameter %s[%s] : %s"
+ % (self.param_name, str(index), err))
+ assert out == str(indexed_array_value), log.F("BLACKBOARD : Incorrect value for %s[%s], expected: %s, found: %s"
+ % (self.param_name, str(index), str(indexed_array_value), out))
+ #Check parameter value on filesystem
+ files_system_check = "awk -v ligne="+str(index)+" 'NR == ligne+1 { print $0}' "+self.param_short_name
+ indexed_files_system_array_value = commands.getoutput(files_system_check)
+ assert indexed_files_system_array_value == hex_indexed_array_value, log.F("FILESSYSTEM : %s[%s] update error"
+ % (self.param_name, str(index)))
+
+ def test_Min_Value_Overflow(self):
+ """
+ Testing UINT32_ARRAY parameter values out of negative range
+ -----------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set every UINT32_ARRAY elements to -1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT32_ARRAY array elements not recorded
+ - Error correctly detected
+ """
+ log.D(self.test_Min_Value_Overflow.__doc__)
+ index = 0
+ indexed_array_value = self.array_min
+ indexed_array_value_path = "".join([self.param_name, "/", str(index)])
+ #Check initial parameter value setting
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.F("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ files_system_check = "awk -v ligne="+str(index)+" 'NR == ligne+1 { print $0}' "+self.param_short_name
+ param_check = commands.getoutput(files_system_check)
+ #Check final parameter value setting
+ indexed_array_value = indexed_array_value - 1
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out != "Done", log.F("Error not detected when setting parameter %s[%s] out of bounds"
+ % (self.param_name, str(index)))
+ #Check parameter value on filesystem
+ indexed_files_system_array_value = commands.getoutput(files_system_check)
+ assert indexed_files_system_array_value == param_check, log.F("FILESSYSTEM : %s[%s] forbiden update"
+ % (self.param_name, str(index)))
+
+ def test_Max_Value(self):
+ """
+ Testing UINT32_ARRAY maximum value
+ ----------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set every UINT32_ARRAY elements to maximum values : 15
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT32_ARRAY array elements correctly recorded
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Max_Value.__doc__)
+ index = 0
+ indexed_array_value = self.array_max
+ indexed_array_value_path = "".join([self.param_name, "/", str(index)])
+ hex_indexed_array_value = hex(c_uint16(indexed_array_value).value)
+ #Check parameter value setting
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.F("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", str(indexed_array_value_path), "")
+ assert err == None, log.E("when setting parameter %s[%s] : %s"
+ % (self.param_name, str(index), err))
+ assert out == str(indexed_array_value), log.F("BLACKBOARD : Incorrect value for %s[%s], expected: %s, found: %s"
+ % (self.param_name, str(index), str(indexed_array_value), out))
+ #Check parameter value on filesystem
+ files_system_check = "awk -v ligne="+str(index)+" 'NR == ligne+1 { print $0}' "+self.param_short_name
+ indexed_files_system_array_value = commands.getoutput(files_system_check)
+ assert indexed_files_system_array_value == hex_indexed_array_value, log.F("FILESSYSTEM : %s[%s] update error"
+ % (self.param_name, str(index)))
+
+ def test_Max_Value_Overflow(self):
+ """
+ Testing UINT32_ARRAY parameter values out of positive range
+ -----------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set every UINT32_ARRAY elements to 16
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT32_ARRAY array elements not recorded
+ - Error correctly detected
+ """
+ log.D(self.test_Max_Value_Overflow.__doc__)
+ index = 0
+ indexed_array_value = self.array_max
+ indexed_array_value_path = "".join([self.param_name, "/", str(index)])
+ #Check initial parameter value setting
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.F("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ files_system_check = "awk -v ligne="+str(index)+" 'NR == ligne+1 { print $0}' "+self.param_short_name
+ param_check = commands.getoutput(files_system_check)
+ #Check final parameter value setting
+ indexed_array_value = indexed_array_value + 1
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out != "Done", log.F("Error not detected when setting parameter %s[%s] out of bounds"
+ % (self.param_name, str(index)))
+ #Check parameter value on filesystem
+ indexed_files_system_array_value = commands.getoutput(files_system_check)
+ assert indexed_files_system_array_value == param_check, log.F("FILESSYSTEM : %s[%s] forbiden update"
+ % (self.param_name, str(index)))
+
+ def test_Array_Index_Overflow(self):
+ """
+ Testing Array index out of bounds
+ ---------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set an out of bounds array indexed element
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT32_ARRAY array elements not recorded
+ - Error correctly detected
+ """
+ log.D(self.test_Array_Index_Overflow.__doc__)
+ index_values = (self.array_size-1, self.array_size+1, -1)
+ for index in index_values:
+ print index
+ indexed_array_value = self.array_max
+ indexed_array_value_path = "".join([self.param_name, "/", str(index)])
+ #Check parameter value setting
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ if index in [0, self.array_size-1]:
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.F("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ else:
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out != "Done", log.F("Error not detected when setting array %s index out of bounds"
+ % (self.param_name))
diff --git a/test/functional-tests/PfwTestCase/Types/tUINT32_Max.py b/test/functional-tests/PfwTestCase/Types/tUINT32_Max.py
new file mode 100644
index 0000000..2e99495
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tUINT32_Max.py
@@ -0,0 +1,248 @@
+#!/usr/bin/python2
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Integer parameter type testcases - UINT16
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ UINT16 :
+ - unsigned
+ - size = 32
+ - range : [0, 4294967295]
+
+Test cases :
+------------
+ - UINT16 parameter min value = 0
+ - UINT16 parameter min value out of bounds = -1
+ - UINT16 parameter max value = 4294967295
+ - UINT16 parameter max value out of bounds = 4294967296
+ - UINT16 parameter in nominal case = 50
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+
+# Test of type UINT32_Max - range [0, 4294967295]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/UINT32_Max"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing UINT16 in nominal case = 50
+ -----------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT16 parameter in nominal case = 50
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT16 parameter set to 50
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ log.I("UINT32_Max parameter in nominal case = 50")
+ value = "50"
+ hex_value = "0x32"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT32_Max') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin(self):
+ """
+ Testing UINT16 minimal value = 0
+ --------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT16 parameter min value = 0
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT16 parameter set to 0
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ log.I("UINT32_Max parameter min value = 0")
+ value = "0"
+ hex_value = "0x0"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT32_Max') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing UINT16 parameter value out of negative range
+ ----------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT16 to -1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - UINT16 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ log.I("UINT32_Max parameter min value out of bounds = -1")
+ value = "-1"
+ param_check = commands.getoutput('cat $PFW_RESULT/UINT32_Max')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT32_Max') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
+
+ def test_TypeMax(self):
+ """
+ Testing UINT16 parameter maximum value
+ --------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT16 to 4294967295
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT16 parameter set to 4294967295
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ log.I("UINT32_Max parameter max value = 4294967295")
+ value = "4294967295"
+ hex_value = "0xffffffff"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT32_Max') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing UINT16 parameter value out of positive range
+ ----------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT16 to 4294967296
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - UINT16 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ log.I("UINT32_Max parameter max value out of bounds = 4294967296")
+ value = "4294967296"
+ param_check = commands.getoutput('cat $PFW_RESULT/UINT32_Max')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT32_Max') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/Types/tUINT8.py b/test/functional-tests/PfwTestCase/Types/tUINT8.py
new file mode 100644
index 0000000..b41712b
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tUINT8.py
@@ -0,0 +1,247 @@
+#!/usr/bin/python2
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Integer parameter type testcases - UINT8
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ UINT8 :
+ - unsigned
+ - size = 8
+ - range : [0, 100]
+
+Test cases :
+------------
+ - UINT8 parameter min value = 0
+ - UINT8 parameter min value out of bounds = -1
+ - UINT8 parameter max value = 100
+ - UINT8 parameter max value out of bounds = 101
+ - UINT8 parameter in nominal case = 50
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+# Test of type UINT8 - range [0, 100]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/UINT8"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing UINT8 in nominal case = 50
+ ----------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT8 parameter in nominal case = 50
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT8 parameter set to 50
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ log.I("UINT8 parameter in nominal case = 50")
+ value = "50"
+ hex_value = "0x32"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT8') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin(self):
+ """
+ Testing UINT8 minimal value = 0
+ -------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT8 parameter min value = 0
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT8 parameter set to 0
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ log.I("UINT8 parameter min value = 0")
+ value = "0"
+ hex_value = "0x0"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT8') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing UINT8 parameter value out of negative range
+ ---------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT8 to -1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - UINT8 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ log.I("UINT8 parameter min value out of bounds = -1")
+ value = "-1"
+ param_check = commands.getoutput('cat $PFW_RESULT/UINT8')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT8') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
+
+ def test_TypeMax(self):
+ """
+ Testing UINT8 parameter maximum value
+ -------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT8 to 100
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT8 parameter set to 100
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ log.I("UINT8 parameter max value = 100")
+ value = "100"
+ hex_value = "0x64"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT8') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing UINT8 parameter value out of positive range
+ ---------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT8 to 101
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - UINT8 parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ log.I("UINT8 parameter max value out of bounds = 101")
+ value = "101"
+ param_check = commands.getoutput('cat $PFW_RESULT/UINT8')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT8') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/Types/tUINT8_ARRAY.py b/test/functional-tests/PfwTestCase/Types/tUINT8_ARRAY.py
new file mode 100644
index 0000000..89be43c
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tUINT8_ARRAY.py
@@ -0,0 +1,376 @@
+#!/usr/bin/python2
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Array parameter type testcases : UINT8 Array
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ UINT8 Array = 8bits unsigned int array :
+ - Array size : 5
+ - values range : [0, 15]
+
+Test cases :
+------------
+ - Testing nominal case
+ - Testing minimum
+ - Testing minimum overflow
+ - Testing maximum
+ - Testing maximum overflow
+ - Testing array index out of bounds
+ - Testing value format error
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+from ctypes import c_uint16
+
+
+class TestCases(PfwTestCase):
+
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/UINT8_ARRAY"
+ self.param_short_name = "$PFW_RESULT/UINT8_ARRAY"
+ print '\r'
+ self.pfw.sendCmd("setTuningMode", "on")
+ print '\r'
+ self.array_size = 5
+ self.array_min = 0
+ self.array_max = 15
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing UINT8_ARRAY Nominal Case
+ --------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set every UINT8_ARRAY elements to autorized values
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT8_ARRAY array elements correctly recorded
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+
+ for index in range (self.array_size):
+ indexed_array_value = index + self.array_min
+ if indexed_array_value>self.array_max:
+ indexed_array_value=self.array_max
+ hex_indexed_array_value = hex(c_uint16(indexed_array_value).value)
+ #Check parameter value setting
+ indexed_array_value_path = "".join([self.param_name, "/", str(index)])
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.F("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", str(indexed_array_value_path), "")
+ assert err == None, log.E("when setting parameter %s[%s] : %s"
+ % (self.param_name, str(index), err))
+ assert out == str(indexed_array_value), log.F("BLACKBOARD : Incorrect value for %s[%s], expected: %s, found: %s"
+ % (self.param_name, str(index), str(indexed_array_value), out))
+ #Check parameter value on filesystem
+ files_system_check = "awk -v ligne="+str(index)+" 'NR == ligne+1 { print $0}' "+self.param_short_name
+ indexed_files_system_array_value = commands.getoutput(files_system_check)
+ assert indexed_files_system_array_value == hex_indexed_array_value, log.F("FILESSYSTEM : %s[%s] update error"
+ % (self.param_name, str(index)))
+
+ def test_Min_Value(self):
+ """
+ Testing UINT8_ARRAY minimum value
+ ---------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set every UINT8_ARRAY elements to minimum values : 0
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT8_ARRAY array elements correctly recorded
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Min_Value.__doc__)
+ index = 0
+ indexed_array_value = self.array_min
+ indexed_array_value_path = "".join([self.param_name, "/", str(index)])
+ hex_indexed_array_value = hex(c_uint16(indexed_array_value).value)
+ #Check parameter value setting
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", str(indexed_array_value_path), "")
+ assert err == None, log.E("when setting parameter %s[%s] : %s"
+ % (self.param_name, str(index), err))
+ assert out == str(indexed_array_value), log.F("BLACKBOARD : Incorrect value for %s[%s], expected: %s, found: %s"
+ % (self.param_name, str(index), str(indexed_array_value), out))
+ #Check parameter value on filesystem
+ files_system_check = "awk -v ligne="+str(index)+" 'NR == ligne+1 { print $0}' "+self.param_short_name
+ indexed_files_system_array_value = commands.getoutput(files_system_check)
+ assert indexed_files_system_array_value == hex_indexed_array_value, log.F("FILESSYSTEM : %s[%s] update error"
+ % (self.param_name, str(index)))
+
+ def test_Min_Value_Overflow(self):
+ """
+ Testing UINT8_ARRAY parameter values out of negative range
+ ----------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set every UINT8_ARRAY elements to -1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT8_ARRAY array elements not recorded
+ - Error correctly detected
+ """
+ log.D(self.test_Min_Value_Overflow.__doc__)
+ index = 0
+ indexed_array_value = self.array_min
+ indexed_array_value_path = "".join([self.param_name, "/", str(index)])
+ #Check initial parameter value setting
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.F("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ files_system_check = "awk -v ligne="+str(index)+" 'NR == ligne+1 { print $0}' "+self.param_short_name
+ param_check = commands.getoutput(files_system_check)
+ #Check final parameter value setting
+ indexed_array_value = indexed_array_value - 1
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out != "Done", log.F("Error not detected when setting parameter %s[%s] out of bounds"
+ % (self.param_name, str(index)))
+ #Check parameter value on filesystem
+ indexed_files_system_array_value = commands.getoutput(files_system_check)
+ assert indexed_files_system_array_value == param_check, log.F("FILESSYSTEM : %s[%s] forbiden update"
+ % (self.param_name, str(index)))
+
+ def test_Max_Value(self):
+ """
+ Testing UINT8_ARRAY maximum value
+ ---------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set every UINT8_ARRAY elements to maximum values : 15
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT8_ARRAY array elements correctly recorded
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Max_Value.__doc__)
+ index = 0
+ indexed_array_value = self.array_max
+ indexed_array_value_path = "".join([self.param_name, "/", str(index)])
+ hex_indexed_array_value = hex(c_uint16(indexed_array_value).value)
+ #Check parameter value setting
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.F("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", str(indexed_array_value_path), "")
+ assert err == None, log.E("when setting parameter %s[%s] : %s"
+ % (self.param_name, str(index), err))
+ assert out == str(indexed_array_value), log.F("BLACKBOARD : Incorrect value for %s[%s], expected: %s, found: %s"
+ % (self.param_name, str(index), str(indexed_array_value), out))
+ #Check parameter value on filesystem
+ files_system_check = "awk -v ligne="+str(index)+" 'NR == ligne+1 { print $0}' "+self.param_short_name
+ indexed_files_system_array_value = commands.getoutput(files_system_check)
+ assert indexed_files_system_array_value == hex_indexed_array_value, log.F("FILESSYSTEM : %s[%s] update error"
+ % (self.param_name, str(index)))
+
+ def test_Max_Value_Overflow(self):
+ """
+ Testing UINT8_ARRAY parameter values out of positive range
+ ----------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set every UINT8_ARRAY elements to 16
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT8_ARRAY array elements not recorded
+ - Error correctly detected
+ """
+ log.D(self.test_Max_Value_Overflow.__doc__)
+ index = 0
+ indexed_array_value = self.array_max
+ indexed_array_value_path = "".join([self.param_name, "/", str(index)])
+ #Check initial parameter value setting
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.F("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ files_system_check = "awk -v ligne="+str(index)+" 'NR == ligne+1 { print $0}' "+self.param_short_name
+ param_check = commands.getoutput(files_system_check)
+ #Check final parameter value setting
+ indexed_array_value = indexed_array_value + 1
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out != "Done", log.F("Error not detected when setting parameter %s[%s] out of bounds"
+ % (self.param_name, str(index)))
+ #Check parameter value on filesystem
+ indexed_files_system_array_value = commands.getoutput(files_system_check)
+ assert indexed_files_system_array_value == param_check, log.F("FILESSYSTEM : %s[%s] forbiden update"
+ % (self.param_name, str(index)))
+
+ def test_Array_Index_Overflow(self):
+ """
+ Testing Array index out of bounds
+ ---------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Set an out of bounds array indexed element
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT8_ARRAY array elements not recorded
+ - Error correctly detected
+ """
+ log.D(self.test_Array_Index_Overflow.__doc__)
+ index_values = (self.array_size-1, self.array_size+1, -1)
+ for index in index_values:
+ print index
+ indexed_array_value = self.array_max
+ indexed_array_value_path = "".join([self.param_name, "/", str(index)])
+ #Check parameter value setting
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path), str(indexed_array_value))
+ if index in [0, self.array_size-1]:
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.F("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ else:
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out != "Done", log.F("Error not detected when setting array %s index out of bounds"
+ % (self.param_name))
+
+ def test_Value_Format_Error(self):
+ """
+ Testing Array value format error
+ --------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - Trying to write an int16 into an 8 bits array element
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT8_ARRAY array elements not recorded
+ - Error correctly detected
+ """
+ log.D(self.test_Value_Format_Error.__doc__)
+ index = 0
+ var_uint16 = c_uint16(5).value
+ indexed_array_value_1 = 0
+ indexed_array_value_2 = 10
+ indexed_array_value_path_1 = "".join([self.param_name, "/", str(index)])
+ indexed_array_value_path_2 = "".join([self.param_name, "/", str(index+1)])
+ #Check initial parameter value setting
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path_1), str(indexed_array_value_1))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ assert out == "Done", log.F("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), out))
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path_2), str(indexed_array_value_2))
+ assert err == None, log.E("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index+1), err))
+ assert out == "Done", log.F("when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index+1), out))
+ files_system_check_1 = "awk -v ligne="+str(index)+" 'NR == ligne+1 { print $0}' "+self.param_short_name
+ param_check_1 = commands.getoutput(files_system_check_1)
+ files_system_check_2 = "awk -v ligne="+str(index+1)+" 'NR == ligne+1 { print $0}' "+self.param_short_name
+ param_check_2 = commands.getoutput(files_system_check_2)
+ #Check final parameter value setting (!= or == ?)
+ out, err = self.pfw.sendCmd("setParameter", str(indexed_array_value_path_1), str(var_uint16))
+ assert err == None, log.E("Error when setting parameter %s[%s]: %s"
+ % (self.param_name, str(index), err))
+ ### TBC : check expected result ###
+ assert out == "Done", log.F("Error not detected when setting parameter %s[%s] out of bounds"
+ % (self.param_name, str(index)))
+ #Check parameter value on filesystem
+ indexed_files_system_array_value_2 = commands.getoutput(files_system_check_2)
+ assert indexed_files_system_array_value_2 == param_check_2, log.F("FILESSYSTEM : %s[%s] forbiden update"
+ % (self.param_name, str(index)))
diff --git a/test/functional-tests/PfwTestCase/Types/tUINT8_Max.py b/test/functional-tests/PfwTestCase/Types/tUINT8_Max.py
new file mode 100644
index 0000000..4e40867
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/Types/tUINT8_Max.py
@@ -0,0 +1,248 @@
+#!/usr/bin/python2
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Integer parameter type testcases - UINT8_Max
+
+List of tested functions :
+--------------------------
+ - [setParameter] function
+ - [getParameter] function
+
+Initial Settings :
+------------------
+ UINT8_Max :
+ - unsigned
+ - size = 8
+ - range : [0, 255]
+
+Test cases :
+------------
+ - UINT8_Max parameter min value = 0
+ - UINT8_Max parameter min value out of bounds = -1
+ - UINT8_Max parameter max value = 255
+ - UINT8_Max parameter max value out of bounds = 256
+ - UINT8_Max parameter in nominal case = 50
+"""
+import commands
+from Util.PfwUnitTestLib import PfwTestCase
+from Util import ACTLogging
+log=ACTLogging.Logger()
+
+
+# Test of type UINT8_Max - range [0, 255]
+class TestCases(PfwTestCase):
+ def setUp(self):
+ self.param_name = "/Test/Test/TEST_DIR/UINT8_Max"
+ self.pfw.sendCmd("setTuningMode", "on")
+
+ def tearDown(self):
+ self.pfw.sendCmd("setTuningMode", "off")
+
+ def test_Nominal_Case(self):
+ """
+ Testing UINT8_Max in nominal case = 50
+ --------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT8_Max parameter in nominal case = 50
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT8_Max parameter set to 50
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_Nominal_Case.__doc__)
+ log.I("UINT8_Max parameter in nominal case = 50")
+ value = "50"
+ hex_value = "0x32"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT8_Max') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin(self):
+ """
+ Testing UINT8_Max minimal value = 0
+ -----------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT8_Max parameter min value = 0
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT8_Max parameter set to 0
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin.__doc__)
+ log.I("UINT8_Max parameter min value = 0")
+ value = "0"
+ hex_value = "0x0"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT8_Max') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMin_Overflow(self):
+ """
+ Testing UINT8_Max parameter value out of negative range
+ -------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT8_Max to -1
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - UINT8_Max parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMin_Overflow.__doc__)
+ log.I("UINT8_Max parameter min value out of bounds = -1")
+ value = "-1"
+ param_check = commands.getoutput('cat $PFW_RESULT/UINT8_Max')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT8_Max') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
+
+ def test_TypeMax(self):
+ """
+ Testing UINT8_Max parameter maximum value
+ -----------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT8_Max to 255
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - UINT8_Max parameter set to 255
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax.__doc__)
+ log.I("UINT8_Max parameter max value = 255")
+ value = "255"
+ hex_value = "0xff"
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == "Done", log.F("when setting parameter %s : %s"
+ % (self.param_name, out))
+ #Check parameter value on blackboard
+ out, err = self.pfw.sendCmd("getParameter", self.param_name, "")
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out == value, log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s"
+ % (self.param_name, value, out))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT8_Max') == hex_value, log.F("FILESYSTEM : parameter update error")
+ log.I("test OK")
+
+ def test_TypeMax_Overflow(self):
+ """
+ Testing UINT8_Max parameter value out of positive range
+ -------------------------------------------------------
+ Test case description :
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ - set UINT8_Max to 256
+ Tested commands :
+ ~~~~~~~~~~~~~~~~~
+ - [setParameter] function
+ Used commands :
+ ~~~~~~~~~~~~~~~
+ - [getParameter] function
+ Expected result :
+ ~~~~~~~~~~~~~~~~~
+ - error detected
+ - UINT8_Max parameter not updated
+ - Blackboard and filesystem values checked
+ """
+ log.D(self.test_TypeMax_Overflow.__doc__)
+ log.I("UINT8_Max parameter max value out of bounds = 256")
+ value = "256"
+ param_check = commands.getoutput('cat $PFW_RESULT/UINT8_Max')
+ #Set parameter value
+ out, err = self.pfw.sendCmd("setParameter", self.param_name, value)
+ assert err == None, log.E("when setting parameter %s : %s"
+ % (self.param_name, err))
+ assert out != "Done", log.F("PFW : Error not detected when setting parameter %s out of bounds"
+ % (self.param_name))
+ #Check parameter value on filesystem
+ assert commands.getoutput('cat $PFW_RESULT/UINT8_Max') == param_check, log.F("FILESYSTEM : Forbiden parameter change")
+ log.I("test OK")
diff --git a/test/functional-tests/PfwTestCase/__init__.py b/test/functional-tests/PfwTestCase/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/functional-tests/PfwTestCase/__init__.py
diff --git a/test/functional-tests/README.md b/test/functional-tests/README.md
new file mode 100644
index 0000000..43f5c59
--- /dev/null
+++ b/test/functional-tests/README.md
@@ -0,0 +1,22 @@
+#Functional test
+
+#What ?
+Create a test suite for all tests about SET/GET commands.
+Types,functions and Domains are tested.
+
+#How ?
+We set environment variables in the cmake.
+All temporary file are stored in the build directory.
+XML files depends on cmake variables so they are configured at build time and stored in {build_dir}/tmp.
+
+We launch the functional tests with ACTCampaignEngine.py. This script launch every test present in the PfwTestCase directory. Note that functional tests cannot be launched using directly the script.
+We finalize the environment setting in this script. isAlive and needResync are needed by the subsystem.
+To avoid dependancies between to consecutive test, we remove all the temporary files except XML files at the end of the tests.
+
+#Practical
+By default, the BUILD_TESTING flag is set to true.
+Once the makefile is created, we can launch the test by running :
+
+ 'make && make test'
+
+Note that you can also use 'ctest -V' if you want to have the logs details.
diff --git a/test/functional-tests/Util/ACTLogging.py b/test/functional-tests/Util/ACTLogging.py
new file mode 100644
index 0000000..fdc71ef
--- /dev/null
+++ b/test/functional-tests/Util/ACTLogging.py
@@ -0,0 +1,48 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+class Logger(object) :
+ def E(self, string):
+ print "\nERROR: %s\n" % (string)
+ return "ERROR: %s" % (string)
+
+ def F(self, string):
+ print "\nFAIL : %s\n" % (string)
+ return "FAIL : %s" % (string)
+
+ def I(self, string):
+ print "INFO : %s" % (string)
+ return "INFO : %s" % (string)
+
+ def D(self, string):
+ print "\n======================================================================"
+ print "%s" %(string)
+ print "======================================================================"
+ return string
diff --git a/test/functional-tests/Util/PfwUnitTestLib.py b/test/functional-tests/Util/PfwUnitTestLib.py
new file mode 100644
index 0000000..d9c2f8c
--- /dev/null
+++ b/test/functional-tests/Util/PfwUnitTestLib.py
@@ -0,0 +1,110 @@
+# -*-coding:utf-8 -*
+
+# Copyright (c) 2011-2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import subprocess
+import unittest
+import time
+
+class RemoteCli(object):
+ def sendCmd(self, cmd, *args):
+ shell_cmd = " ".join([self.platform_command, cmd])
+ if args is not None:
+ shell_cmd += " " + " ".join(args)
+ print "CMD :",
+ print "[" + shell_cmd + "]"
+ try:
+ p = subprocess.Popen(shell_cmd, shell=True, stdout=subprocess.PIPE)
+ except Exception as (errno, strerror):
+ return None, strerror
+ out, err = p.communicate()
+ if out is not None:
+ out = out.strip()
+ return out, err
+
+class Pfw(RemoteCli):
+ def __init__(self):
+ self.platform_command = "remote-process localhost 5000 "
+
+class Hal(RemoteCli):
+ def __init__(self):
+ self.platform_command = "remote-process localhost 5001 "
+
+ # Starts the HAL exe
+ def startHal(self):
+ cmd= "test-platform $PFW_TEST_CONFIGURATION"
+ subprocess.Popen(cmd, shell=True)
+ pass
+
+ # Send command "stop" to the HAL
+ def stopHal(self):
+ subprocess.call("remote-process localhost 5001 exit", shell=True)
+
+ def createInclusiveCriterion(self, name, nb):
+ self.sendCmd("createInclusiveSelectionCriterion", name, nb)
+
+ def createExclusiveCriterion(self, name, nb):
+ self.sendCmd("createExclusiveSelectionCriterion", name, nb)
+
+ # Starts the Pfw
+ def start(self):
+ self.sendCmd("start")
+
+# A PfwTestCase gather tests performed on one instance of the PFW.
+class PfwTestCase(unittest.TestCase):
+
+ hal = Hal()
+
+ def __init__(self, argv):
+ super(PfwTestCase, self).__init__(argv)
+ self.pfw = Pfw()
+
+ @classmethod
+ def setUpClass(cls):
+ cls.startHal()
+
+ @classmethod
+ def tearDownClass(cls):
+ cls.stopHal()
+
+ @classmethod
+ def startHal(cls):
+ # set up the Hal & pfw
+ cls.hal.startHal()
+ time.sleep(0.1)
+ # create criterions
+ cls.hal.createInclusiveCriterion("Crit_0", "2")
+ cls.hal.createExclusiveCriterion("Crit_1", "2")
+ # start the Pfw
+ cls.hal.start()
+
+ @classmethod
+ def stopHal(cls):
+ cls.hal.stopHal()
+ time.sleep(0.1)
diff --git a/test/functional-tests/Util/__init__.py b/test/functional-tests/Util/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/functional-tests/Util/__init__.py
diff --git a/test/functional-tests/xml/TestConfigurableDomains.xml b/test/functional-tests/xml/TestConfigurableDomains.xml
new file mode 100644
index 0000000..fdc77e1
--- /dev/null
+++ b/test/functional-tests/xml/TestConfigurableDomains.xml
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ConfigurableDomains xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="/home/lab/ICS/hardware/intel/PRIVATE/parameter-framework/test/configuration/Schemas/ConfigurableDomains.xsd" SystemClassName="Test">
+ <ConfigurableDomain Name="Domain_0">
+ <Configurations>
+ <Configuration Name="Conf_0">
+ <CompoundRule Type="All">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x1"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="Is" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ <Configuration Name="Conf_1">
+ <CompoundRule Type="Any">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x2"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="IsNot" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ </Configurations>
+
+ <ConfigurableElements>
+ <ConfigurableElement Path="/Test/Test/TEST_DIR" />
+ <ConfigurableElement Path="/Test/Test/TEST_TYPES" />
+ </ConfigurableElements>
+
+ <Settings>
+ <Configuration Name="Conf_0">
+ <ConfigurableElement Path="/Test/Test/TEST_DIR">
+ <Component Name="TEST_DIR">
+ <!-- Tested Booleans -->
+ <BooleanParameter Name="BOOL">0</BooleanParameter>
+ <!-- Tested FixedPoints -->
+ <FixedPointParameter Name="FP8_Q0.7">0</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q7.0">0</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q3.4">0</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q0.15">0</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q15.0">0</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q7.8">0</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q0.31">0</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q31.0">0</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q15.16">0</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q8.20">0</FixedPointParameter>
+ <!-- Tested Integers -->
+ <IntegerParameter Name="UINT32">0</IntegerParameter>
+ <IntegerParameter Name="INT32">0</IntegerParameter>
+ <IntegerParameter Name="UINT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT16">0</IntegerParameter>
+ <IntegerParameter Name="INT16">0</IntegerParameter>
+ <IntegerParameter Name="UINT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT8">0</IntegerParameter>
+ <IntegerParameter Name="INT8">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT8_Max">0</IntegerParameter>
+ <!-- Tested Arrays -->
+ <IntegerParameter Name="UINT32_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="INT16_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max_ARRAY">0</IntegerParameter>
+ <!-- Tested String-->
+ <StringParameter Name="STR_CHAR128">string_Conf_0</StringParameter>
+ </Component>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Test/Test/TEST_TYPES">
+ <Component Name="TEST_TYPES">
+ <EnumParameter Name="ENUM">ENUM_NOMINAL</EnumParameter>
+ <BitParameterBlock Name="BLOCK_8BIT">
+ <BitParameter Name="BIT_0_3">0</BitParameter>
+ <BitParameter Name="BIT_3_1">0</BitParameter>
+ <BitParameter Name="BIT_4_1">0</BitParameter>
+ <BitParameter Name="BIT_6_2">0</BitParameter>
+ <BitParameter Name="BIT_7_1">0</BitParameter>
+ </BitParameterBlock>
+ <ParameterBlock Name="BLOCK_PARAMETER">
+ <IntegerParameter Name="UINT8">0</IntegerParameter>
+ <IntegerParameter Name="UINT16">0</IntegerParameter>
+ <IntegerParameter Name="UINT32">0</IntegerParameter>
+ </ParameterBlock>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ <Configuration Name="Conf_1">
+ <ConfigurableElement Path="/Test/Test/TEST_DIR">
+ <Component Name="TEST_DIR">
+ <!-- Tested Booleans -->
+ <BooleanParameter Name="BOOL">1</BooleanParameter>
+ <!-- Tested FixedPoints -->
+ <FixedPointParameter Name="FP8_Q0.7">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q7.0">1</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q3.4">1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q0.15">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q15.0">1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q7.8">1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q0.31">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q31.0">1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q15.16">1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q8.20">1</FixedPointParameter>
+ <!-- Tested Integers -->
+ <IntegerParameter Name="UINT32">1</IntegerParameter>
+ <IntegerParameter Name="INT32">1</IntegerParameter>
+ <IntegerParameter Name="UINT32_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT32_Max">1</IntegerParameter>
+ <IntegerParameter Name="UINT16">1</IntegerParameter>
+ <IntegerParameter Name="INT16">1</IntegerParameter>
+ <IntegerParameter Name="UINT16_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT16_Max">1</IntegerParameter>
+ <IntegerParameter Name="UINT8">1</IntegerParameter>
+ <IntegerParameter Name="INT8">1</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT8_Max">1</IntegerParameter>
+ <!-- Tested Arrays -->
+ <IntegerParameter Name="UINT32_ARRAY">1</IntegerParameter>
+ <IntegerParameter Name="INT16_ARRAY">1</IntegerParameter>
+ <IntegerParameter Name="UINT8_ARRAY">1</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max_ARRAY">1</IntegerParameter>
+ <!-- Tested String-->
+ <StringParameter Name="STR_CHAR128">string_Conf_1</StringParameter>
+ </Component>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Test/Test/TEST_TYPES">
+ <Component Name="TEST_TYPES">
+ <!--Tested Enum-->
+ <EnumParameter Name="ENUM">ENUM_MIN</EnumParameter>
+ <!--Tested Bit parameter block-->
+ <BitParameterBlock Name="BLOCK_8BIT">
+ <BitParameter Name="BIT_0_3">0</BitParameter>
+ <BitParameter Name="BIT_3_1">0</BitParameter>
+ <BitParameter Name="BIT_4_1">0</BitParameter>
+ <BitParameter Name="BIT_6_2">0</BitParameter>
+ <BitParameter Name="BIT_7_1">0</BitParameter>
+ </BitParameterBlock>
+ <ParameterBlock Name="BLOCK_PARAMETER">
+ <IntegerParameter Name="UINT8">0</IntegerParameter>
+ <IntegerParameter Name="UINT16">0</IntegerParameter>
+ <IntegerParameter Name="UINT32">0</IntegerParameter>
+ </ParameterBlock>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ </Settings>
+ </ConfigurableDomain>
+</ConfigurableDomains>
diff --git a/test/functional-tests/xml/XML_Test/Reference_Compliant.xml b/test/functional-tests/xml/XML_Test/Reference_Compliant.xml
new file mode 100644
index 0000000..48b1720
--- /dev/null
+++ b/test/functional-tests/xml/XML_Test/Reference_Compliant.xml
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ConfigurableDomains xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="/home/lab/ICS/hardware/intel/PRIVATE/parameter-framework/test/configuration/Schemas/ConfigurableDomains.xsd" SystemClassName="Test">
+ <ConfigurableDomain Name="Domain_1">
+ <Configurations>
+ <Configuration Name="Conf_1_0">
+ <CompoundRule Type="All">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x1"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="Is" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ <Configuration Name="Conf_1_1">
+ <CompoundRule Type="Any">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x2"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="IsNot" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ </Configurations>
+ <ConfigurableElements>
+ <ConfigurableElement Path="/Test/Test/TEST_DIR" />
+ </ConfigurableElements>
+ <Settings>
+ <Configuration Name="Conf_1_1">
+ <ConfigurableElement Path="/Test/Test/TEST_DIR">
+ <Component Name="TEST_DIR">
+ <!-- Tested Booleans -->
+ <BooleanParameter Name="BOOL">0</BooleanParameter>
+ <!-- Tested FixedPoints -->
+ <FixedPointParameter Name="FP8_Q0.7">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q7.0">2</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q3.4">2.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q0.15">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q15.0">2</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q7.8">2</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q0.31">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q31.0">2</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q15.16">2.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q8.20">2.1</FixedPointParameter>
+ <!-- Tested Integers -->
+ <IntegerParameter Name="UINT32">0</IntegerParameter>
+ <IntegerParameter Name="INT32">0</IntegerParameter>
+ <IntegerParameter Name="UINT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT16">0</IntegerParameter>
+ <IntegerParameter Name="INT16">0</IntegerParameter>
+ <IntegerParameter Name="UINT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT8">0</IntegerParameter>
+ <IntegerParameter Name="INT8">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT8_Max">0</IntegerParameter>
+ <!-- Tested Arrays -->
+ <IntegerParameter Name="UINT32_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="INT16_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max_ARRAY">0</IntegerParameter>
+ <!-- Tested String-->
+ <StringParameter Name="STR_CHAR128">string_Conf_1_1</StringParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ <Configuration Name="Conf_1_0">
+ <ConfigurableElement Path="/Test/Test/TEST_DIR">
+ <Component Name="TEST_DIR">
+ <!-- Tested Booleans -->
+ <BooleanParameter Name="BOOL">1</BooleanParameter>
+ <!-- Tested FixedPoints -->
+ <FixedPointParameter Name="FP8_Q0.7">0.2</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q7.0">1</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q3.4">1.2</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q0.15">0.2</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q15.0">1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q7.8">1.2</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q0.31">0.2</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q31.0">1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q15.16">1.2</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q8.20">1.2</FixedPointParameter>
+ <!-- Tested Integers -->
+ <IntegerParameter Name="UINT32">1</IntegerParameter>
+ <IntegerParameter Name="INT32">-1</IntegerParameter>
+ <IntegerParameter Name="UINT32_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT32_Max">-1</IntegerParameter>
+ <IntegerParameter Name="UINT16">1</IntegerParameter>
+ <IntegerParameter Name="INT16">-1</IntegerParameter>
+ <IntegerParameter Name="UINT16_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT16_Max">-1</IntegerParameter>
+ <IntegerParameter Name="UINT8">1</IntegerParameter>
+ <IntegerParameter Name="INT8">-1</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT8_Max">-1</IntegerParameter>
+ <!-- Tested Arrays -->
+ <IntegerParameter Name="UINT32_ARRAY">1</IntegerParameter>
+ <IntegerParameter Name="INT16_ARRAY">-1</IntegerParameter>
+ <IntegerParameter Name="UINT8_ARRAY">1</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max_ARRAY">1</IntegerParameter>
+ <!-- Tested String-->
+ <StringParameter Name="STR_CHAR128">string_Conf_1_0</StringParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ </Settings>
+ </ConfigurableDomain>
+
+ <ConfigurableDomain Name="Domain_2">
+ <Configurations>
+ <Configuration Name="Conf_2_0">
+ <CompoundRule Type="All">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x1"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="Is" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ <Configuration Name="Conf_2_1">
+ <CompoundRule Type="Any">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x2"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="IsNot" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ </Configurations>
+ <ConfigurableElements>
+ <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_0" />
+ </ConfigurableElements>
+ <Settings>
+ <Configuration Name="Conf_2_1">
+ <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_0">
+ <Component Name="TEST_DOMAIN_0">
+ <IntegerParameter Name="Param_00">4</IntegerParameter>
+ <IntegerParameter Name="Param_01">4</IntegerParameter>
+ <IntegerParameter Name="Param_02">4</IntegerParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ <Configuration Name="Conf_2_0">
+ <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_0">
+ <Component Name="TEST_DOMAIN_0">
+ <IntegerParameter Name="Param_00">5</IntegerParameter>
+ <IntegerParameter Name="Param_01">5</IntegerParameter>
+ <IntegerParameter Name="Param_02">5</IntegerParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ </Settings>
+ </ConfigurableDomain>
+
+ <ConfigurableDomain Name="Domain_3">
+ <Configurations>
+ <Configuration Name="Conf_3_0">
+ <CompoundRule Type="All">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x1"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="Is" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ <Configuration Name="Conf_3_1">
+ <CompoundRule Type="Any">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x2"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="IsNot" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ </Configurations>
+ <ConfigurableElements>
+ <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_1" />
+ </ConfigurableElements>
+ <Settings>
+ <Configuration Name="Conf_3_1">
+ <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_1">
+ <Component Name="TEST_DOMAIN_1">
+ <IntegerParameter Name="Param_10">4</IntegerParameter>
+ <IntegerParameter Name="Param_11">4</IntegerParameter>
+ <IntegerParameter Name="Param_12">4</IntegerParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ <Configuration Name="Conf_3_0">
+ <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_1">
+ <Component Name="TEST_DOMAIN_1">
+ <IntegerParameter Name="Param_10">5</IntegerParameter>
+ <IntegerParameter Name="Param_11">5</IntegerParameter>
+ <IntegerParameter Name="Param_12">5</IntegerParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ </Settings>
+ </ConfigurableDomain>
+</ConfigurableDomains>
diff --git a/test/functional-tests/xml/XML_Test/Reference_Criteria.xml b/test/functional-tests/xml/XML_Test/Reference_Criteria.xml
new file mode 100644
index 0000000..76664e2
--- /dev/null
+++ b/test/functional-tests/xml/XML_Test/Reference_Criteria.xml
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ConfigurableDomains xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Schemas/ConfigurableDomains.xsd" SystemClassName="Test">
+ <ConfigurableDomain Name="Domain_1">
+ <Configurations>
+ <Configuration Name="Conf_1_0">
+ <CompoundRule Type="All">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x1"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="Is" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ <Configuration Name="Conf_1_1">
+ <CompoundRule Type="Any">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Excludes" Value="State_0x1"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="IsNot" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ </Configurations>
+ <ConfigurableElements>
+ <ConfigurableElement Path="/Test/Test/TEST_DIR" />
+ </ConfigurableElements>
+ <Settings>
+ <Configuration Name="Conf_1_1">
+ <ConfigurableElement Path="/Test/Test/TEST_DIR">
+ <Component Name="TEST_DIR">
+ <!-- Tested Booleans -->
+ <BooleanParameter Name="BOOL">0</BooleanParameter>
+ <!-- Tested FixedPoints -->
+ <FixedPointParameter Name="FP8_Q0.7">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q7.0">1</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q3.4">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q0.15">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q15.0">1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q7.8">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q0.31">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q31.0">1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q15.16">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q8.20">0.1</FixedPointParameter>
+ <!-- Tested Integers -->
+ <IntegerParameter Name="UINT32">0</IntegerParameter>
+ <IntegerParameter Name="INT32">0</IntegerParameter>
+ <IntegerParameter Name="UINT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT16">0</IntegerParameter>
+ <IntegerParameter Name="INT16">0</IntegerParameter>
+ <IntegerParameter Name="UINT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT8">0</IntegerParameter>
+ <IntegerParameter Name="INT8">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT8_Max">0</IntegerParameter>
+ <!-- Tested Arrays -->
+ <IntegerParameter Name="UINT32_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="INT16_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max_ARRAY">0</IntegerParameter>
+ <!-- Tested String-->
+ <StringParameter Name="STR_CHAR128">string_Conf_1_1</StringParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ <Configuration Name="Conf_1_0">
+ <ConfigurableElement Path="/Test/Test/TEST_DIR">
+ <Component Name="TEST_DIR">
+ <!-- Tested Booleans -->
+ <BooleanParameter Name="BOOL">1</BooleanParameter>
+ <!-- Tested FixedPoints -->
+ <FixedPointParameter Name="FP8_Q0.7">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q7.0">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q3.4">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q0.15">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q15.0">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q7.8">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q0.31">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q31.0">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q15.16">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q8.20">0.9</FixedPointParameter>
+ <!-- Tested Integers -->
+ <IntegerParameter Name="UINT32">1</IntegerParameter>
+ <IntegerParameter Name="INT32">-1</IntegerParameter>
+ <IntegerParameter Name="UINT32_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT32_Max">-1</IntegerParameter>
+ <IntegerParameter Name="UINT16">1</IntegerParameter>
+ <IntegerParameter Name="INT16">-1</IntegerParameter>
+ <IntegerParameter Name="UINT16_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT16_Max">-1</IntegerParameter>
+ <IntegerParameter Name="UINT8">1</IntegerParameter>
+ <IntegerParameter Name="INT8">-1</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT8_Max">-1</IntegerParameter>
+ <!-- Tested Arrays -->
+ <IntegerParameter Name="UINT32_ARRAY">1</IntegerParameter>
+ <IntegerParameter Name="INT16_ARRAY">-1</IntegerParameter>
+ <IntegerParameter Name="UINT8_ARRAY">1</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max_ARRAY">1</IntegerParameter>
+ <!-- Tested String-->
+ <StringParameter Name="STR_CHAR128">string_Conf_1_0</StringParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ </Settings>
+ </ConfigurableDomain>
+
+ <ConfigurableDomain Name="Domain_2">
+ <Configurations>
+ <Configuration Name="Conf_2_0">
+ <CompoundRule Type="All">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x1"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="IsNot" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ <Configuration Name="Conf_2_1">
+ <CompoundRule Type="All">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x2"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="Is" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ </Configurations>
+ <ConfigurableElements>
+ <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_0" />
+ </ConfigurableElements>
+ <Settings>
+ <Configuration Name="Conf_2_1">
+ <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_0">
+ <Component Name="TEST_DOMAIN_0">
+ <IntegerParameter Name="Param_00">4</IntegerParameter>
+ <IntegerParameter Name="Param_01">4</IntegerParameter>
+ <IntegerParameter Name="Param_02">4</IntegerParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ <Configuration Name="Conf_2_0">
+ <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_0">
+ <Component Name="TEST_DOMAIN_0">
+ <IntegerParameter Name="Param_00">5</IntegerParameter>
+ <IntegerParameter Name="Param_01">5</IntegerParameter>
+ <IntegerParameter Name="Param_02">5</IntegerParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ </Settings>
+ </ConfigurableDomain>
+
+ <ConfigurableDomain Name="Domain_3">
+ <Configurations>
+ <Configuration Name="Conf_3_0">
+ <CompoundRule Type="Any">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x1"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="Is" Value="State_0"/>
+ </CompoundRule>
+ </Configuration>
+ <Configuration Name="Conf_3_1">
+ <CompoundRule Type="Any">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x2"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="Is" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ </Configurations>
+ <ConfigurableElements>
+ <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_1" />
+ </ConfigurableElements>
+ <Settings>
+ <Configuration Name="Conf_3_1">
+ <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_1">
+ <Component Name="TEST_DOMAIN_1">
+ <IntegerParameter Name="Param_10">4</IntegerParameter>
+ <IntegerParameter Name="Param_11">4</IntegerParameter>
+ <IntegerParameter Name="Param_12">4</IntegerParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ <Configuration Name="Conf_3_0">
+ <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_1">
+ <Component Name="TEST_DOMAIN_1">
+ <IntegerParameter Name="Param_10">5</IntegerParameter>
+ <IntegerParameter Name="Param_11">5</IntegerParameter>
+ <IntegerParameter Name="Param_12">5</IntegerParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ </Settings>
+ </ConfigurableDomain>
+</ConfigurableDomains>
diff --git a/test/functional-tests/xml/XML_Test/Reference_Split_Domain.xml b/test/functional-tests/xml/XML_Test/Reference_Split_Domain.xml
new file mode 100644
index 0000000..7f7edbc
--- /dev/null
+++ b/test/functional-tests/xml/XML_Test/Reference_Split_Domain.xml
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--DOMAIN 1 DEFINITION-->
+<ConfigurableDomains xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Schemas/ConfigurableDomains.xsd" SystemClassName="Test">
+ <ConfigurableDomain Name="Domain_1">
+ <Configurations>
+ <Configuration Name="Conf_1_0">
+ <CompoundRule Type="All">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x1"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="Is" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ <Configuration Name="Conf_1_1">
+ <CompoundRule Type="Any">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Excludes" Value="State_0x1"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="IsNot" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ </Configurations>
+ <ConfigurableElements>
+ <ConfigurableElement Path="/Test/Test/TEST_MAIN" />
+ <!--ConfigurableElement Path="/Test/Test/TEST_MAIN/TEST_DIR_0" />
+ <ConfigurableElement Path="/Test/Test/TEST_MAIN/TEST_DIR_1" />
+ <ConfigurableElement Path="/Test/Test/TEST_MAIN/TEST_DIR_2" /-->
+ </ConfigurableElements>
+ <Settings>
+ <Configuration Name="Conf_1_1">
+ <ConfigurableElement Path="/Test/Test/TEST_MAIN">
+ <Component Name="TEST_MAIN">
+ <Component Name="TEST_DIR_0">
+ <!-- Tested Booleans -->
+ <BooleanParameter Name="BOOL">0</BooleanParameter>
+ <!-- Tested FixedPoints -->
+ <FixedPointParameter Name="FP8_Q0.7">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q7.0">2</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q3.4">2.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q0.15">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q15.0">2</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q7.8">2</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q0.31">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q31.0">2</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q15.16">2.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q8.20">2.1</FixedPointParameter>
+ <!-- Tested Integers -->
+ <IntegerParameter Name="UINT32">0</IntegerParameter>
+ <IntegerParameter Name="INT32">0</IntegerParameter>
+ <IntegerParameter Name="UINT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT16">0</IntegerParameter>
+ <IntegerParameter Name="INT16">0</IntegerParameter>
+ <IntegerParameter Name="UINT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT8">0</IntegerParameter>
+ <IntegerParameter Name="INT8">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT8_Max">0</IntegerParameter>
+ <!-- Tested Arrays -->
+ <IntegerParameter Name="UINT32_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="INT16_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max_ARRAY">0</IntegerParameter>
+ <!-- Tested String-->
+ <StringParameter Name="STR_CHAR128">string_Conf_1_1</StringParameter>
+ </Component>
+ <Component Name="TEST_DIR_1">
+ <IntegerParameter Name="Param_00">4</IntegerParameter>
+ <IntegerParameter Name="Param_01">4</IntegerParameter>
+ <IntegerParameter Name="Param_02">4</IntegerParameter>
+ </Component>
+ <Component Name="TEST_DIR_2">
+ <IntegerParameter Name="Param_10">4</IntegerParameter>
+ <IntegerParameter Name="Param_11">4</IntegerParameter>
+ <IntegerParameter Name="Param_12">4</IntegerParameter>
+ </Component>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ <Configuration Name="Conf_1_0">
+ <ConfigurableElement Path="/Test/Test/TEST_MAIN">
+ <Component Name="TEST_MAIN">
+ <Component Name="TEST_DIR_0">
+ <!-- Tested Booleans -->
+ <BooleanParameter Name="BOOL">0</BooleanParameter>
+ <!-- Tested FixedPoints -->
+ <FixedPointParameter Name="FP8_Q0.7">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q7.0">2</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q3.4">2.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q0.15">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q15.0">2</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q7.8">2</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q0.31">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q31.0">2</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q15.16">2.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q8.20">2.1</FixedPointParameter>
+ <!-- Tested Integers -->
+ <IntegerParameter Name="UINT32">0</IntegerParameter>
+ <IntegerParameter Name="INT32">0</IntegerParameter>
+ <IntegerParameter Name="UINT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT16">0</IntegerParameter>
+ <IntegerParameter Name="INT16">0</IntegerParameter>
+ <IntegerParameter Name="UINT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT8">0</IntegerParameter>
+ <IntegerParameter Name="INT8">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT8_Max">0</IntegerParameter>
+ <!-- Tested Arrays -->
+ <IntegerParameter Name="UINT32_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="INT16_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max_ARRAY">0</IntegerParameter>
+ <!-- Tested String-->
+ <StringParameter Name="STR_CHAR128">string_Conf_1_1</StringParameter>
+ </Component>
+ <Component Name="TEST_DIR_1">
+ <IntegerParameter Name="Param_00">5</IntegerParameter>
+ <IntegerParameter Name="Param_01">5</IntegerParameter>
+ <IntegerParameter Name="Param_02">5</IntegerParameter>
+ </Component>
+ <Component Name="TEST_DIR_2">
+ <IntegerParameter Name="Param_10">5</IntegerParameter>
+ <IntegerParameter Name="Param_11">5</IntegerParameter>
+ <IntegerParameter Name="Param_12">5</IntegerParameter>
+ </Component>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ </Settings>
+ </ConfigurableDomain>
+<!--DOMAIN 2 DEFINITION-->
+ <ConfigurableDomain Name="Domain_2">
+ <Configurations>
+ <Configuration Name="Conf_2_0">
+ <CompoundRule Type="All">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x1"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="IsNot" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ <Configuration Name="Conf_2_1">
+ <CompoundRule Type="All">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x2"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="Is" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ </Configurations>
+ <ConfigurableElements/>
+ </ConfigurableDomain>
+<!--DOMAIN 3 DEFINITION-->
+ <ConfigurableDomain Name="Domain_3">
+ <Configurations>
+ <Configuration Name="Conf_3_0">
+ <CompoundRule Type="Any">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x1"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="Is" Value="State_0"/>
+ </CompoundRule>
+ </Configuration>
+ <Configuration Name="Conf_3_1">
+ <CompoundRule Type="Any">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x2"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="Is" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ </Configurations>
+ <ConfigurableElements/>
+ </ConfigurableDomain>
+</ConfigurableDomains>
diff --git a/test/functional-tests/xml/XML_Test/Reference_dumpDomains b/test/functional-tests/xml/XML_Test/Reference_dumpDomains
new file mode 100644
index 0000000..9277d20
--- /dev/null
+++ b/test/functional-tests/xml/XML_Test/Reference_dumpDomains
@@ -0,0 +1,12 @@
+- ConfigurableDomains: Test
+ - ConfigurableDomain: Domain_0_1 = {Sequence aware: no, Last applied configuration: <none>}
+ - Configuration: Conf_0_0
+ - ConfigurableDomain: Domain_1_2 = {Sequence aware: no, Last applied configuration: <none>}
+ - Configuration: Conf_1_0
+ - CompoundRule = All
+ - SelectionCriterionRule = Crit_0 Includes State_0x1
+ - SelectionCriterionRule = Crit_1 Is State_1
+ - Configuration: Conf_1_1
+ - CompoundRule = Any
+ - SelectionCriterionRule = Crit_0 Includes State_0x2
+ - SelectionCriterionRule = Crit_1 IsNot State_1
diff --git a/test/functional-tests/xml/XML_Test/Reference_dumpDomains.xml b/test/functional-tests/xml/XML_Test/Reference_dumpDomains.xml
new file mode 100644
index 0000000..844099e
--- /dev/null
+++ b/test/functional-tests/xml/XML_Test/Reference_dumpDomains.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ConfigurableDomains xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="/home/lab/ICS/hardware/intel/PRIVATE/parameter-framework/test/configuration/Schemas/ConfigurableDomains.xsd" SystemClassName="Test">
+
+ <ConfigurableDomain Name="Domain_0_1">
+ <Configurations>
+ <Configuration Name="Conf_0_0"/>
+ </Configurations>
+ <ConfigurableElements>
+ <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_0" />
+ </ConfigurableElements>
+ <Settings>
+ <Configuration Name="Conf_0_0">
+ <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_0">
+ <Component Name="TEST_DOMAIN_0">
+ <IntegerParameter Name="Param_00">0</IntegerParameter>
+ <IntegerParameter Name="Param_01">0</IntegerParameter>
+ <IntegerParameter Name="Param_02">0</IntegerParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ </Settings>
+ </ConfigurableDomain>
+ <ConfigurableDomain Name="Domain_1_2">
+ <Configurations>
+ <Configuration Name="Conf_1_0">
+ <CompoundRule Type="All">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x1"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="Is" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ <Configuration Name="Conf_1_1">
+ <CompoundRule Type="Any">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x2"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="IsNot" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ </Configurations>
+ <ConfigurableElements>
+ <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_1" />
+ </ConfigurableElements>
+ <Settings>
+ <Configuration Name="Conf_1_1">
+ <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_1">
+ <Component Name="TEST_DOMAIN_1">
+ <IntegerParameter Name="Param_10">4</IntegerParameter>
+ <IntegerParameter Name="Param_11">4</IntegerParameter>
+ <IntegerParameter Name="Param_12">4</IntegerParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ <Configuration Name="Conf_1_0">
+ <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_1">
+ <Component Name="TEST_DOMAIN_1">
+ <IntegerParameter Name="Param_10">5</IntegerParameter>
+ <IntegerParameter Name="Param_11">5</IntegerParameter>
+ <IntegerParameter Name="Param_12">5</IntegerParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ </Settings>
+ </ConfigurableDomain>
+</ConfigurableDomains>
diff --git a/test/functional-tests/xml/XML_Test/Uncompliant_OutboundParameter.xml b/test/functional-tests/xml/XML_Test/Uncompliant_OutboundParameter.xml
new file mode 100644
index 0000000..339a75c
--- /dev/null
+++ b/test/functional-tests/xml/XML_Test/Uncompliant_OutboundParameter.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ConfigurableDomains xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Schemas/ConfigurableDomains.xsd" SystemClassName="Test">
+ <ConfigurableDomain Name="Domain_1">
+ <Configurations>
+ <Configuration Name="Conf_1_0">
+ <CompoundRule Type="All">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x1"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="Is" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ <Configuration Name="Conf_1_1">
+ <CompoundRule Type="Any">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x2"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="IsNot" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ </Configurations>
+ <ConfigurableElements>
+ <ConfigurableElement Path="/Test/Test/TEST_DIR" />
+ </ConfigurableElements>
+ <Settings>
+ <Configuration Name="Conf_1_1">
+ <ConfigurableElement Path="/Test/Test/TEST_DIR">
+ <Component Name="TEST_DIR">
+ <!-- Tested Booleans -->
+ <BooleanParameter Name="BOOL">2</BooleanParameter>
+ <!-- Tested FixedPoints -->
+ <FixedPointParameter Name="FP8_Q0.7">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q7.0">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q3.4">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q0.15">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q15.0">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q7.8">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q0.31">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q31.0">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q15.16">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q8.20">0.1</FixedPointParameter>
+ <!-- Tested Integers -->
+ <IntegerParameter Name="UINT32">0</IntegerParameter>
+ <IntegerParameter Name="INT32">0</IntegerParameter>
+ <IntegerParameter Name="UINT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT16">0</IntegerParameter>
+ <IntegerParameter Name="INT16">0</IntegerParameter>
+ <IntegerParameter Name="UINT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT8">0</IntegerParameter>
+ <IntegerParameter Name="INT8">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT8_Max">0</IntegerParameter>
+ <!-- Tested Arrays -->
+ <IntegerParameter Name="UINT32_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="INT16_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max_ARRAY">0</IntegerParameter>
+ <!-- Tested String-->
+ <StringParameter Name="STR_CHAR128">string_Conf_1_1</StringParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ <Configuration Name="Conf_1_0">
+ <ConfigurableElement Path="/Test/Test/TEST_DIR">
+ <Component Name="TEST_DIR">
+ <!-- Tested Booleans -->
+ <BooleanParameter Name="BOOL">1</BooleanParameter>
+ <!-- Tested FixedPoints -->
+ <FixedPointParameter Name="FP8_Q0.7">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q7.0">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q3.4">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q0.15">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q15.0">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q7.8">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q0.31">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q31.0">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q15.16">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q8.20">0.9</FixedPointParameter>
+ <!-- Tested Integers -->
+ <IntegerParameter Name="UINT32">1</IntegerParameter>
+ <IntegerParameter Name="INT32">-1</IntegerParameter>
+ <IntegerParameter Name="UINT32_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT32_Max">-1</IntegerParameter>
+ <IntegerParameter Name="UINT16">1</IntegerParameter>
+ <IntegerParameter Name="INT16">-1</IntegerParameter>
+ <IntegerParameter Name="UINT16_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT16_Max">-1</IntegerParameter>
+ <IntegerParameter Name="UINT8">1</IntegerParameter>
+ <IntegerParameter Name="INT8">-1</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT8_Max">-1</IntegerParameter>
+ <!-- Tested Arrays -->
+ <IntegerParameter Name="UINT32_ARRAY">1</IntegerParameter>
+ <IntegerParameter Name="INT16_ARRAY">-1</IntegerParameter>
+ <IntegerParameter Name="UINT8_ARRAY">1</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max_ARRAY">1</IntegerParameter>
+ <!-- Tested String-->
+ <StringParameter Name="STR_CHAR128">string_Conf_1_0</StringParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ </Settings>
+ </ConfigurableDomain>
+</ConfigurableDomains>
diff --git a/test/functional-tests/xml/XML_Test/Uncompliant_UndeclaredConfigurableElement.xml b/test/functional-tests/xml/XML_Test/Uncompliant_UndeclaredConfigurableElement.xml
new file mode 100644
index 0000000..f8c00be
--- /dev/null
+++ b/test/functional-tests/xml/XML_Test/Uncompliant_UndeclaredConfigurableElement.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ConfigurableDomains xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Schemas/ConfigurableDomains.xsd" SystemClassName="Test">
+ <ConfigurableDomain Name="Domain_1">
+ <Configurations>
+ <Configuration Name="Conf_1_0">
+ <CompoundRule Type="All">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x1"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="Is" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ <Configuration Name="Conf_1_1">
+ <CompoundRule Type="Any">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x2"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="IsNot" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ </Configurations>
+ <ConfigurableElements>
+ <ConfigurableElement Path="/Test/Test/ERROR" />
+ </ConfigurableElements>
+ <Settings>
+ <Configuration Name="Conf_1_1">
+ <ConfigurableElement Path="/Test/Test/ERROR">
+ <Component Name="TEST_DIR">
+ <!-- Tested Booleans -->
+ <BooleanParameter Name="BOOL">0</BooleanParameter>
+ <!-- Tested FixedPoints -->
+ <FixedPointParameter Name="FP8_Q0.7">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q7.0">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q3.4">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q0.15">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q15.0">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q7.8">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q0.31">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q31.0">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q15.16">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q8.20">0.1</FixedPointParameter>
+ <!-- Tested Integers -->
+ <IntegerParameter Name="UINT32">0</IntegerParameter>
+ <IntegerParameter Name="INT32">0</IntegerParameter>
+ <IntegerParameter Name="UINT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT16">0</IntegerParameter>
+ <IntegerParameter Name="INT16">0</IntegerParameter>
+ <IntegerParameter Name="UINT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT8">0</IntegerParameter>
+ <IntegerParameter Name="INT8">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT8_Max">0</IntegerParameter>
+ <!-- Tested Arrays -->
+ <IntegerParameter Name="UINT32_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="INT16_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max_ARRAY">0</IntegerParameter>
+ <!-- Tested String-->
+ <StringParameter Name="STR_CHAR128">string_Conf_1_1</StringParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ <Configuration Name="Conf_1_0">
+ <ConfigurableElement Path="/Test/Test/TEST_DIR">
+ <Component Name="TEST_DIR">
+ <!-- Tested Booleans -->
+ <BooleanParameter Name="BOOL">1</BooleanParameter>
+ <!-- Tested FixedPoints -->
+ <FixedPointParameter Name="FP8_Q0.7">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q7.0">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q3.4">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q0.15">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q15.0">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q7.8">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q0.31">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q31.0">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q15.16">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q8.20">0.9</FixedPointParameter>
+ <!-- Tested Integers -->
+ <IntegerParameter Name="UINT32">1</IntegerParameter>
+ <IntegerParameter Name="INT32">-1</IntegerParameter>
+ <IntegerParameter Name="UINT32_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT32_Max">-1</IntegerParameter>
+ <IntegerParameter Name="UINT16">1</IntegerParameter>
+ <IntegerParameter Name="INT16">-1</IntegerParameter>
+ <IntegerParameter Name="UINT16_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT16_Max">-1</IntegerParameter>
+ <IntegerParameter Name="UINT8">1</IntegerParameter>
+ <IntegerParameter Name="INT8">-1</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT8_Max">-1</IntegerParameter>
+ <!-- Tested Arrays -->
+ <IntegerParameter Name="UINT32_ARRAY">1</IntegerParameter>
+ <IntegerParameter Name="INT16_ARRAY">-1</IntegerParameter>
+ <IntegerParameter Name="UINT8_ARRAY">1</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max_ARRAY">1</IntegerParameter>
+ <!-- Tested String-->
+ <StringParameter Name="STR_CHAR128">string_Conf_1_0</StringParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ </Settings>
+ </ConfigurableDomain>
+</ConfigurableDomains>
diff --git a/test/functional-tests/xml/XML_Test/Uncompliant_UndeclaredParameter.xml b/test/functional-tests/xml/XML_Test/Uncompliant_UndeclaredParameter.xml
new file mode 100644
index 0000000..f831de5
--- /dev/null
+++ b/test/functional-tests/xml/XML_Test/Uncompliant_UndeclaredParameter.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ConfigurableDomains xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Schemas/ConfigurableDomains.xsd" SystemClassName="Test">
+ <ConfigurableDomain Name="Domain_1">
+ <Configurations>
+ <Configuration Name="Conf_1_0">
+ <CompoundRule Type="All">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x1"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="Is" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ <Configuration Name="Conf_1_1">
+ <CompoundRule Type="Any">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x2"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="IsNot" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ </Configurations>
+ <ConfigurableElements>
+ <ConfigurableElement Path="/Test/Test/TEST_DIR" />
+ </ConfigurableElements>
+ <Settings>
+ <Configuration Name="Conf_1_1">
+ <ConfigurableElement Path="/Test/Test/TEST_DIR">
+ <Component Name="TEST_DIR">
+ <!-- Tested Booleans -->
+ <BooleanParameter Name="BOOL">0</BooleanParameter>
+ <BooleanParameter Name="UNDECLARED">0</BooleanParameter>
+ <!-- Tested FixedPoints -->
+ <FixedPointParameter Name="FP8_Q0.7">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q7.0">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q3.4">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q0.15">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q15.0">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q7.8">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q0.31">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q31.0">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q15.16">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q8.20">0.1</FixedPointParameter>
+ <!-- Tested Integers -->
+ <IntegerParameter Name="UINT32">0</IntegerParameter>
+ <IntegerParameter Name="INT32">0</IntegerParameter>
+ <IntegerParameter Name="UINT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT16">0</IntegerParameter>
+ <IntegerParameter Name="INT16">0</IntegerParameter>
+ <IntegerParameter Name="UINT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT8">0</IntegerParameter>
+ <IntegerParameter Name="INT8">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT8_Max">0</IntegerParameter>
+ <!-- Tested Arrays -->
+ <IntegerParameter Name="UINT32_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="INT16_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max_ARRAY">0</IntegerParameter>
+ <!-- Tested String-->
+ <StringParameter Name="STR_CHAR128">string_Conf_1_1</StringParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ <Configuration Name="Conf_1_0">
+ <ConfigurableElement Path="/Test/Test/TEST_DIR">
+ <Component Name="TEST_DIR">
+ <!-- Tested Booleans -->
+ <BooleanParameter Name="BOOL">1</BooleanParameter>
+ <BooleanParameter Name="UNDECLARED">0</BooleanParameter>
+ <!-- Tested FixedPoints -->
+ <FixedPointParameter Name="FP8_Q0.7">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q7.0">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q3.4">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q0.15">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q15.0">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q7.8">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q0.31">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q31.0">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q15.16">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q8.20">0.9</FixedPointParameter>
+ <!-- Tested Integers -->
+ <IntegerParameter Name="UINT32">1</IntegerParameter>
+ <IntegerParameter Name="INT32">-1</IntegerParameter>
+ <IntegerParameter Name="UINT32_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT32_Max">-1</IntegerParameter>
+ <IntegerParameter Name="UINT16">1</IntegerParameter>
+ <IntegerParameter Name="INT16">-1</IntegerParameter>
+ <IntegerParameter Name="UINT16_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT16_Max">-1</IntegerParameter>
+ <IntegerParameter Name="UINT8">1</IntegerParameter>
+ <IntegerParameter Name="INT8">-1</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT8_Max">-1</IntegerParameter>
+ <!-- Tested Arrays -->
+ <IntegerParameter Name="UINT32_ARRAY">1</IntegerParameter>
+ <IntegerParameter Name="INT16_ARRAY">-1</IntegerParameter>
+ <IntegerParameter Name="UINT8_ARRAY">1</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max_ARRAY">1</IntegerParameter>
+ <!-- Tested String-->
+ <StringParameter Name="STR_CHAR128">string_Conf_1_0</StringParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ </Settings>
+ </ConfigurableDomain>
+</ConfigurableDomains>
diff --git a/test/functional-tests/xml/XML_Test/Uncompliant_UnorderConfigurableElement.xml b/test/functional-tests/xml/XML_Test/Uncompliant_UnorderConfigurableElement.xml
new file mode 100644
index 0000000..3d9aaa4
--- /dev/null
+++ b/test/functional-tests/xml/XML_Test/Uncompliant_UnorderConfigurableElement.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ConfigurableDomains xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Schemas/ConfigurableDomains.xsd" SystemClassName="Test">
+ <ConfigurableDomain Name="Domain_1">
+ <Configurations>
+ <Configuration Name="Conf_1_0">
+ <CompoundRule Type="All">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x1"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="Is" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ <Configuration Name="Conf_1_1">
+ <CompoundRule Type="Any">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x2"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="IsNot" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ </Configurations>
+ <ConfigurableElements>
+ <ConfigurableElement Path="/Test/Test/TEST_DIR" />
+ </ConfigurableElements>
+ <Settings>
+ <Configuration Name="Conf_1_1">
+ <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_0">
+ <Component Name="TEST_DOMAIN_0">
+ <!-- Tested Booleans -->
+ <BooleanParameter Name="BOOL">0</BooleanParameter>
+ <!-- Tested FixedPoints -->
+ <FixedPointParameter Name="FP8_Q0.7">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q7.0">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q3.4">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q0.15">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q15.0">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q7.8">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q0.31">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q31.0">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q15.16">0.1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q8.20">0.1</FixedPointParameter>
+ <!-- Tested Integers -->
+ <IntegerParameter Name="UINT32">0</IntegerParameter>
+ <IntegerParameter Name="INT32">0</IntegerParameter>
+ <IntegerParameter Name="UINT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT16">0</IntegerParameter>
+ <IntegerParameter Name="INT16">0</IntegerParameter>
+ <IntegerParameter Name="UINT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT8">0</IntegerParameter>
+ <IntegerParameter Name="INT8">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT8_Max">0</IntegerParameter>
+ <!-- Tested Arrays -->
+ <IntegerParameter Name="UINT32_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="INT16_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max_ARRAY">0</IntegerParameter>
+ <!-- Tested String-->
+ <StringParameter Name="STR_CHAR128">string_Conf_1_1</StringParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ <Configuration Name="Conf_1_0">
+ <ConfigurableElement Path="/Test/Test/TEST_DIR">
+ <Component Name="TEST_DIR">
+ <!-- Tested Booleans -->
+ <BooleanParameter Name="BOOL">1</BooleanParameter>
+ <!-- Tested FixedPoints -->
+ <FixedPointParameter Name="FP8_Q0.7">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q7.0">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q3.4">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q0.15">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q15.0">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q7.8">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q0.31">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q31.0">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q15.16">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q8.20">0.9</FixedPointParameter>
+ <!-- Tested Integers -->
+ <IntegerParameter Name="UINT32">1</IntegerParameter>
+ <IntegerParameter Name="INT32">-1</IntegerParameter>
+ <IntegerParameter Name="UINT32_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT32_Max">-1</IntegerParameter>
+ <IntegerParameter Name="UINT16">1</IntegerParameter>
+ <IntegerParameter Name="INT16">-1</IntegerParameter>
+ <IntegerParameter Name="UINT16_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT16_Max">-1</IntegerParameter>
+ <IntegerParameter Name="UINT8">1</IntegerParameter>
+ <IntegerParameter Name="INT8">-1</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT8_Max">-1</IntegerParameter>
+ <!-- Tested Arrays -->
+ <IntegerParameter Name="UINT32_ARRAY">1</IntegerParameter>
+ <IntegerParameter Name="INT16_ARRAY">-1</IntegerParameter>
+ <IntegerParameter Name="UINT8_ARRAY">1</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max_ARRAY">1</IntegerParameter>
+ <!-- Tested String-->
+ <StringParameter Name="STR_CHAR128">string_Conf_1_0</StringParameter>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ </Settings>
+ </ConfigurableDomain>
+</ConfigurableDomains>
diff --git a/test/functional-tests/xml/configuration/ParameterFrameworkConfiguration.xml b/test/functional-tests/xml/configuration/ParameterFrameworkConfiguration.xml
new file mode 100644
index 0000000..85e9a0a
--- /dev/null
+++ b/test/functional-tests/xml/configuration/ParameterFrameworkConfiguration.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ParameterFrameworkConfiguration SystemClassName="Test" ServerPort="5000" TuningAllowed="true">
+ <SubsystemPlugins>
+ <Location Folder="">
+ <Plugin Name="libtest-subsystem.so"/>
+ </Location>
+ </SubsystemPlugins>
+ <StructureDescriptionFileLocation Path="Structure/Test/TestClass.xml"/>
+ <SettingsConfiguration>
+ <ConfigurableDomainsFileLocation Path="Settings/Test/TestConfigurableDomains.xml"/>
+ </SettingsConfiguration>
+</ParameterFrameworkConfiguration>
diff --git a/test/functional-tests/xml/configuration/Settings/Test/TestConfigurableDomains.xml b/test/functional-tests/xml/configuration/Settings/Test/TestConfigurableDomains.xml
new file mode 100644
index 0000000..fdc77e1
--- /dev/null
+++ b/test/functional-tests/xml/configuration/Settings/Test/TestConfigurableDomains.xml
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ConfigurableDomains xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="/home/lab/ICS/hardware/intel/PRIVATE/parameter-framework/test/configuration/Schemas/ConfigurableDomains.xsd" SystemClassName="Test">
+ <ConfigurableDomain Name="Domain_0">
+ <Configurations>
+ <Configuration Name="Conf_0">
+ <CompoundRule Type="All">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x1"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="Is" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ <Configuration Name="Conf_1">
+ <CompoundRule Type="Any">
+ <SelectionCriterionRule SelectionCriterion="Crit_0" MatchesWhen="Includes" Value="State_0x2"/>
+ <SelectionCriterionRule SelectionCriterion="Crit_1" MatchesWhen="IsNot" Value="State_1"/>
+ </CompoundRule>
+ </Configuration>
+ </Configurations>
+
+ <ConfigurableElements>
+ <ConfigurableElement Path="/Test/Test/TEST_DIR" />
+ <ConfigurableElement Path="/Test/Test/TEST_TYPES" />
+ </ConfigurableElements>
+
+ <Settings>
+ <Configuration Name="Conf_0">
+ <ConfigurableElement Path="/Test/Test/TEST_DIR">
+ <Component Name="TEST_DIR">
+ <!-- Tested Booleans -->
+ <BooleanParameter Name="BOOL">0</BooleanParameter>
+ <!-- Tested FixedPoints -->
+ <FixedPointParameter Name="FP8_Q0.7">0</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q7.0">0</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q3.4">0</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q0.15">0</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q15.0">0</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q7.8">0</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q0.31">0</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q31.0">0</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q15.16">0</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q8.20">0</FixedPointParameter>
+ <!-- Tested Integers -->
+ <IntegerParameter Name="UINT32">0</IntegerParameter>
+ <IntegerParameter Name="INT32">0</IntegerParameter>
+ <IntegerParameter Name="UINT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT32_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT16">0</IntegerParameter>
+ <IntegerParameter Name="INT16">0</IntegerParameter>
+ <IntegerParameter Name="UINT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT16_Max">0</IntegerParameter>
+ <IntegerParameter Name="UINT8">0</IntegerParameter>
+ <IntegerParameter Name="INT8">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max">0</IntegerParameter>
+ <IntegerParameter Name="INT8_Max">0</IntegerParameter>
+ <!-- Tested Arrays -->
+ <IntegerParameter Name="UINT32_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="INT16_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_ARRAY">0</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max_ARRAY">0</IntegerParameter>
+ <!-- Tested String-->
+ <StringParameter Name="STR_CHAR128">string_Conf_0</StringParameter>
+ </Component>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Test/Test/TEST_TYPES">
+ <Component Name="TEST_TYPES">
+ <EnumParameter Name="ENUM">ENUM_NOMINAL</EnumParameter>
+ <BitParameterBlock Name="BLOCK_8BIT">
+ <BitParameter Name="BIT_0_3">0</BitParameter>
+ <BitParameter Name="BIT_3_1">0</BitParameter>
+ <BitParameter Name="BIT_4_1">0</BitParameter>
+ <BitParameter Name="BIT_6_2">0</BitParameter>
+ <BitParameter Name="BIT_7_1">0</BitParameter>
+ </BitParameterBlock>
+ <ParameterBlock Name="BLOCK_PARAMETER">
+ <IntegerParameter Name="UINT8">0</IntegerParameter>
+ <IntegerParameter Name="UINT16">0</IntegerParameter>
+ <IntegerParameter Name="UINT32">0</IntegerParameter>
+ </ParameterBlock>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ <Configuration Name="Conf_1">
+ <ConfigurableElement Path="/Test/Test/TEST_DIR">
+ <Component Name="TEST_DIR">
+ <!-- Tested Booleans -->
+ <BooleanParameter Name="BOOL">1</BooleanParameter>
+ <!-- Tested FixedPoints -->
+ <FixedPointParameter Name="FP8_Q0.7">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q7.0">1</FixedPointParameter>
+ <FixedPointParameter Name="FP8_Q3.4">1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q0.15">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q15.0">1</FixedPointParameter>
+ <FixedPointParameter Name="FP16_Q7.8">1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q0.31">0.9</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q31.0">1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q15.16">1</FixedPointParameter>
+ <FixedPointParameter Name="FP32_Q8.20">1</FixedPointParameter>
+ <!-- Tested Integers -->
+ <IntegerParameter Name="UINT32">1</IntegerParameter>
+ <IntegerParameter Name="INT32">1</IntegerParameter>
+ <IntegerParameter Name="UINT32_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT32_Max">1</IntegerParameter>
+ <IntegerParameter Name="UINT16">1</IntegerParameter>
+ <IntegerParameter Name="INT16">1</IntegerParameter>
+ <IntegerParameter Name="UINT16_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT16_Max">1</IntegerParameter>
+ <IntegerParameter Name="UINT8">1</IntegerParameter>
+ <IntegerParameter Name="INT8">1</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max">1</IntegerParameter>
+ <IntegerParameter Name="INT8_Max">1</IntegerParameter>
+ <!-- Tested Arrays -->
+ <IntegerParameter Name="UINT32_ARRAY">1</IntegerParameter>
+ <IntegerParameter Name="INT16_ARRAY">1</IntegerParameter>
+ <IntegerParameter Name="UINT8_ARRAY">1</IntegerParameter>
+ <IntegerParameter Name="UINT8_Max_ARRAY">1</IntegerParameter>
+ <!-- Tested String-->
+ <StringParameter Name="STR_CHAR128">string_Conf_1</StringParameter>
+ </Component>
+ </ConfigurableElement>
+ <ConfigurableElement Path="/Test/Test/TEST_TYPES">
+ <Component Name="TEST_TYPES">
+ <!--Tested Enum-->
+ <EnumParameter Name="ENUM">ENUM_MIN</EnumParameter>
+ <!--Tested Bit parameter block-->
+ <BitParameterBlock Name="BLOCK_8BIT">
+ <BitParameter Name="BIT_0_3">0</BitParameter>
+ <BitParameter Name="BIT_3_1">0</BitParameter>
+ <BitParameter Name="BIT_4_1">0</BitParameter>
+ <BitParameter Name="BIT_6_2">0</BitParameter>
+ <BitParameter Name="BIT_7_1">0</BitParameter>
+ </BitParameterBlock>
+ <ParameterBlock Name="BLOCK_PARAMETER">
+ <IntegerParameter Name="UINT8">0</IntegerParameter>
+ <IntegerParameter Name="UINT16">0</IntegerParameter>
+ <IntegerParameter Name="UINT32">0</IntegerParameter>
+ </ParameterBlock>
+ </Component>
+ </ConfigurableElement>
+ </Configuration>
+ </Settings>
+ </ConfigurableDomain>
+</ConfigurableDomains>
diff --git a/test/functional-tests/xml/configuration/Structure/Test/TestClass.xml b/test/functional-tests/xml/configuration/Structure/Test/TestClass.xml
new file mode 100644
index 0000000..480aa05
--- /dev/null
+++ b/test/functional-tests/xml/configuration/Structure/Test/TestClass.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SystemClass Name="Test">
+ <SubsystemInclude Path="TestSubsystem.xml"/>
+</SystemClass>
diff --git a/test/functional-tests/xml/configuration/Structure/Test/TestSubsystem.xml.in b/test/functional-tests/xml/configuration/Structure/Test/TestSubsystem.xml.in
new file mode 100644
index 0000000..1987ec4
--- /dev/null
+++ b/test/functional-tests/xml/configuration/Structure/Test/TestSubsystem.xml.in
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Subsystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="/home/lab/ICS/hardware/intel/PRIVATE/parameter-framework/test/configuration/Schemas/Subsystem.xsd" Name="Test" Type="TEST" Endianness="Little">
+ <ComponentLibrary>
+ <ComponentType Name="TEST_DIR">
+ <!-- Tested Booleans -->
+ <BooleanParameter Name="BOOL" Mapping="Binary:BOOL"/>
+ <!-- Tested FixedPoints -->
+ <FixedPointParameter Name="FP8_Q0.7" Size="8" Integral="0" Fractional="7" Mapping="Binary:FP8_Q.7"/>
+ <FixedPointParameter Name="FP8_Q7.0" Size="8" Integral="7" Fractional="0" Mapping="Binary:FP8_7.0"/>
+ <FixedPointParameter Name="FP8_Q3.4" Size="8" Integral="3" Fractional="4" Mapping="Binary:FP8_3.4"/>
+ <FixedPointParameter Name="FP16_Q0.15" Size="16" Integral="0" Fractional="15" Mapping="Binary:FP16_Q.15"/>
+ <FixedPointParameter Name="FP16_Q15.0" Size="16" Integral="15" Fractional="0" Mapping="Binary:FP16_15.0"/>
+ <FixedPointParameter Name="FP16_Q7.8" Size="16" Integral="7" Fractional="8" Mapping="Binary:FP16_7.8"/>
+ <FixedPointParameter Name="FP32_Q0.31" Size="32" Integral="0" Fractional="31" Mapping="Binary:FP32_Q.31"/>
+ <FixedPointParameter Name="FP32_Q31.0" Size="32" Integral="31" Fractional="0" Mapping="Binary:FP32_31.0"/>
+ <FixedPointParameter Name="FP32_Q15.16" Size="32" Integral="15" Fractional="16" Mapping="Binary:FP32_15.16"/>
+ <FixedPointParameter Name="FP32_Q8.20" Size="32" Integral="8" Fractional="20" Mapping="Binary:FP32_Q8.20"/>
+ <!-- Tested Integers -->
+ <IntegerParameter Name="UINT32" Size="32" Signed="false" Max="1000" Mapping="Binary:UINT32"/>
+ <IntegerParameter Name="INT32" Size="32" Signed="true" Min="-1000" Max="1000" Mapping="Binary:INT32"/>
+ <IntegerParameter Name="UINT32_Max" Size="32" Signed="false" Max="4294967295" Mapping="Binary:UINT32_Max"/>
+ <IntegerParameter Name="INT32_Max" Size="32" Signed="true" Min="-2147483648" Max="2147483647" Mapping="Binary:INT32"/>
+ <IntegerParameter Name="UINT16" Size="16" Signed="false" Max="1000" Mapping="Binary:UINT16"/>
+ <IntegerParameter Name="INT16" Size="16" Signed="true" Min="-1000" Max="1000" Mapping="Binary:INT16"/>
+ <IntegerParameter Name="UINT16_Max" Size="16" Signed="false" Max="65535" Mapping="Binary:UINT16_Max"/>
+ <IntegerParameter Name="INT16_Max" Size="16" Signed="true" Min="-32768" Max="32767" Mapping="Binary:INT16_Max"/>
+ <IntegerParameter Name="UINT8" Size="8" Signed="false" Max="100" Mapping="Binary:UINT8"/>
+ <IntegerParameter Name="INT8" Size="8" Signed="true" Min="-100" Max="100" Mapping="Binary:INT8"/>
+ <IntegerParameter Name="UINT8_Max" Size="8" Signed="false" Max="255" Mapping="Binary:UINT8_Max"/>
+ <IntegerParameter Name="INT8_Max" Size="8" Signed="true" Min="-128" Max="127" Mapping="Binary:INT8_Max"/>
+ <!-- Tested Arrays -->
+ <IntegerParameter Name="UINT32_ARRAY" Size="32" Signed="false" ArrayLength="100" Min="0" Max="100" Mapping="Binary:UINT32_ARRAY"/>
+ <IntegerParameter Name="INT16_ARRAY" Size="16" Signed="true" ArrayLength="5" Min="-50" Max="50" Mapping="Binary:INT16_ARRAY_signed"/>
+ <IntegerParameter Name="UINT8_ARRAY" Size="8" Signed="false" ArrayLength="5" Min="0" Max="15" Mapping="Binary:UINT8_ARRAY"/>
+ <IntegerParameter Name="UINT8_Max_ARRAY" Size="8" Signed="false" ArrayLength="5" Min="0" Max="255" Mapping="Binary:UINT8_Max_ARRAY"/>
+ <!-- Tested String-->
+ <StringParameter Name="STR_CHAR128" MaxLength="128" Mapping="String:STRING"/>
+ </ComponentType>
+ <ComponentType Name="TEST_DOMAIN_0">
+ <IntegerParameter Name="Param_00" Size="16" Signed="false" Mapping="Binary:Param_00"/>
+ <IntegerParameter Name="Param_01" Size="16" Signed="false" Mapping="Binary:Param_01"/>
+ <IntegerParameter Name="Param_02" Size="16" Signed="false" Mapping="Binary:Param_02"/>
+ </ComponentType>
+ <ComponentType Name="TEST_DOMAIN_1">
+ <IntegerParameter Name="Param_10" Size="16" Signed="false" Mapping="Binary:Param_10"/>
+ <IntegerParameter Name="Param_11" Size="16" Signed="false" Mapping="Binary:Param_11"/>
+ <IntegerParameter Name="Param_12" Size="16" Signed="false" Mapping="Binary:Param_12"/>
+ </ComponentType>
+ <ComponentType Name="TEST_TYPES">
+ <!-- Tested Enum -->
+ <EnumParameter Name="ENUM" Size="8" Mapping="Binary:ENUM">
+ <ValuePair Literal="ENUM_MIN" Numerical="-128"/>
+ <ValuePair Literal="ENUM_MAX" Numerical="127"/>
+ <ValuePair Literal="ENUM_NOMINAL" Numerical="5"/>
+ <ValuePair Literal="ENUM_OOB" Numerical="255"/>
+ <ValuePair Literal="ENUM_OOS" Numerical="256"/>
+ </EnumParameter>
+ <BitParameterBlock Name="BLOCK_8BIT" Size="8" Mapping="Binary:BLOCK_8BIT">
+ <BitParameter Name="BIT_0_3" Size="3" Pos="0"/>
+ <BitParameter Name="BIT_3_1" Size="1" Pos="3"/>
+ <BitParameter Name="BIT_4_1" Size="1" Pos="4"/>
+ <BitParameter Name="BIT_6_2" Size="2" Pos="6"/>
+ <BitParameter Name="BIT_7_1" Size="1" Pos="7"/>
+ </BitParameterBlock>
+ <ParameterBlock Name="BLOCK_PARAMETER">
+ <IntegerParameter Name="UINT8" Size="8" Signed="false" Mapping="Binary:BLOCK_UINT8"/>
+ <IntegerParameter Name="UINT16" Size="16" Signed="false" Mapping="Binary:BLOCK_UINT16"/>
+ <IntegerParameter Name="UINT32" Size="32" Signed="false" Mapping="Binary:BLOCK_UINT32"/>
+ </ParameterBlock>
+ </ComponentType>
+ <ComponentType Name="TEST_MAIN">
+ <Component Name = "TEST_DIR_0" Type="TEST_DIR"/>
+ <Component Name = "TEST_DIR_1" Type="TEST_DOMAIN_0"/>
+ <Component Name = "TEST_DIR_2" Type="TEST_DOMAIN_1"/>
+ </ComponentType>
+ </ComponentLibrary>
+ <InstanceDefinition>
+ <Component Name="TEST_DIR" Type="TEST_DIR" Mapping="Directory:@PFW_RESULT@"/>
+ <Component Name="TEST_DOMAIN_0" Type="TEST_DOMAIN_0" Mapping="Directory:@PFW_RESULT@"/>
+ <Component Name="TEST_DOMAIN_1" Type="TEST_DOMAIN_1" Mapping="Directory:@PFW_RESULT@"/>
+ <Component Name="TEST_TYPES" Type="TEST_TYPES" Mapping="Directory:@PFW_RESULT@"/>
+ <Component Name="TEST_MAIN" Type="TEST_MAIN" Mapping="Directory:@PFW_RESULT@"/>
+ </InstanceDefinition>
+</Subsystem>
diff --git a/test/test-fixed-point-parameter/CMakeLists.txt b/test/test-fixed-point-parameter/CMakeLists.txt
index 44410b0..64b51f3 100644
--- a/test/test-fixed-point-parameter/CMakeLists.txt
+++ b/test/test-fixed-point-parameter/CMakeLists.txt
@@ -26,12 +26,13 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-find_program(python2 python2)
+if (BUILD_TESTING)
+ find_program(python2 python2)
-if(python2)
add_test(NAME fix_point_parameter
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${python2} Main.py)
-else(python2)
- message(WARNING "Disabling fix point parameter test as python2 is not installed.")
-endif(python2)
+
+ # Custom function defined in the top-level CMakeLists
+ set_test_env(fix_point_parameter)
+endif()
diff --git a/test/test-fixed-point-parameter/Main.py b/test/test-fixed-point-parameter/Main.py
index 9a2eafc..6d7b292 100755
--- a/test/test-fixed-point-parameter/Main.py
+++ b/test/test-fixed-point-parameter/Main.py
@@ -1,6 +1,6 @@
#!/usr/bin/python2.7
#
-# Copyright (c) 2014, Intel Corporation
+# Copyright (c) 2014-2015, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
@@ -28,9 +28,20 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-import sys
-import subprocess
+import PyPfw
+
+import logging
from decimal import Decimal
+from math import log10
+
+class PfwLogger(PyPfw.ILogger):
+ def __init__(self):
+ super(PfwLogger, self).__init__()
+ self.__logger = logging.root.getChild("parameter-framework")
+
+ def log(self, is_warning, message):
+ log_func = self.__logger.warning if is_warning else self.__logger.info
+ log_func(message)
class FixedPointTester():
""" Made for testing a particular Qn.m number
@@ -75,7 +86,7 @@
# bigValue is to be sure a value far out of range is refused
bigValue = (2 * self._quantum)
# little is to be sure a value just out of range is refused
- littleValue = 10 ** -fractional
+ littleValue = 10 ** -(int(fractional * log10(2)))
self._shouldBreak = [
Decimal(self._lowerAllowedBound) - Decimal(bigValue),
Decimal(self._upperAllowedBound) + Decimal(bigValue),
@@ -83,38 +94,40 @@
Decimal(self._upperAllowedBound) + Decimal(littleValue)
]
+ self._chainingTests = [
+ ('Bound', self.checkBounds),
+ ('Sanity', self.checkSanity),
+ ('Consistency', self.checkConsistency),
+ ('Bijectivity', self.checkBijectivity)]
+
def run(self):
""" Runs the test suite for a given Qn.m number
"""
+
+ runSuccess = True
+
for value in self._shouldWork:
+ value = value.normalize()
print('Testing %s for %s' % (value, self._paramPath))
- value, success = self.checkBounds(value)
- if not success:
- print('Bound ERROR for %s' % self._paramPath)
- continue
- value, success = self.checkSanity(value)
- if not success:
- print('Sanity ERROR %s' % self._paramPath)
- continue
-
- value, success = self.checkConsistency(value)
- if not success:
- print('Consistency ERROR %s' % self._paramPath)
- continue
-
- value, success = self.checkBijectivity(value)
- if not success:
- print('Bijectivity ERROR %s' % self._paramPath)
- continue
+ for testName, testFunc in self._chainingTests:
+ value, success = testFunc(value)
+ if not success:
+ runSuccess = False
+ print("%s ERROR for %s" % (testName, self._paramPath))
+ break
for value in self._shouldBreak:
+ value = value.normalize()
print('Testing invalid value %s for %s' % (value, self._paramPath))
value, success = self.checkBounds(value)
if success:
+ runSuccess = False
print("ERROR: This test should have failed but it has not")
+ return runSuccess
+
def checkBounds(self, valueToSet):
""" Checks if we are able to set valueToSet via the parameter-framework
@@ -123,11 +136,9 @@
returns: the value we are trying to set
returns: True if we are able to set, False otherwise
"""
- returnCode = self._pfwClient.set(self._paramPath, str(valueToSet))
- if returnCode != 0:
- return (valueToSet, False)
+ (success, errorMsg) = self._pfwClient.set(self._paramPath, str(valueToSet))
- return (valueToSet, True)
+ return valueToSet, success
def checkSanity(self, valuePreviouslySet):
@@ -167,11 +178,9 @@
valueToSet -- the value we are trying to set
returns: True if we are able to set, False otherwise
"""
- returnCode = pfw.set(self._paramPath, valuePreviouslyGotten)
- if returnCode != 0:
- return valuePreviouslyGotten, False
+ (success, errorMsg) = pfw.set(self._paramPath, valuePreviouslyGotten)
- return valuePreviouslyGotten, True
+ return valuePreviouslyGotten, success
def checkBijectivity(self, valuePreviouslySet):
""" Checks that the second get value is strictly equivalent to the
@@ -184,6 +193,7 @@
returns: True if we are able to set, False otherwise
"""
secondGet = pfw.get(self._paramPath)
+
if secondGet != valuePreviouslySet:
return secondGet, False
@@ -192,50 +202,42 @@
class PfwClient():
def __init__(self, configPath):
- self._address = 'localhost'
- self._port = '5066'
- self._testPlatformPort = '5063'
- self._pathToExec = 'remote-process'
- self._configPath = configPath
+ self._instance = PyPfw.ParameterFramework(configPath)
- def __enter__(self):
- # launch test platform in deamon mode
- subprocess.call(['test-platform', '-d', self._configPath, self._testPlatformPort])
- subprocess.call([self._pathToExec, self._address, self._testPlatformPort, 'start'])
- self._callCommand(['setTuningMode', 'on'])
- return self
+ self._logger = PfwLogger()
+ self._instance.setLogger(self._logger)
+ # Disable the remote interface because we don't need it and it might
+ # get in the way (e.g. the port is already in use)
+ self._instance.setForceNoRemoteInterface(True)
- def __exit__(self, type, value, traceback):
- subprocess.call([self._pathToExec, self._address, self._testPlatformPort, 'exit'])
-
- def _callCommand(self, commandList):
- shellCommand = [self._pathToExec, self._address, self._port]
- shellCommand.extend(commandList)
- # pipes are used to redirect the command output to a variable
- subProc = subprocess.Popen(shellCommand, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- commandOutPut, _ = subProc.communicate()
- returnCode = subProc.returncode
- return commandOutPut, returnCode
+ self._instance.start()
+ self._instance.setTuningMode(True)
def set(self, parameter, value):
print('set %s <--- %s' % (parameter, value))
- (returnValue, returnCode) = self._callCommand(['setParameter', parameter, value])
- return returnCode
+ (success, _, errorMsg) = self._instance.accessParameterValue(parameter, str(value), True)
+ return success, errorMsg
def get(self, parameter):
- (returnValue, _) = self._callCommand(['getParameter', parameter])
- print('get %s ---> %s' % (parameter, returnValue.strip()))
- return returnValue.strip()
+ (success, value, errorMsg) = self._instance.accessParameterValue(parameter, "", False)
+ if not success:
+ raise Exception("A getParameter failed, which is unexpected. The"
+ "parameter-framework answered:\n%s" % errorMsg)
+
+ print('get %s ---> %s' % (parameter, value))
+ return value
if __name__ == '__main__':
# It is necessary to add a ./ in front of the path, otherwise the parameter-framework
# does not recognize the string as a path.
- configPath = './ParameterFrameworkConfiguration.xml'
+ pfw = PfwClient('./ParameterFrameworkConfiguration.xml')
- with PfwClient(configPath) as pfw:
- for size in [8, 16, 32]:
- for integral in range(0, size):
- for fractional in range (0, size - integral):
- tester = FixedPointTester(pfw, size, integral, fractional)
- tester.run()
+ success = True
+ for size in [8, 16, 32]:
+ for integral in range(0, size):
+ for fractional in range (0, size - integral):
+ tester = FixedPointTester(pfw, size, integral, fractional)
+ success = tester.run() and success
+
+ exit(0 if success else 1)
diff --git a/test/test-platform/Android.mk b/test/test-platform/Android.mk
index a96c8c3..eca285a 100644
--- a/test/test-platform/Android.mk
+++ b/test/test-platform/Android.mk
@@ -43,8 +43,6 @@
$(LOCAL_PATH)/../../parameter/include \
$(LOCAL_PATH)/../../remote-processor/
-common_ldlibs := -pthread
-
common_shared_libraries := libparameter libremote-processor
#############################
# Target build
@@ -58,7 +56,6 @@
LOCAL_MODULE_TAGS := $(common_module_tags)
LOCAL_C_INCLUDES := $(common_c_includes)
-LOCAL_LDLIBS := $(common_ldlibs)
LOCAL_STATIC_LIBRARIES := libpfw_utility
LOCAL_SHARED_LIBRARIES := $(common_shared_libraries)
@@ -81,7 +78,8 @@
LOCAL_MODULE_TAGS := $(common_module_tags)
LOCAL_C_INCLUDES += $(common_c_includes)
-LOCAL_LDLIBS := $(common_ldlibs)
+LOCAL_CFLAGS := -pthread
+LOCAL_LDLIBS := -lpthread
LOCAL_STATIC_LIBRARIES := libpfw_utility_host
LOCAL_SHARED_LIBRARIES := $(foreach shared_library, $(common_shared_libraries), \
diff --git a/test/test-platform/TestPlatform.cpp b/test/test-platform/TestPlatform.cpp
index a6613e9..6e67b3a 100644
--- a/test/test-platform/TestPlatform.cpp
+++ b/test/test-platform/TestPlatform.cpp
@@ -63,7 +63,6 @@
CTestPlatform::CTestPlatform(const string& strClass, int iPortNumber, sem_t& exitSemaphore) :
_pParameterMgrPlatformConnector(new CParameterMgrPlatformConnector(strClass)),
_pParameterMgrPlatformConnectorLogger(new CParameterMgrPlatformConnectorLogger),
- _portNumber(iPortNumber),
_exitSemaphore(exitSemaphore)
{
_pCommandHandler = new CCommandHandler(this);
@@ -154,9 +153,6 @@
{
(void)remoteCommand;
- // Stop local server
- _pRemoteProcessorServer->stop();
-
// Release the main blocking semaphore to quit application
sem_post(&_exitSemaphore);
@@ -166,12 +162,9 @@
bool CTestPlatform::load(std::string& strError)
{
// Start remote processor server
- if (!_pRemoteProcessorServer->start()) {
+ if (!_pRemoteProcessorServer->start(strError)) {
- std::ostringstream oss;
- oss << "TestPlatform: Unable to start remote processor server on port " << _portNumber;
- strError = oss.str();
-
+ strError = "TestPlatform: Unable to start remote processor server: " + strError;
return false;
}
diff --git a/test/test-platform/TestPlatform.h b/test/test-platform/TestPlatform.h
index e9d1dd4..fae8386 100644
--- a/test/test-platform/TestPlatform.h
+++ b/test/test-platform/TestPlatform.h
@@ -153,9 +153,6 @@
// Remote Processor Server
CRemoteProcessorServer* _pRemoteProcessorServer;
- // Port number for the server socket
- int _portNumber;
-
// Semaphore used by calling thread to avoid exiting
sem_t& _exitSemaphore;
};
diff --git a/test/test-platform/main.cpp b/test/test-platform/main.cpp
index a3f50be..6a79597 100644
--- a/test/test-platform/main.cpp
+++ b/test/test-platform/main.cpp
@@ -29,12 +29,15 @@
*/
#include "TestPlatform.h"
+#include "FullIo.hpp"
#include <iostream>
#include <cstdlib>
#include <semaphore.h>
#include <string.h>
#include <unistd.h>
+#include <cerrno>
+#include <cassert>
using namespace std;
@@ -68,6 +71,16 @@
return true;
}
+static void notifyParent(int parentFd, bool success)
+{
+ if (not utility::fullWrite(parentFd, &success, sizeof(success))) {
+ cerr << "Unable to warn parent process of load "
+ << (success ? "success" : "failure") << ": "
+ << strerror(errno) << endl;
+ assert(false);
+ }
+}
+
// Starts test-platform in daemon mode
static bool startDaemonTestPlatform(const char *filePath, int portNumber, string &strError)
{
@@ -106,31 +119,26 @@
CTestPlatform testPlatform(filePath, portNumber, sem);
// Message to send to parent process
- bool msgToParent;
+ bool loadSuccess = testPlatform.load(strError);
- // Start platformmgr
- if (!testPlatform.load(strError)) {
+ if (!loadSuccess) {
cerr << strError << endl;
// Notify parent of failure;
- msgToParent = false;
- write(pipefd[1], &msgToParent, sizeof(msgToParent));
+ notifyParent(pipefd[1], false);
- sem_destroy(&sem);
} else {
// Notify parent of success
- msgToParent = true;
- write(pipefd[1], &msgToParent, sizeof(msgToParent));
+ notifyParent(pipefd[1], true);
// Block here
sem_wait(&sem);
-
- sem_destroy(&sem);
}
+ sem_destroy(&sem);
- return msgToParent;
+ return loadSuccess;
} else {
@@ -143,9 +151,9 @@
// Message received from the child process
bool msgFromChild = false;
- if (read(pipefd[0], &msgFromChild, sizeof(msgFromChild)) <= 0) {
-
+ if (not utility::fullRead(pipefd[0], &msgFromChild, sizeof(msgFromChild))) {
strError = "Read pipe failed";
+ return false;
}
// return success/failure in exit status
diff --git a/test/test-subsystem/CMakeLists.txt b/test/test-subsystem/CMakeLists.txt
new file mode 100644
index 0000000..52e66b0
--- /dev/null
+++ b/test/test-subsystem/CMakeLists.txt
@@ -0,0 +1,44 @@
+# Copyright (c) 2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+if (BUILD_TESTING)
+
+ add_library(test-subsystem SHARED
+ TESTSubsystem.cpp
+ TESTSubsystemBinary.cpp
+ TESTSubsystemObject.cpp
+ TESTSubsystemString.cpp
+ TESTSubsystemBuilder.cpp)
+
+ include_directories(
+ "${PROJECT_SOURCE_DIR}/xmlserializer"
+ "${PROJECT_SOURCE_DIR}/remote-processor"
+ "${PROJECT_SOURCE_DIR}/parameter")
+
+ target_link_libraries(test-subsystem parameter)
+endif()
diff --git a/xmlserializer/XmlFileDocSink.cpp b/test/test-subsystem/TESTMappingKeys.h
similarity index 68%
rename from xmlserializer/XmlFileDocSink.cpp
rename to test/test-subsystem/TESTMappingKeys.h
index f73860c..90eb869 100644
--- a/xmlserializer/XmlFileDocSink.cpp
+++ b/test/test-subsystem/TESTMappingKeys.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -27,28 +27,10 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#pragma once
-#include "XmlFileDocSink.h"
-#include <libxml/parser.h>
-
-#define base CXmlDocSink
-
-CXmlFileDocSink::CXmlFileDocSink(const std::string& strXmlInstanceFile):
- _strXmlInstanceFile(strXmlInstanceFile)
-{
-}
-
-bool CXmlFileDocSink::doProcess(CXmlDocSource& xmlDocSource,
- CXmlSerializingContext& serializingContext)
-{
- // Write file (formatted)
- if (xmlSaveFormatFileEnc(_strXmlInstanceFile.c_str(),
- xmlDocSource.getDoc(), "UTF-8", 1) == -1) {
-
- serializingContext.setError("Could not write file " + _strXmlInstanceFile);
-
- return false;
- }
- return true;
-}
-
+// Mapping item types
+enum TESTItemType {
+ ETESTDirectory,
+ ETESTLog
+};
diff --git a/test/test-subsystem/TESTSubsystem.cpp b/test/test-subsystem/TESTSubsystem.cpp
new file mode 100644
index 0000000..214fbb7
--- /dev/null
+++ b/test/test-subsystem/TESTSubsystem.cpp
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2011-2015, Intel Corporation
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification,
+* are permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this
+* list of conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation and/or
+* other materials provided with the distribution.
+*
+* 3. Neither the name of the copyright holder nor the names of its contributors
+* may be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#include <fstream>
+#include <assert.h>
+#include "TESTSubsystem.h"
+#include "TESTSubsystemBinary.h"
+#include "TESTSubsystemString.h"
+#include "TESTMappingKeys.h"
+#include "SubsystemObjectFactory.h"
+#include <stdlib.h>
+#include <stdio.h>
+
+#define base CSubsystem
+
+// Directory for isAlive and NeedResync files
+const char* gacFwNamePropName = getenv("PFW_RESULT");
+
+// Implementation
+CTESTSubsystem::CTESTSubsystem(const std::string& strName) : base(strName)
+{
+ // Provide mapping keys to upper layer
+ addContextMappingKey("Directory");
+ addContextMappingKey("Log");
+
+ // Provide creators to upper layer
+ addSubsystemObjectFactory(new TSubsystemObjectFactory<CTESTSubsystemBinary>("Binary", 1 << ETESTDirectory));
+ addSubsystemObjectFactory(new TSubsystemObjectFactory<CTESTSubsystemString>("String", 1 << ETESTDirectory));
+}
+
+// Susbsystem sanity health
+bool CTESTSubsystem::isAlive() const
+{
+ assert(gacFwNamePropName != NULL);
+ return read(std::string(gacFwNamePropName) + "/isAlive") == "true";
+}
+
+// Resynchronization after subsystem restart needed
+bool CTESTSubsystem::needResync(bool bClear)
+{
+ assert(gacFwNamePropName != NULL);
+ std::string strNeedResyncFile = std::string(gacFwNamePropName) + "/needResync";
+ bool bNeedResync;
+
+ bNeedResync = read(strNeedResyncFile) == "true";
+
+ if (!bNeedResync) {
+
+ // subsystem does not need resync
+ return false;
+ } else {
+ // subsystem needs resync
+ // If indicated, clear need resync state
+ if (bClear) {
+
+ write(strNeedResyncFile, "false");
+ }
+
+ return true;
+ }
+}
+
+// Read boolean from file
+std::string CTESTSubsystem::read(const std::string& strFileName)
+{
+ std::ifstream file;
+ std::string strContent;
+
+ file.open(strFileName.c_str());
+
+ file >> strContent;
+
+ return strContent;
+}
+
+// Write boolean to file
+void CTESTSubsystem::write(const std::string& strFileName, const std::string& strContent)
+{
+ std::ofstream file;
+
+ file.open(strFileName.c_str());
+
+ assert(file.is_open());
+
+ file << strContent;
+}
diff --git a/test/test-subsystem/TESTSubsystem.h b/test/test-subsystem/TESTSubsystem.h
new file mode 100644
index 0000000..bcd0fbd
--- /dev/null
+++ b/test/test-subsystem/TESTSubsystem.h
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2011-2015, Intel Corporation
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification,
+* are permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this
+* list of conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation and/or
+* other materials provided with the distribution.
+*
+* 3. Neither the name of the copyright holder nor the names of its contributors
+* may be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#pragma once
+
+#include "Subsystem.h"
+
+class CTESTSubsystem : public CSubsystem
+{
+public:
+ CTESTSubsystem(const std::string& strName);
+
+ // Susbsystem sanity
+ virtual bool isAlive() const;
+ // Resynchronization after subsystem restart needed
+ virtual bool needResync(bool bClear);
+
+private:
+ // Read boolean from file
+ static std::string read(const std::string& strFileName);
+ // Write boolean to file
+ static void write(const std::string& strFileName, const std::string& strContent);
+};
diff --git a/test/test-subsystem/TESTSubsystemBinary.cpp b/test/test-subsystem/TESTSubsystemBinary.cpp
new file mode 100644
index 0000000..540fde8
--- /dev/null
+++ b/test/test-subsystem/TESTSubsystemBinary.cpp
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2011-2015, Intel Corporation
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification,
+* are permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this
+* list of conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation and/or
+* other materials provided with the distribution.
+*
+* 3. Neither the name of the copyright holder nor the names of its contributors
+* may be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#include <string.h>
+#include <sstream>
+#include <stdlib.h>
+#include <assert.h>
+#include "TESTSubsystemBinary.h"
+
+#define base CTESTSubsystemObject
+
+CTESTSubsystemBinary::CTESTSubsystemBinary(const std::string& strMappingValue, CInstanceConfigurableElement* pInstanceConfigurableElement, const CMappingContext& context)
+ : base(strMappingValue, pInstanceConfigurableElement, context)
+{
+}
+
+std::string CTESTSubsystemBinary::toString(const void* pvValue, uint32_t uiSize) const
+{
+ std::ostringstream strStream;
+ uint32_t uiValue = 0;
+
+ assert(uiSize <= sizeof(uiValue));
+
+ memcpy((void*)&uiValue, pvValue, uiSize);
+
+ strStream << "0x" << std::hex << uiValue;
+
+ return strStream.str();
+}
+
+void CTESTSubsystemBinary::fromString(const std::string& strValue, void* pvValue, uint32_t uiSize)
+{
+ uint32_t uiValue = strtoul(strValue.c_str(), NULL, 0);
+
+ assert(uiSize <= sizeof(uiValue));
+
+ memcpy(pvValue, (const void*)&uiValue, uiSize);
+}
diff --git a/test/test-subsystem/TESTSubsystemBinary.h b/test/test-subsystem/TESTSubsystemBinary.h
new file mode 100644
index 0000000..a8d433e
--- /dev/null
+++ b/test/test-subsystem/TESTSubsystemBinary.h
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2011-2015, Intel Corporation
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification,
+* are permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this
+* list of conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation and/or
+* other materials provided with the distribution.
+*
+* 3. Neither the name of the copyright holder nor the names of its contributors
+* may be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#pragma once
+
+#include "TESTSubsystemObject.h"
+
+class CTESTSubsystemBinary : public CTESTSubsystemObject
+{
+public:
+ CTESTSubsystemBinary(const std::string& strMappingValue, CInstanceConfigurableElement* pInstanceConfigurableElement, const CMappingContext& context);
+
+private:
+ // from CTESTSubsystemObject
+ // Format Data
+ virtual std::string toString(const void* pvValue, uint32_t uiSize) const;
+ virtual void fromString(const std::string& strValue, void* pvValue, uint32_t uiSize);
+
+};
diff --git a/test/test-subsystem/TESTSubsystemBuilder.cpp b/test/test-subsystem/TESTSubsystemBuilder.cpp
new file mode 100644
index 0000000..bcf2afc
--- /dev/null
+++ b/test/test-subsystem/TESTSubsystemBuilder.cpp
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2011-2015, Intel Corporation
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification,
+* are permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this
+* list of conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation and/or
+* other materials provided with the distribution.
+*
+* 3. Neither the name of the copyright holder nor the names of its contributors
+* may be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#include "SubsystemLibrary.h"
+#include "NamedElementBuilderTemplate.h"
+#include "TESTSubsystem.h"
+
+
+extern "C"
+{
+void getTESTSubsystemBuilder(CSubsystemLibrary* pSubsystemLibrary)
+{
+ pSubsystemLibrary->addElementBuilder("TEST",
+ new TNamedElementBuilderTemplate<CTESTSubsystem>());
+}
+}
diff --git a/test/test-subsystem/TESTSubsystemObject.cpp b/test/test-subsystem/TESTSubsystemObject.cpp
new file mode 100644
index 0000000..706053f
--- /dev/null
+++ b/test/test-subsystem/TESTSubsystemObject.cpp
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2011-2015, Intel Corporation
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification,
+* are permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this
+* list of conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation and/or
+* other materials provided with the distribution.
+*
+* 3. Neither the name of the copyright holder nor the names of its contributors
+* may be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#include <fstream>
+#include <alloca.h>
+#include "ParameterType.h"
+#include "MappingContext.h"
+#include "TESTMappingKeys.h"
+#include "InstanceConfigurableElement.h"
+#include "TESTSubsystemObject.h"
+
+#define base CSubsystemObject
+
+CTESTSubsystemObject::CTESTSubsystemObject(const std::string& strMappingValue, CInstanceConfigurableElement* pInstanceConfigurableElement, const CMappingContext& context)
+ : base(pInstanceConfigurableElement)
+{
+ (void)strMappingValue;
+ // Get actual element type
+ const CParameterType* pParameterType = static_cast<const CParameterType*>(pInstanceConfigurableElement->getTypeElement());
+
+ _uiScalarSize = pParameterType->getSize();
+ _uiArraySize = pInstanceConfigurableElement->getFootPrint() / _uiScalarSize;
+ _bIsScalar = pParameterType->isScalar();
+
+ _strFilePath = context.getItem(ETESTDirectory) + "/" + pInstanceConfigurableElement->getName();
+ _bLog = context.iSet(ETESTLog) && (context.getItem(ETESTLog) == "yes");
+}
+
+bool CTESTSubsystemObject::sendToHW(std::string& strError)
+{
+ std::ofstream outputFile;
+
+ outputFile.open(_strFilePath.c_str());
+
+ if (!outputFile.is_open()) {
+
+ strError = "Unable to open file: " + _strFilePath;
+
+ return false;
+ }
+
+ sendToFile(outputFile);
+
+ outputFile.close();
+
+ return true;
+}
+
+
+bool CTESTSubsystemObject::receiveFromHW(std::string& strError)
+{
+ (void)strError;
+ std::ifstream inputFile;
+
+ inputFile.open(_strFilePath.c_str());
+
+ if (!inputFile.is_open()) {
+
+ return true;
+ }
+
+ receiveFromFile(inputFile);
+
+ inputFile.close();
+ return true;
+}
+
+void CTESTSubsystemObject::sendToFile(std::ofstream& outputFile)
+{
+ uint32_t uiIndex;
+
+ for (uiIndex = 0 ; uiIndex < _uiArraySize ; uiIndex++) {
+
+ void* pvValue = alloca(_uiScalarSize);
+
+ // Read Value in BlackBoard
+ blackboardRead(pvValue, _uiScalarSize);
+
+ std::string strValue = toString(pvValue, _uiScalarSize);
+
+ outputFile << strValue << std::endl;
+
+ if (_bLog) {
+
+ if (_bIsScalar) {
+
+ log_info("TESTSUBSYSTEM: Writing \"%s\" to file %s", strValue.c_str(), _strFilePath.c_str());
+ } else {
+
+ log_info("TESTSUBSYSTEM: Writing \"%s\" to file %s[%d]", strValue.c_str(), _strFilePath.c_str(), uiIndex);
+ }
+ }
+ }
+}
+
+void CTESTSubsystemObject::receiveFromFile(std::ifstream& inputFile)
+{
+ uint32_t uiIndex;
+
+ for (uiIndex = 0 ; uiIndex < _uiArraySize ; uiIndex++) {
+
+ void* pvValue = alloca(_uiScalarSize);
+
+ std::string strValue;
+
+ inputFile >> strValue;
+
+ if (_bLog) {
+
+ if (_bIsScalar) {
+
+ log_info("TESTSUBSYSTEM: Writing \"%s\" from file %s", strValue.c_str(), _strFilePath.c_str());
+ } else {
+
+ log_info("TESTSUBSYSTEM: Writing \"%s\" from file %s[%d]", strValue.c_str(), _strFilePath.c_str(), uiIndex);
+ }
+ }
+
+ fromString(strValue, pvValue, _uiScalarSize);
+
+ // Write Value in Blackboard
+ blackboardWrite(pvValue, _uiScalarSize);
+ }
+}
diff --git a/test/test-subsystem/TESTSubsystemObject.h b/test/test-subsystem/TESTSubsystemObject.h
new file mode 100644
index 0000000..527e555
--- /dev/null
+++ b/test/test-subsystem/TESTSubsystemObject.h
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2011-2015, Intel Corporation
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification,
+* are permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this
+* list of conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation and/or
+* other materials provided with the distribution.
+*
+* 3. Neither the name of the copyright holder nor the names of its contributors
+* may be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#pragma once
+
+#include "SubsystemObject.h"
+
+class CMappingContext;
+
+class CTESTSubsystemObject : public CSubsystemObject
+{
+public:
+ CTESTSubsystemObject(const std::string& strMappingValue, CInstanceConfigurableElement* pInstanceConfigurableElement, const CMappingContext& context);
+
+protected:
+ // from CSubsystemObject
+ // Sync to/from HW
+ virtual bool sendToHW(std::string& strError);
+ virtual bool receiveFromHW(std::string& strError);
+
+private:
+ void sendToFile(std::ofstream& outputFile);
+ void receiveFromFile(std::ifstream& inputFile);
+ virtual std::string toString(const void* pvValue, uint32_t uiSize) const = 0;
+ virtual void fromString(const std::string& strValue, void* pvValue, uint32_t uiSize) = 0;
+
+protected:
+ uint32_t _uiScalarSize;
+ uint32_t _uiArraySize;
+ std::string _strFilePath;
+ bool _bLog;
+ bool _bIsScalar;
+};
diff --git a/test/test-subsystem/TESTSubsystemString.cpp b/test/test-subsystem/TESTSubsystemString.cpp
new file mode 100644
index 0000000..81ed793
--- /dev/null
+++ b/test/test-subsystem/TESTSubsystemString.cpp
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2011-2015, Intel Corporation
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification,
+* are permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this
+* list of conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation and/or
+* other materials provided with the distribution.
+*
+* 3. Neither the name of the copyright holder nor the names of its contributors
+* may be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#include <string.h>
+#include "TESTSubsystemString.h"
+
+#define base CTESTSubsystemObject
+
+CTESTSubsystemString::CTESTSubsystemString(const std::string& strMappingValue, CInstanceConfigurableElement* pInstanceConfigurableElement, const CMappingContext& context)
+ : base(strMappingValue, pInstanceConfigurableElement, context)
+{
+}
+
+std::string CTESTSubsystemString::toString(const void* pvValue, uint32_t uiSize) const
+{
+ (void)uiSize;
+
+ return (const char*)pvValue;
+}
+
+void CTESTSubsystemString::fromString(const std::string& strValue, void* pvValue, uint32_t uiSize)
+{
+ strncpy((char*)pvValue, strValue.c_str(), uiSize);
+}
diff --git a/test/test-subsystem/TESTSubsystemString.h b/test/test-subsystem/TESTSubsystemString.h
new file mode 100644
index 0000000..cf7edb7
--- /dev/null
+++ b/test/test-subsystem/TESTSubsystemString.h
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2011-2015, Intel Corporation
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification,
+* are permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this
+* list of conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation and/or
+* other materials provided with the distribution.
+*
+* 3. Neither the name of the copyright holder nor the names of its contributors
+* may be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#pragma once
+
+#include "TESTSubsystemObject.h"
+
+class CTESTSubsystemString : public CTESTSubsystemObject
+{
+public:
+ CTESTSubsystemString(const std::string& strMappingValue, CInstanceConfigurableElement* pInstanceConfigurableElement, const CMappingContext& context);
+
+private:
+ // from CTESTSubsystemObject
+ // Format Data
+ virtual std::string toString(const void* pvValue, uint32_t uiSize) const;
+ virtual void fromString(const std::string& strValue, void* pvValue, uint32_t uiSize);
+
+};
diff --git a/test/tokenizer/CMakeLists.txt b/test/tokenizer/CMakeLists.txt
new file mode 100644
index 0000000..8a00cb9
--- /dev/null
+++ b/test/tokenizer/CMakeLists.txt
@@ -0,0 +1,52 @@
+# Copyright (c) 2015, Intel Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its contributors
+# may be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+if(BUILD_TESTING)
+ # Add catch unit test framework
+ # TODO Use gtest as it is the team recommendation
+ # Unfortunately gtest is very hard to setup as not binary distributed
+ # catch is only one header so it is very easy
+ # Catch can be downloaded from:
+ # https://raw.github.com/philsquared/Catch/master/single_include/catch.hpp
+ # Then append the download folder to the CMAKE_INCLUDE_PATH variable or
+ # copy it in a standard location (/usr/include on most linux distribution).
+ find_path(CATCH_HEADER catch.hpp)
+ include_directories(${CATCH_HEADER})
+
+ # Add unit test
+ add_executable(tokenizerTest Test.cpp)
+
+ include_directories(${PROJECT_SOURCE_DIR}/utility)
+ target_link_libraries(tokenizerTest pfw_utility)
+
+ add_test(NAME tokenizerTest
+ COMMAND tokenizerTest)
+
+ # Custom function defined in the top-level CMakeLists
+ set_test_env(tokenizerTest)
+endif()
diff --git a/test/tokenizer/Test.cpp b/test/tokenizer/Test.cpp
new file mode 100644
index 0000000..14f9ea4
--- /dev/null
+++ b/test/tokenizer/Test.cpp
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2015, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "Tokenizer.h"
+
+#define CATCH_CONFIG_MAIN // This tells Catch to provide a main()
+#include <catch.hpp>
+
+#include <string>
+#include <vector>
+
+using std::string;
+using std::vector;
+
+SCENARIO("Tokenizer tests") {
+ GIVEN("A default tokenizer") {
+
+ GIVEN("A trivial string") {
+ Tokenizer tokenizer("a bcd ef");
+
+ THEN("next() api should work") {
+ CHECK(tokenizer.next() == "a");
+ CHECK(tokenizer.next() == "bcd");
+ CHECK(tokenizer.next() == "ef");
+ CHECK(tokenizer.next() == "");
+ }
+ THEN("split() api should work") {
+ vector<string> expected;
+ expected.push_back("a");
+ expected.push_back("bcd");
+ expected.push_back("ef");
+
+ CHECK(tokenizer.split() == expected);
+ }
+ }
+
+ GIVEN("An empty string") {
+ Tokenizer tokenizer("");
+
+ THEN("next() api should work") {
+ CHECK(tokenizer.next() == "");
+ }
+ THEN("split() api should work") {
+ vector<string> expected;
+
+ CHECK(tokenizer.split().empty());
+ }
+ }
+
+ GIVEN("A slash-separated string and tokenizer") {
+ Tokenizer tokenizer("/a/bcd/ef g/h/", "/");
+
+ THEN("next() api should work") {
+ CHECK(tokenizer.next() == "a");
+ CHECK(tokenizer.next() == "bcd");
+ CHECK(tokenizer.next() == "ef g");
+ CHECK(tokenizer.next() == "h");
+ CHECK(tokenizer.next() == "");
+ }
+ THEN("split() api should work") {
+ vector<string> expected;
+ expected.push_back("a");
+ expected.push_back("bcd");
+ expected.push_back("ef g");
+ expected.push_back("h");
+
+ CHECK(tokenizer.split() == expected);
+ }
+ }
+
+ GIVEN("Multiple separators in a row") {
+ Tokenizer tokenizer(" a \n\t bc ");
+
+ THEN("next() api should work") {
+ CHECK(tokenizer.next() == "a");
+ CHECK(tokenizer.next() == "bc");
+ CHECK(tokenizer.next() == "");
+ }
+ THEN("split() api should work") {
+ vector<string> expected;
+ expected.push_back("a");
+ expected.push_back("bc");
+
+ CHECK(tokenizer.split() == expected);
+ }
+ }
+ }
+
+}
diff --git a/tools/bash_completion/CMakeLists.txt b/tools/bash_completion/CMakeLists.txt
index 9e66d57..17ea55e 100644
--- a/tools/bash_completion/CMakeLists.txt
+++ b/tools/bash_completion/CMakeLists.txt
@@ -27,4 +27,4 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
INSTALL(FILES remote-process
- DESTINATION etc/bash_completion.d/)
+ DESTINATION share/bash-completion/completions/)
diff --git a/tools/coverage/aplog2coverage.sh b/tools/coverage/aplog2coverage.sh
index 0f0d76e..5e0e59c 100755
--- a/tools/coverage/aplog2coverage.sh
+++ b/tools/coverage/aplog2coverage.sh
@@ -54,6 +54,7 @@
# Default values
outputFile="-"
coverage_report_generator_ignorable_errors="\
+--ignore-unknown-criterion \
--ignore-incoherent-criterion-state \
--ignore-ineligible-configuration-application"
coverage_report_generator_options=""
diff --git a/tools/coverage/coverage.py b/tools/coverage/coverage.py
index 1df02ae..0a23285 100755
--- a/tools/coverage/coverage.py
+++ b/tools/coverage/coverage.py
@@ -59,11 +59,11 @@
class ChildNotFoundError(ChildError):
def __str__(self):
- return "Unable to find the child %s in %s" % (self.child, self.parent)
+ return 'Unable to find the child "%s" in "%s"' % (self.child, self.parent)
class DuplicatedChildError(ChildError):
def __str__(self):
- return "Add existing child %s in %s." % (self.child, self.parent)
+ return 'Add existing child "%s" in "%s".' % (self.child, self.parent)
class Element():
"""Root class for all coverage elements"""
@@ -109,7 +109,7 @@
if child.getName() == childName :
return child
- self.debug("Child %s not found" % childName, logging.ERROR)
+ self.debug('Child "%s" not found' % childName, logging.ERROR)
self.debug("Child list :")
@@ -720,6 +720,14 @@
MATCH = "match"
ACTION = "action"
+ class ChangeRequestOnUnknownCriterion(CustomError):
+ def __init__(self, criterion):
+ self.criterion = criterion
+
+ def __str__(self):
+ return ("Change request on an unknown criterion %s." %
+ self.criterion)
+
def __init__(self, domains, criteria, ErrorsToIgnore=()):
self.domains = domains;
@@ -802,7 +810,10 @@
path = [criterionName]
changeCriterionOperation = lambda criterion : criterion.changeState(newCriterionState)
- self.criteria.operationOnChild(path, changeCriterionOperation)
+ try:
+ self.criteria.operationOnChild(path, changeCriterionOperation)
+ except ChildNotFoundError:
+ raise self.ChangeRequestOnUnknownCriterion(criterionName)
def _configApplication(self, matchConfig):
# Unpack
@@ -834,7 +845,7 @@
def parsePFWlog(self, lines):
- for lineNb, lineLog in enumerate(lines):
+ for lineNb, lineLog in enumerate(lines, 1): # line number starts at 1
logger.debug("Parsing line :%s" % lineLog.rstrip())
@@ -968,6 +979,13 @@
)
myArgParser.add_argument(
+ '--ignore-unknown-criterion',
+ dest="unknwonCriterionFlag",
+ action='store_true',
+ help="ignore unknown criterion"
+ )
+
+ myArgParser.add_argument(
'--ignore-incoherent-criterion-state',
dest="incoherentCriterionFlag",
action='store_true',
@@ -1005,6 +1023,9 @@
if options.incoherentCriterionFlag:
errorToIgnore.append(Criterion.ChangeRequestToNonAccessibleState)
+ if options.unknwonCriterionFlag:
+ errorToIgnore.append(ParsePFWlog.ChangeRequestOnUnknownCriterion)
+
self.errorToIgnore = tuple(errorToIgnore)
diff --git a/tools/xmlGenerator/Android.mk b/tools/xmlGenerator/Android.mk
index 549668a..43256ed 100644
--- a/tools/xmlGenerator/Android.mk
+++ b/tools/xmlGenerator/Android.mk
@@ -74,7 +74,7 @@
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_IS_HOST_MODULE := true
LOCAL_REQUIRED_MODULES := \
- _PyPfw \
+ _PyPfw_32 \
EddParser.py \
PfwBaseTranslator.py \
hostConfig.py
diff --git a/tools/xmlGenerator/domainGenerator.py b/tools/xmlGenerator/domainGenerator.py
index 88c4b02..427c8d5 100755
--- a/tools/xmlGenerator/domainGenerator.py
+++ b/tools/xmlGenerator/domainGenerator.py
@@ -136,19 +136,20 @@
argparser.add_argument('--initial-settings',
help="Initial XML settings file (containing a \
<ConfigurableDomains> tag",
+ nargs='?',
metavar="XML_SETTINGS_FILE")
argparser.add_argument('--add-domains',
help="List of single domain files (each containing a single \
<ConfigurableDomain> tag",
metavar="XML_DOMAIN_FILE",
- nargs='+',
+ nargs='*',
dest='xml_domain_files',
default=[])
argparser.add_argument('--add-edds',
help="List of files in EDD syntax (aka \".pfw\" files)",
metavar="EDD_FILE",
type=argparse.FileType('r'),
- nargs='+',
+ nargs='*',
default=[],
dest='edd_files')
argparser.add_argument('--schemas-dir',
@@ -303,7 +304,8 @@
# Import each standalone domain files
for domain_file in args.xml_domain_files:
logging.info("Importing single domain file {}".format(domain_file))
- ok, error = pfw.importSingleDomainXml(os.path.realpath(domain_file), False)
+ ok, error = pfw.importSingleDomainXml(os.path.realpath(domain_file),
+ False, True, True)
if not ok:
logging.critical(error)
exit(1)
diff --git a/utility/Android.mk b/utility/Android.mk
index 25a99a7..acafaef 100644
--- a/utility/Android.mk
+++ b/utility/Android.mk
@@ -34,7 +34,8 @@
common_src_files := \
Tokenizer.cpp \
Utility.cpp \
- NaiveTokenizer.cpp
+ NaiveTokenizer.cpp \
+ FullIo.cpp \
common_module := libpfw_utility
common_module_tags := optional
diff --git a/utility/CMakeLists.txt b/utility/CMakeLists.txt
index 9f81027..5386f5b 100644
--- a/utility/CMakeLists.txt
+++ b/utility/CMakeLists.txt
@@ -29,6 +29,7 @@
add_library(pfw_utility STATIC
Tokenizer.cpp
Utility.cpp
+ FullIo.cpp
NaiveTokenizer.cpp)
# '-fPIC' needed for linking against shared libraries (e.g. libparameter)
diff --git a/utility/FullIo.cpp b/utility/FullIo.cpp
new file mode 100644
index 0000000..59765b5
--- /dev/null
+++ b/utility/FullIo.cpp
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2015, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "FullIo.hpp"
+
+#include <cerrno>
+#include <unistd.h>
+
+namespace utility
+{
+
+/** Workaround c++ `void *` arithmetic interdiction. */
+template <class Ptr>
+Ptr *add(Ptr *ptr, size_t count) {
+ return (char *)ptr + count;
+}
+
+template <class Buff>
+static bool fullAccess(ssize_t (&accessor)(int, Buff, size_t),
+ bool (&accessFailed)(ssize_t),
+ int fd, Buff buf, size_t count) {
+ size_t done = 0; // Bytes already access in previous iterations
+ while (done < count) {
+ ssize_t accessed = accessor(fd, add(buf, done), count - done);
+ if (accessFailed(accessed)) {
+ return false;
+ }
+ done += accessed;
+ }
+ return true;
+}
+
+static bool accessFailed(ssize_t accessRes) {
+ return accessRes == -1 and errno != EAGAIN and errno != EINTR;
+}
+
+bool fullWrite(int fd, const void *buf, size_t count) {
+ return fullAccess(::write, accessFailed, fd, buf, count);
+}
+
+static bool readFailed(ssize_t readRes) {
+ if (readRes == 0) { // read should not return 0 (EOF)
+ errno = 0;
+ return true;
+ }
+ return accessFailed(readRes);
+}
+bool fullRead(int fd, void *buf, size_t count) {
+ return fullAccess(::read, readFailed, fd, buf, count);
+}
+
+} // namespace utility
+
diff --git a/utility/FullIo.hpp b/utility/FullIo.hpp
new file mode 100644
index 0000000..353551d
--- /dev/null
+++ b/utility/FullIo.hpp
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2015, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <cstddef>
+
+namespace utility
+{
+
+/** Write *completely* a buffer in a file descriptor.
+ *
+ * A wrapper around unistd::write that resumes write on incomplete access
+ * and EAGAIN/EINTR error.
+ *
+ * @see man 2 write for the parameters.
+ *
+ * @return true if the buffer could be completely written,
+ * false on failure (see write's man errno section).
+ */
+bool fullWrite(int fd, const void *buf, size_t count);
+
+/** Fill a buffer from a file descriptor.
+ *
+ * A wrapper around unistd::read that resumes read on incomplete access
+ * and EAGAIN/EINTR error.
+ *
+ * @see man 2 read for the parameters.
+ *
+ * @return true if the buffer could be completely fill,
+ * false on failure (see read's man errno section).
+ *
+ * If the buffer could not be filled due to an EOF, return false but set
+ * errno to 0.
+ * @TODO Add a custom strerror to prevent logging "success" (`sterror(0)`) on
+ * EOF errors ?
+ */
+bool fullRead(int fd, void *buf, size_t count);
+
+} // namespace utility
+
diff --git a/utility/NaiveTokenizer.h b/utility/NaiveTokenizer.h
index 2558e37..67abc9a 100644
--- a/utility/NaiveTokenizer.h
+++ b/utility/NaiveTokenizer.h
@@ -28,6 +28,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#pragma once
+
class NaiveTokenizer {
public:
/** tokenize a space-separated string, handling quotes
diff --git a/utility/Tokenizer.cpp b/utility/Tokenizer.cpp
index 9ea4ea4..a4cfcf0 100644
--- a/utility/Tokenizer.cpp
+++ b/utility/Tokenizer.cpp
@@ -1,125 +1,75 @@
-///////////////////////////////////////////////////////////////////////////////
-// Tokenizer.cpp
-// =============
-// General purpose string tokenizer (C++ string version)
-//
-// The default delimiters are space(" "), tab(\t, \v), newline(\n),
-// carriage return(\r), and form feed(\f).
-// If you want to use different delimiters, then use setDelimiter() to override
-// the delimiters. Note that the delimiter string can hold multiple characters.
-//
-// AUTHOR: Song Ho Ahn (song.ahn@gmail.com)
-// CREATED: 2005-05-25
-// UPDATED: 2011-03-08
-///////////////////////////////////////////////////////////////////////////////
-
-#include "Tokenizer.h"
-
-
-///////////////////////////////////////////////////////////////////////////////
-// constructor
-///////////////////////////////////////////////////////////////////////////////
-Tokenizer::Tokenizer() : buffer(""), token(""), delimiter(DEFAULT_DELIMITER)
-{
- currPos = buffer.begin();
-}
-
-Tokenizer::Tokenizer(const std::string& str, const std::string& delimiter) : buffer(str), token(""), delimiter(delimiter)
-{
- currPos = buffer.begin();
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////////
-// destructor
-///////////////////////////////////////////////////////////////////////////////
-Tokenizer::~Tokenizer()
-{
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////////
-// reset string buffer, delimiter and the currsor position
-///////////////////////////////////////////////////////////////////////////////
-void Tokenizer::set(const std::string& str, const std::string& delimiter)
-{
- this->buffer = str;
- this->delimiter = delimiter;
- this->currPos = buffer.begin();
-}
-
-void Tokenizer::setString(const std::string& str)
-{
- this->buffer = str;
- this->currPos = buffer.begin();
-}
-
-void Tokenizer::setDelimiter(const std::string& delimiter)
-{
- this->delimiter = delimiter;
- this->currPos = buffer.begin();
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////////
-// return the next token
-// If cannot find a token anymore, return "".
-///////////////////////////////////////////////////////////////////////////////
-std::string Tokenizer::next()
-{
- if(buffer.size() <= 0) return ""; // skip if buffer is empty
-
- token.clear(); // reset token string
-
- this->skipDelimiter(); // skip leading delimiters
-
- // append each char to token string until it meets delimiter
- while(currPos != buffer.end() && !isDelimiter(*currPos))
- {
- token += *currPos;
- ++currPos;
- }
- return token;
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////////
-// skip ang leading delimiters
-///////////////////////////////////////////////////////////////////////////////
-void Tokenizer::skipDelimiter()
-{
- while(currPos != buffer.end() && isDelimiter(*currPos))
- ++currPos;
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////////
-// return true if the current character is delimiter
-///////////////////////////////////////////////////////////////////////////////
-bool Tokenizer::isDelimiter(char c)
-{
- return (delimiter.find(c) != std::string::npos);
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////////
-// split the input string into multiple tokens
-// This function scans tokens from the current cursor position.
-///////////////////////////////////////////////////////////////////////////////
-std::vector<std::string> Tokenizer::split()
-{
- std::vector<std::string> tokens;
- std::string token;
- while((token = this->next()) != "")
- {
- tokens.push_back(token);
- }
-
- return tokens;
-}
+/*
+ * Copyright (c) 2015, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "Tokenizer.h"
+
+using std::string;
+using std::vector;
+
+const string Tokenizer::defaultDelimiters = " \n\r\t\v\f";
+
+Tokenizer::Tokenizer(const string &input, const string &delimiters)
+ : _input(input), _delimiters(delimiters), _position(0)
+{
+}
+
+string Tokenizer::next()
+{
+ string token;
+
+ // Skip all leading delimiters
+ string::size_type tokenStart = _input.find_first_not_of(_delimiters, _position);
+
+ // Special case if there isn't any token anymore (string::substr's
+ // throws when pos==npos)
+ if (tokenStart == string::npos) {
+ return "";
+ }
+
+ // Starting from the token's start, find the first delimiter
+ string::size_type tokenEnd = _input.find_first_of(_delimiters, tokenStart);
+
+ _position = tokenEnd;
+
+ return _input.substr(tokenStart, tokenEnd - tokenStart);
+}
+
+vector<string> Tokenizer::split()
+{
+ vector<string> result;
+ string token;
+
+ while (true) {
+ token = next();
+ if (token.empty()) {
+ return result;
+ }
+ result.push_back(token);
+ }
+}
diff --git a/utility/Tokenizer.h b/utility/Tokenizer.h
index de3f86c..c48747a 100644
--- a/utility/Tokenizer.h
+++ b/utility/Tokenizer.h
@@ -1,56 +1,75 @@
-///////////////////////////////////////////////////////////////////////////////
-// Tokenizer.h
-// ===========
-// General purpose string tokenizer (C++ string version)
-//
-// The default delimiters are space(" "), tab(\t, \v), newline(\n),
-// carriage return(\r), and form feed(\f).
-// If you want to use different delimiters, then use setDelimiter() to override
-// the delimiters. Note that the delimiter string can hold multiple characters.
-//
-// AUTHOR: Song Ho Ahn (song.ahn@gmail.com)
-// CREATED: 2005-05-25
-// UPDATED: 2011-03-08
-///////////////////////////////////////////////////////////////////////////////
-
-#ifndef TOKENIZER_H
-#define TOKENIZER_H
-
-#include <string>
+/*
+ * Copyright (c) 2015, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#pragma once
+
+#include <string>
#include <vector>
-
-// default delimiter string (space, tab, newline, carriage return, form feed)
-const std::string DEFAULT_DELIMITER = " \t\v\n\r\f";
-
-class Tokenizer
-{
-public:
- // ctor/dtor
- Tokenizer();
- Tokenizer(const std::string& str, const std::string& delimiter=DEFAULT_DELIMITER);
- ~Tokenizer();
-
- // set string and delimiter
- void set(const std::string& str, const std::string& delimiter=DEFAULT_DELIMITER);
- void setString(const std::string& str); // set source string only
- void setDelimiter(const std::string& delimiter); // set delimiter string only
-
- std::string next(); // return the next token, return "" if it ends
-
- std::vector<std::string> split(); // return array of tokens from current cursor
-
-protected:
-
-
-private:
- void skipDelimiter(); // ignore leading delimiters
- bool isDelimiter(char c); // check if the current char is delimiter
-
- std::string buffer; // input string
- std::string token; // output string
- std::string delimiter; // delimiter string
- std::string::const_iterator currPos; // string iterator pointing the current position
-
-};
-
-#endif // TOKENIZER_H
+
+/** Tokenizer class
+ *
+ * Must be initialized with a string to be tokenized and, optionally, a string
+ * of delimiters (@see Tokenizer::defaultDelimiters).
+ *
+ * Multiple consecutive delimiters (even if different) are considered as a
+ * single one. As a result, there can't be empty tokens.
+ */
+class Tokenizer
+{
+public:
+ /** Constructs a Tokenizer
+ *
+ * @param[in] input The string to be tokenized
+ * @param[in] delimiters A string containing all the token delimiters
+ * (hence, each delimiter can only be a single character)
+ */
+ Tokenizer(const std::string &input, const std::string &delimiters=defaultDelimiters);
+ ~Tokenizer() {};
+
+ /** Return the next token or an empty string if no more token
+ *
+ * Multiple consecutive delimiters are considered as a single one - i.e.
+ * "a bc d " will be tokenized as ("a", "bc", "d") if the delimiter
+ * is ' '.
+ */
+ std::string next();
+
+ /** Return a vector of all tokens
+ */
+ std::vector<std::string> split();
+
+ /** Default list of delimiters (" \n\r\t\v\f") */
+ static const std::string defaultDelimiters;
+
+private:
+ const std::string _input; //< string to be tokenized
+ const std::string _delimiters; //< token delimiters
+
+ std::string::size_type _position; //< end of the last returned token
+};
diff --git a/utility/Utility.cpp b/utility/Utility.cpp
index dc0bce1..e5f689a 100644
--- a/utility/Utility.cpp
+++ b/utility/Utility.cpp
@@ -32,6 +32,7 @@
#include <sstream>
#include <iterator>
+#include <stdint.h>
using std::string;
@@ -72,3 +73,15 @@
CUtility::asString(listKeysValues, strOutput, strItemSeparator);
}
+void CUtility::appendTitle(string& strTo, const string& strTitle)
+{
+ strTo += "\n" + strTitle + "\n";
+
+ uint32_t uiLength = strTitle.size();
+
+ while (uiLength--) {
+
+ strTo += "=";
+ }
+ strTo += "\n";
+}
diff --git a/utility/Utility.h b/utility/Utility.h
index 4a98105..93acd82 100644
--- a/utility/Utility.h
+++ b/utility/Utility.h
@@ -28,12 +28,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef UTILITY_H
-#define UTILITY_H
+#pragma once
#include <string>
#include <list>
#include <map>
+#include <sstream>
class CUtility
{
@@ -63,6 +63,21 @@
std::string& strOutput,
const std::string& strItemSeparator = ", ",
const std::string& strKeyValueSeparator = ":");
-};
-#endif // UTILITY_H
+ /** Utility to easily convert a builtin type into string
+ *
+ * FIXME: Should be replaced by std::to_string after C++11 introduction
+ */
+ template <class T>
+ static std::string toString(T uiValue)
+ {
+ std::ostringstream ostr;
+
+ ostr << uiValue;
+
+ return ostr.str();
+ }
+
+ /** Utility to underline */
+ static void appendTitle(std::string& strTo, const std::string& strTitle);
+};
diff --git a/utility/convert.hpp b/utility/convert.hpp
old mode 100755
new mode 100644
diff --git a/xmlserializer/Android.mk b/xmlserializer/Android.mk
index 0f84ece..2c66caf 100644
--- a/xmlserializer/Android.mk
+++ b/xmlserializer/Android.mk
@@ -37,10 +37,7 @@
XmlDocSource.cpp \
XmlMemoryDocSink.cpp \
XmlMemoryDocSource.cpp \
- XmlStringDocSink.cpp \
- XmlFileDocSink.cpp \
- XmlFileDocSource.cpp \
- XmlStringDocSource.cpp
+ XmlStreamDocSink.cpp \
common_module := libxmlserializer
@@ -66,6 +63,8 @@
LOCAL_SRC_FILES := $(common_src_files)
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+
LOCAL_MODULE := $(common_module)
LOCAL_MODULE_OWNER := intel
LOCAL_MODULE_TAGS := $(common_module_tags)
@@ -80,10 +79,10 @@
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
ifeq ($(INCLUDE_STLPORT), true)
-include external/stlport/libstlport.mk
+ include external/stlport/libstlport.mk
endif
-include $(BUILD_STATIC_LIBRARY)
+include $(BUILD_SHARED_LIBRARY)
##############################
# Host build
@@ -92,6 +91,8 @@
LOCAL_SRC_FILES := $(common_src_files)
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+
LOCAL_MODULE := $(common_module)_host
LOCAL_MODULE_OWNER := intel
LOCAL_MODULE_TAGS := $(common_module_tags)
@@ -105,22 +106,5 @@
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-include $(BUILD_HOST_STATIC_LIBRARY)
+include $(BUILD_HOST_SHARED_LIBRARY)
-################################
-# Export includes for plugins (Target build)
-include $(CLEAR_VARS)
-LOCAL_MODULE := $(common_module)_includes
-LOCAL_MODULE_OWNER := intel
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-LOCAL_STATIC_LIBRARIES := libxml2
-include $(BUILD_STATIC_LIBRARY)
-
-################################
-# Export includes for plugins (Host build)
-include $(CLEAR_VARS)
-LOCAL_MODULE := $(common_module)_includes
-LOCAL_MODULE_OWNER := intel
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-LOCAL_STATIC_LIBRARIES := libxml2
-include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/xmlserializer/CMakeLists.txt b/xmlserializer/CMakeLists.txt
index 074bbcc..be068c9 100644
--- a/xmlserializer/CMakeLists.txt
+++ b/xmlserializer/CMakeLists.txt
@@ -32,10 +32,7 @@
XmlDocSource.cpp
XmlMemoryDocSink.cpp
XmlMemoryDocSource.cpp
- XmlStringDocSink.cpp
- XmlFileDocSink.cpp
- XmlFileDocSource.cpp
- XmlStringDocSource.cpp)
+ XmlStreamDocSink.cpp)
include(FindLibXml2)
if(NOT LIBXML2_FOUND)
diff --git a/xmlserializer/XmlDocSource.cpp b/xmlserializer/XmlDocSource.cpp
index 35a8f4e..90a30ac 100644
--- a/xmlserializer/XmlDocSource.cpp
+++ b/xmlserializer/XmlDocSource.cpp
@@ -31,6 +31,9 @@
#include "XmlDocSource.h"
#include <libxml/tree.h>
#include <libxml/xmlschemas.h>
+#include <libxml/parser.h>
+#include <libxml/xinclude.h>
+#include <libxml/xmlerror.h>
#include <stdlib.h>
using std::string;
@@ -38,65 +41,30 @@
// Schedule for libxml2 library
bool CXmlDocSource::_bLibXml2CleanupScheduled;
-CXmlDocSource::CXmlDocSource(_xmlDoc *pDoc, _xmlNode *pRootNode,
- bool bValidateWithSchema) :
+CXmlDocSource::CXmlDocSource(_xmlDoc *pDoc, bool bValidateWithSchema,
+ _xmlNode *pRootNode) :
_pDoc(pDoc),
_pRootNode(pRootNode),
_strXmlSchemaFile(""),
_strRootElementType(""),
_strRootElementName(""),
- _strNameAttrituteName(""),
- _bNameCheck(false),
+ _strNameAttributeName(""),
_bValidateWithSchema(bValidateWithSchema)
{
init();
}
-CXmlDocSource::CXmlDocSource(_xmlDoc *pDoc,
+CXmlDocSource::CXmlDocSource(_xmlDoc *pDoc, bool bValidateWithSchema,
const string& strXmlSchemaFile,
const string& strRootElementType,
const string& strRootElementName,
- const string& strNameAttrituteName) :
+ const string& strNameAttributeName) :
_pDoc(pDoc),
- _pRootNode(NULL),
+ _pRootNode(xmlDocGetRootElement(pDoc)),
_strXmlSchemaFile(strXmlSchemaFile),
_strRootElementType(strRootElementType),
_strRootElementName(strRootElementName),
- _strNameAttrituteName(strNameAttrituteName),
- _bNameCheck(true),
- _bValidateWithSchema(false)
-{
- init();
-}
-
-CXmlDocSource::CXmlDocSource(_xmlDoc* pDoc,
- const string& strXmlSchemaFile,
- const string& strRootElementType,
- bool bValidateWithSchema) :
- _pDoc(pDoc), _pRootNode(NULL),
- _strXmlSchemaFile(strXmlSchemaFile),
- _strRootElementType(strRootElementType),
- _strRootElementName(""),
- _strNameAttrituteName(""),
- _bNameCheck(false),
- _bValidateWithSchema(bValidateWithSchema)
-{
- init();
-}
-
-CXmlDocSource::CXmlDocSource(_xmlDoc *pDoc,
- const string& strXmlSchemaFile,
- const string& strRootElementType,
- const string& strRootElementName,
- const string& strNameAttrituteName,
- bool bValidateWithSchema) :
- _pDoc(pDoc),
- _pRootNode(NULL),
- _strXmlSchemaFile(strXmlSchemaFile),
- _strRootElementType(strRootElementType),
- _strRootElementName(strRootElementName),
- _strNameAttrituteName(strNameAttrituteName),
- _bNameCheck(true),
+ _strNameAttributeName(strNameAttributeName),
_bValidateWithSchema(bValidateWithSchema)
{
init();
@@ -133,6 +101,18 @@
return _pDoc;
}
+bool CXmlDocSource::isParsable() const
+{
+ // Check that the doc has been created
+ return _pDoc != NULL;
+}
+
+bool CXmlDocSource::populate(CXmlSerializingContext& serializingContext)
+{
+ return validate(serializingContext);
+
+}
+
bool CXmlDocSource::validate(CXmlSerializingContext& serializingContext)
{
// Check that the doc has been created
@@ -164,9 +144,9 @@
return false;
}
- if (_bNameCheck) {
+ if (!_strNameAttributeName.empty()) {
- string strRootElementNameCheck = getRootElementAttributeString(_strNameAttrituteName);
+ string strRootElementNameCheck = getRootElementAttributeString(_strNameAttributeName);
// Check Root element name attribute (if any)
if (!_strRootElementName.empty() && strRootElementNameCheck != _strRootElementName) {
@@ -193,11 +173,6 @@
_bLibXml2CleanupScheduled = true;
}
-
- if (!_pRootNode) {
-
- _pRootNode = xmlDocGetRootElement(_pDoc);
- }
}
bool CXmlDocSource::isInstanceDocumentValid()
@@ -264,3 +239,40 @@
puts(pError->message);
#endif
}
+
+_xmlDoc* CXmlDocSource::mkXmlDoc(const string& source, bool fromFile, bool xincludes, string& errorMsg)
+{
+ _xmlDoc* doc = NULL;
+ if (fromFile) {
+ doc = xmlReadFile(source.c_str(), NULL, 0);
+ } else {
+ doc = xmlReadMemory(source.c_str(), (int)source.size(), "", NULL, 0);
+ }
+
+ if (doc == NULL) {
+ errorMsg = "libxml failed to read";
+ if (fromFile) {
+ errorMsg += " \"" + source + "\"";
+ }
+
+ xmlError* details = xmlGetLastError();
+ if (details != NULL) {
+ errorMsg += ": " + string(details->message);
+ }
+
+ return NULL;
+ }
+
+ if (xincludes and (xmlXIncludeProcess(doc) < 0)) {
+ errorMsg = "libxml failed to resolve XIncludes";
+ xmlError* details = xmlGetLastError();
+ if (details != NULL) {
+ errorMsg += ": " + string(details->message);
+ }
+
+ xmlFreeDoc(doc);
+ doc = NULL;
+ }
+
+ return doc;
+}
diff --git a/xmlserializer/XmlDocSource.h b/xmlserializer/XmlDocSource.h
index e7be8f3..e41923e 100644
--- a/xmlserializer/XmlDocSource.h
+++ b/xmlserializer/XmlDocSource.h
@@ -54,22 +54,7 @@
* @param[in] pRootNode a pointer to the root element of the document.
* @param[in] bValidateWithSchema a boolean that toggles schema validation
*/
- CXmlDocSource(_xmlDoc* pDoc, _xmlNode* pRootNode = NULL, bool bValidateWithSchema = false);
-
- /**
- * Constructor
- *
- * @param[out] pDoc a pointer to the xml document that will be filled by the class
- * @param[in] strXmlSchemaFile a std::string containing the path to the schema file
- * @param[in] strRootElementType a std::string containing the root element type
- * @param[in] strRootElementName a std::string containing the root element name
- * @param[in] strNameAttributeName a std::string containing the name of the root name attribute
- */
- CXmlDocSource(_xmlDoc* pDoc,
- const std::string& strXmlSchemaFile,
- const std::string& strRootElementType,
- const std::string& strRootElementName,
- const std::string& strNameAttrituteName);
+ CXmlDocSource(_xmlDoc* pDoc, bool bValidateWithSchema = false, _xmlNode* pRootNode = NULL);
/**
* Constructor
@@ -81,22 +66,11 @@
* @param[in] strNameAttributeName a string containing the name of the root name attribute
* @param[in] bValidateWithSchema a boolean that toggles schema validation
*/
- CXmlDocSource(_xmlDoc* pDoc,
- const std::string& strXmlSchemaFile,
- const std::string& strRootElementType,
- const std::string& strRootElementName,
- const std::string& strNameAttrituteName,
- bool bValidateWithSchema);
-
- /**
- * Constructor
- *
- * @param[out] pDoc a pointer to the xml document that will be filled by the class
- * @param[in] strXmlSchemaFile a string containing the path to the schema file
- * @param[in] strRootElementType a string containing the root element type
- */
- CXmlDocSource(_xmlDoc* pDoc, const std::string& strXmlSchemaFile, const std::string& strRootElementType,
- bool bValidateWithSchema);
+ CXmlDocSource(_xmlDoc* pDoc, bool bValidateWithSchema,
+ const std::string& strXmlSchemaFile = "",
+ const std::string& strRootElementType = "",
+ const std::string& strRootElementName = "",
+ const std::string& strNameAttributeName = "");
/**
* Destructor
@@ -110,7 +84,7 @@
*
* @return false if there are any error
*/
- virtual bool populate(CXmlSerializingContext& serializingContext) = 0;
+ virtual bool populate(CXmlSerializingContext& serializingContext);
/**
* Method that returns the root element of the Xml tree.
@@ -154,6 +128,24 @@
*/
virtual bool validate(CXmlSerializingContext& serializingContext);
+ /**
+ * Method that checks that the xml document has been correctly parsed.
+ *
+ * @return false if any error occurs during the parsing
+ */
+ virtual bool isParsable() const;
+
+ /**
+ * Helper method for creating an xml document from either a file or a
+ * string.
+ *
+ * @param[in] source either a filename or a string representing an xml document
+ * @param[in] fromFile true if source is a filename, false if source is an xml
+ * represents an xml document
+ * @param[in] xincludes if true, process xincludes tags
+ * @param[out] errorMsg used as error output
+ */
+ static _xmlDoc* mkXmlDoc(const std::string& source, bool fromFile, bool xincludes, std::string& errorMsg);
protected:
@@ -210,12 +202,7 @@
/**
* Element name attribute info
*/
- std::string _strNameAttrituteName;
-
- /**
- * Boolean that enables the root element name attribute check
- */
- bool _bNameCheck;
+ std::string _strNameAttributeName;
/**
* Boolean that enables the validation via xsd files
diff --git a/xmlserializer/XmlElement.cpp b/xmlserializer/XmlElement.cpp
index d45f360..425e041 100644
--- a/xmlserializer/XmlElement.cpp
+++ b/xmlserializer/XmlElement.cpp
@@ -175,10 +175,10 @@
return false;
}
-uint32_t CXmlElement::getNbChildElements() const
+size_t CXmlElement::getNbChildElements() const
{
CXmlElement childElement;
- uint32_t uiNbChildren = 0;
+ size_t uiNbChildren = 0;
CChildIterator childIterator(*this);
@@ -238,11 +238,6 @@
xmlAddChild(_pXmlElement, xmlNewText(BAD_CAST strContent.c_str()));
}
-void CXmlElement::setComment(const string& strComment)
-{
- xmlAddChild(_pXmlElement, xmlNewComment(BAD_CAST strComment.c_str()));
-}
-
// Child creation
void CXmlElement::createChild(CXmlElement& childElement, const string& strType)
{
diff --git a/xmlserializer/XmlElement.h b/xmlserializer/XmlElement.h
index 7c1d518..afa8438 100644
--- a/xmlserializer/XmlElement.h
+++ b/xmlserializer/XmlElement.h
@@ -61,7 +61,7 @@
// Navigation
bool getChildElement(const std::string& strType, CXmlElement& childElement) const;
bool getChildElement(const std::string& strType, const std::string& strNameAttribute, CXmlElement& childElement) const;
- uint32_t getNbChildElements() const;
+ size_t getNbChildElements() const;
bool getParentElement(CXmlElement& parentElement) const;
// Setters
@@ -69,7 +69,6 @@
void setAttributeString(const std::string& strAttributeName, const std::string& strValue);
void setNameAttribute(const std::string& strValue);
void setTextContent(const std::string& strContent);
- void setComment(const std::string& strComment);
void setAttributeInteger(const std::string& strAttributeName, uint32_t uiValue);
/**
* Set attribute with signed integer
diff --git a/xmlserializer/XmlFileDocSink.h b/xmlserializer/XmlFileDocSink.h
deleted file mode 100644
index 6063e6a..0000000
--- a/xmlserializer/XmlFileDocSink.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2011-2014, Intel Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its contributors
- * may be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-#include "XmlDocSink.h"
-#include <string>
-
-/**
- * Sink class that save the content of any CXmlDocSource into a file.
- * The file path is defined in the constructor.
- */
-class CXmlFileDocSink : public CXmlDocSink
-{
-public:
- /**
- * Constructor
- *
- * @param[in] strXmlInstanceFile defines the path used to save the file.
- */
- CXmlFileDocSink(const std::string& strXmlInstanceFile);
-
-private:
- /**
- * Implementation of CXmlDocSink::doProcess()
- * Write the content of the xmlDocSource to the file opened in strXmlInstanceFile using
- * UTF-8 encoding
- *
- * @param[in] xmlDocSource is the source containing the Xml document
- * @param[out] serializingContext is used as error output
- *
- * @return false if any error occurs
- */
- virtual bool doProcess(CXmlDocSource& xmlDocSource, CXmlSerializingContext& serializingContext);
-
- /**
- * Name of the instance file
- */
- std::string _strXmlInstanceFile;
-};
diff --git a/xmlserializer/XmlFileDocSource.cpp b/xmlserializer/XmlFileDocSource.cpp
deleted file mode 100644
index f980c39..0000000
--- a/xmlserializer/XmlFileDocSource.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2011-2014, Intel Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its contributors
- * may be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "XmlFileDocSource.h"
-#include <libxml/parser.h>
-#include <libxml/xinclude.h>
-
-#define base CXmlDocSource
-
-CXmlFileDocSource::CXmlFileDocSource(const std::string& strXmlInstanceFile,
- const std::string& strXmlSchemaFile,
- const std::string& strRootElementType,
- const std::string& strRootElementName,
- const std::string& strNameAttrituteName,
- bool bValidateWithSchema) :
- base(readFile(strXmlInstanceFile),
- strXmlSchemaFile,
- strRootElementType,
- strRootElementName,
- strNameAttrituteName,
- bValidateWithSchema),
- _strXmlInstanceFile(strXmlInstanceFile)
-{
-}
-
-CXmlFileDocSource::CXmlFileDocSource(const std::string& strXmlInstanceFile,
- const std::string& strXmlSchemaFile,
- const std::string& strRootElementType,
- bool bValidateWithSchema) :
- base(readFile(strXmlInstanceFile),
- strXmlSchemaFile,
- strRootElementType,
- bValidateWithSchema),
- _strXmlInstanceFile(strXmlInstanceFile)
-{
-}
-
-bool CXmlFileDocSource::isParsable(CXmlSerializingContext& serializingContext) const
-{
- // Check that the doc has been created
- if (!_pDoc) {
-
- serializingContext.setError("Could not parse file " + _strXmlInstanceFile);
-
- return false;
- }
-
- return true;
-}
-
-bool CXmlFileDocSource::populate(CXmlSerializingContext& serializingContext)
-{
- if (!validate(serializingContext)) {
-
- // Add the file's name in the error message
- serializingContext.appendLineToError("File : " + _strXmlInstanceFile);
-
- return false;
- }
-
- return true;
-}
-
-_xmlDoc* CXmlFileDocSource::readFile(const std::string& strFileName)
-{
- // Read xml file
- xmlDocPtr pDoc = xmlReadFile(strFileName.c_str(), NULL, 0);
-
- if (!pDoc) {
-
- return NULL;
- }
- // Process file inclusion
- // WARNING: this symbol is available if libxml2 has been compiled with LIBXML_XINCLUDE_ENABLED
- if (xmlXIncludeProcess(pDoc) < 0) {
-
- xmlFreeDoc(pDoc);
- return NULL;
- }
-
- return pDoc;
-}
diff --git a/xmlserializer/XmlFileDocSource.h b/xmlserializer/XmlFileDocSource.h
deleted file mode 100644
index f7b2e30..0000000
--- a/xmlserializer/XmlFileDocSource.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2011-2014, Intel Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its contributors
- * may be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-#include "XmlDocSource.h"
-#include <string>
-
-/**
- * Source class that read a file to get an xml document.
- * Its base class will validate the document.
- */
-class CXmlFileDocSource : public CXmlDocSource
-{
-public:
- /**
- * Constructor
- *
- * @param[in] strXmlInstanceFile a string containing the path to the xml file
- * @param[in] strXmlSchemaFile a string containing the path to the schema file
- * @param[in] strRootElementType a string containing the root element type
- * @param[in] strRootElementName a string containing the root element name
- * @param[in] strNameAttributeName a string containing the name of the root name attribute
- * @param[in] bValidateWithSchema a boolean that toggles schema validation
- */
- CXmlFileDocSource(const std::string& strXmlInstanceFile,
- const std::string& strXmlSchemaFile,
- const std::string& strRootElementType,
- const std::string& strRootElementName,
- const std::string& strNameAttrituteName,
- bool bValidateWithSchema);
- /**
- * Constructor
- *
- * @param[in] strXmlInstanceFile a string containing the path to the xml file
- * @param[in] strXmlSchemaFile a string containing the path to the schema file
- * @param[in] strRootElementType a string containing the root element type
- * @param[in] bValidateWithSchema a boolean that toggles schema validation
- */
- CXmlFileDocSource(const std::string& strXmlInstanceFile, const std::string& strXmlSchemaFile, const std::string& strRootElementType,
- bool bValidateWithSchema);
-
- /**
- * CXmlDocSource method implementation.
- *
- * @param[out] serializingContext is used as error output
- *
- * @return false if any error occurs
- */
- virtual bool populate(CXmlSerializingContext& serializingContext);
-
- /**
- * Method that checks that the file exists and is readable.
- *
- * @param[out] serializingContext is used as error output
- *
- * @return false if any error occurs during the parsing
- */
- virtual bool isParsable(CXmlSerializingContext& serializingContext) const;
-
-private:
- /**
- * Read xml file
- *
- * This function reads an xml file and processes eventual included files
- * WARNING: to compile this function, libxml2 has to be compiled with LIBXML_XINCLUDE_ENABLED
- *
- * @param[in] strFileName the file name
- *
- * @return a pointer to generated xml document object
- */
- static _xmlDoc* readFile(const std::string& strFileName);
-
- /**
- * Instance file
- */
- std::string _strXmlInstanceFile;
-};
diff --git a/xmlserializer/XmlMemoryDocSource.cpp b/xmlserializer/XmlMemoryDocSource.cpp
index 411d98a..2929b79 100644
--- a/xmlserializer/XmlMemoryDocSource.cpp
+++ b/xmlserializer/XmlMemoryDocSource.cpp
@@ -34,26 +34,17 @@
#define base CXmlDocSource
-CXmlMemoryDocSource::CXmlMemoryDocSource(const IXmlSource* pXmlSource,
+CXmlMemoryDocSource::CXmlMemoryDocSource(const IXmlSource* pXmlSource, bool bValidateWithSchema,
const std::string& strRootElementType,
const std::string& strXmlSchemaFile,
const std::string& strProduct,
- const std::string& strVersion,
- bool bValidateWithSchema):
- base(xmlNewDoc(BAD_CAST "1.0"), xmlNewNode(NULL, BAD_CAST strRootElementType.c_str()),
- bValidateWithSchema),
- _pXmlSource(pXmlSource), _strXmlSchemaFile(strXmlSchemaFile), _bWithHeader(true),
- _strProduct(strProduct), _strVersion(strVersion)
-{
- init();
-}
-
-CXmlMemoryDocSource::CXmlMemoryDocSource(const IXmlSource* pXmlSource,
- const std::string& strRootElementType,
- bool bValidateWithSchema):
- base(xmlNewDoc(BAD_CAST "1.0"), xmlNewNode(NULL, BAD_CAST strRootElementType.c_str()),
- bValidateWithSchema),
- _pXmlSource(pXmlSource), _bWithHeader(false)
+ const std::string& strVersion):
+ base(xmlNewDoc(BAD_CAST "1.0"), bValidateWithSchema,
+ xmlNewNode(NULL, BAD_CAST strRootElementType.c_str())),
+ _pXmlSource(pXmlSource),
+ _strXmlSchemaFile(strXmlSchemaFile),
+ _strProduct(strProduct),
+ _strVersion(strVersion)
{
init();
}
@@ -80,7 +71,7 @@
// Create Xml element with the Doc
CXmlElement docElement(_pRootNode);
- if (_bWithHeader) {
+ if (!_strXmlSchemaFile.empty()) {
// Schema namespace
docElement.setAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
diff --git a/xmlserializer/XmlMemoryDocSource.h b/xmlserializer/XmlMemoryDocSource.h
index 3266782..bc5fdb5 100644
--- a/xmlserializer/XmlMemoryDocSource.h
+++ b/xmlserializer/XmlMemoryDocSource.h
@@ -50,20 +50,11 @@
* @param[in] strVersion a string containing the version number
* @param[in] bValidateWithSchema a boolean that toggles schema validation
*/
- CXmlMemoryDocSource(const IXmlSource* pXmlSource, const std::string& strRootElementType,
- const std::string& strXmlSchemaFile, const std::string& strProduct,
- const std::string& strVersion,
- bool bValidateWithSchema);
-
- /**
- * Constructor
- *
- * @param[in] pXmlSource a pointer to a parameter-framework structure that can generate
- * an xml description of itself
- * @param[in] strRootElementType a string containing the root element type
- * @param[in] bValidateWithSchema a boolean that toggles schema validation
- */
- CXmlMemoryDocSource(const IXmlSource* pXmlSource, const std::string& strRootElementType, bool bValidateWithSchema);
+ CXmlMemoryDocSource(const IXmlSource* pXmlSource, bool bValidateWithSchema,
+ const std::string& strRootElementType,
+ const std::string& strXmlSchemaFile = "",
+ const std::string& strProduct = "",
+ const std::string& strVersion = "");
/**
* Implementation of CXmlDocSource::populate() method.
@@ -91,11 +82,6 @@
*/
std::string _strXmlSchemaFile;
- /**
- * Boolean used to specify if a header should be added in the Xml Doc
- */
- bool _bWithHeader;
-
// Product and version info
std::string _strProduct;
std::string _strVersion;
diff --git a/xmlserializer/XmlStringDocSink.cpp b/xmlserializer/XmlStreamDocSink.cpp
similarity index 79%
rename from xmlserializer/XmlStringDocSink.cpp
rename to xmlserializer/XmlStreamDocSink.cpp
index caec545..f1a2524 100644
--- a/xmlserializer/XmlStringDocSink.cpp
+++ b/xmlserializer/XmlStreamDocSink.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -27,36 +27,34 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "XmlStringDocSink.h"
+#include "XmlStreamDocSink.h"
#include <libxml/parser.h>
#define base CXmlDocSink
-CXmlStringDocSink::CXmlStringDocSink(std::string& strResult):
- _strResult(strResult)
+CXmlStreamDocSink::CXmlStreamDocSink(std::ostream& output):
+ _output(output)
{
}
-bool CXmlStringDocSink::doProcess(CXmlDocSource& xmlDocSource,
+bool CXmlStreamDocSink::doProcess(CXmlDocSource& xmlDocSource,
CXmlSerializingContext& serializingContext)
{
- (void)serializingContext;
-
- xmlChar* pcDumpedDoc = NULL;
+ xmlChar* dumpedDoc = NULL;
int iSize;
- xmlDocDumpFormatMemoryEnc(xmlDocSource.getDoc(), &pcDumpedDoc, &iSize, "UTF-8", 1);
+ xmlDocDumpFormatMemoryEnc(xmlDocSource.getDoc(), &dumpedDoc, &iSize, "UTF-8", 1);
- if (!pcDumpedDoc) {
+ if (!dumpedDoc) {
serializingContext.setError("Unable to encode XML document in memory");
return false;
}
- _strResult.append((const char*)pcDumpedDoc);
+ _output << static_cast<unsigned char*>(dumpedDoc);
- xmlFree(pcDumpedDoc);
+ xmlFree(dumpedDoc);
return true;
}
diff --git a/xmlserializer/XmlStringDocSink.h b/xmlserializer/XmlStreamDocSink.h
similarity index 86%
rename from xmlserializer/XmlStringDocSink.h
rename to xmlserializer/XmlStreamDocSink.h
index 22fa3a1..08b81cb 100644
--- a/xmlserializer/XmlStringDocSink.h
+++ b/xmlserializer/XmlStreamDocSink.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -29,7 +29,7 @@
*/
#pragma once
-#include <string>
+#include <ostream>
#include "XmlDocSink.h"
#include "XmlSource.h"
@@ -37,14 +37,14 @@
* Sink class that writes the content of any CXmlDocSource into a std::string.
* A reference to an empty std::string is given in the constructor.
*/
-class CXmlStringDocSink : public CXmlDocSink
+class CXmlStreamDocSink : public CXmlDocSink
{
public:
/** Constructor
*
- * @param[out] strResult a reference to a std::string that will be filled by the doProcess method
+ * @param[out] output a reference to a ostream that will be filled by the doProcess method
*/
- CXmlStringDocSink(std::string& strResult);
+ CXmlStreamDocSink(std::ostream& output);
private:
/** Implementation of CXmlDocSink::doProcess()
@@ -58,8 +58,8 @@
virtual bool doProcess(CXmlDocSource& xmlDocSource, CXmlSerializingContext& serializingContext);
/**
- * Result std::string containing the XML informations
+ * Result ostream containing the XML informations
*/
- std::string& _strResult;
+ std::ostream& _output;
};
diff --git a/xmlserializer/XmlStringDocSource.cpp b/xmlserializer/XmlStringDocSource.cpp
deleted file mode 100644
index ec2d7e9..0000000
--- a/xmlserializer/XmlStringDocSource.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2011-2014, Intel Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its contributors
- * may be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "XmlStringDocSource.h"
-#include <libxml/parser.h>
-
-#define base CXmlDocSource
-
-CXmlStringDocSource::CXmlStringDocSource(const std::string& strXmlInput,
- const std::string& strXmlSchemaFile,
- const std::string& strRootElementType,
- const std::string& strRootElementName,
- const std::string& strNameAttrituteName,
- bool bValidateWithSchema) :
- base(xmlReadMemory(strXmlInput.c_str(), strXmlInput.size(), "", NULL, 0),
- strXmlSchemaFile,
- strRootElementType,
- strRootElementName,
- strNameAttrituteName,
- bValidateWithSchema)
-{
-}
-
-bool CXmlStringDocSource::populate(CXmlSerializingContext &serializingContext)
-{
- return validate(serializingContext);
-}
diff --git a/xmlserializer/XmlStringDocSource.h b/xmlserializer/XmlStringDocSource.h
deleted file mode 100644
index 06a0337..0000000
--- a/xmlserializer/XmlStringDocSource.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2011-2014, Intel Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its contributors
- * may be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-#include "XmlDocSource.h"
-#include <string>
-
-/**
- * Source class that get an xml document from a std::string.
- * Its base class will check the validity of the document.
- */
-class CXmlStringDocSource : public CXmlDocSource
-{
-public:
- /**
- * Constructor
- *
- * @param[in] strXmlInput a string containing an xml description
- * @param[in] strXmlSchemaFile a string containing the path to the schema file
- * @param[in] strRootElementType a string containing the root element type
- * @param[in] strRootElementName a string containing the root element name
- * @param[in] strNameAttributeName a string containing the name of the root name attribute
- * @param[in] bValidateWithSchema a boolean that toggles schema validation
- */
- CXmlStringDocSource(const std::string& strXmlInput,
- const std::string& strXmlSchemaFile,
- const std::string& strRootElementType,
- const std::string& strRootElementName,
- const std::string& strNameAttrituteName,
- bool bValidateWithSchema);
-
- /**
- * CXmlDocSource method implementation.
- *
- * @param[out] serializingContext is used as error output
- *
- * @return false if any error occurs
- */
- virtual bool populate(CXmlSerializingContext& serializingContext);
-};
-
-