diff options
| author | François Gaffie <francois.gaffie@intel.com> | 2016-02-17 07:54:16 +0100 |
|---|---|---|
| committer | Eric Laurent <elaurent@google.com> | 2016-03-04 17:47:11 -0800 |
| commit | 221a25e58e92ebc450c7eaba5f3ba8153a2308ae (patch) | |
| tree | 21fba4d16e7be1fc91e2e8b85b12ad3950c209a1 /test | |
| parent | 9368eea42a1afb01dd44110582f997115b50e742 (diff) | |
| download | platform_external_parameter-framework-221a25e58e92ebc450c7eaba5f3ba8153a2308ae.tar.gz platform_external_parameter-framework-221a25e58e92ebc450c7eaba5f3ba8153a2308ae.tar.bz2 platform_external_parameter-framework-221a25e58e92ebc450c7eaba5f3ba8153a2308ae.zip | |
parameter-framework: move github upstream code to upstream folder
Change-Id: I3aa6e8f8fccfcf80fdc2a4e00c17d8b10b45e9dd
Signed-off-by: François Gaffie <francois.gaffie@intel.com>
Bug: 22887211
Diffstat (limited to 'test')
136 files changed, 0 insertions, 21470 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index 48a40e5..0000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -# 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(catch) -add_subdirectory(tmpfile) -add_subdirectory(functional-tests) -add_subdirectory(functional-tests-legacy) -add_subdirectory(test-fixed-point-parameter) -add_subdirectory(test-platform) -add_subdirectory(test-subsystem) -add_subdirectory(introspection-subsystem) -add_subdirectory(tokenizer) -add_subdirectory(xml-generator) diff --git a/test/catch/CMakeLists.txt b/test/catch/CMakeLists.txt deleted file mode 100644 index 14b9afa..0000000 --- a/test/catch/CMakeLists.txt +++ /dev/null @@ -1,51 +0,0 @@ -# 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) - # 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 - find_path(CATCH_HEADER catch.hpp) - set_property(CACHE CATCH_HEADER PROPERTY ADVANCED TRUE) - if(NOT CATCH_HEADER) - message(SEND_ERROR -" Catch header `catch.hpp' could not be found. - Catch is a single header unit test framework required to build some tests. - How to install: - If it is not available on your package manager, Catch can be downloaded from: - https://raw.github.com/philsquared/Catch/master/single_include/catch.hpp - Then either: - - append the download folder to the `CMAKE_INCLUDE_PATH' or `CMAKE_PREFIX_PATH' variable - - copy it in a standard location (/usr/include on most linux distribution). - To remove test dependancies all together, set `BUILD_TESTING' to false. - It will disable test targets, thus the framework they depend on.") - endif() - - add_library(catch STATIC catch.cpp) - target_include_directories(catch PUBLIC "${CATCH_HEADER}") -endif() diff --git a/test/catch/catch.cpp b/test/catch/catch.cpp deleted file mode 100644 index a46649c..0000000 --- a/test/catch/catch.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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. - */ - -/** Accelerate test build by not recompiling catch when a test change. - * See: https://github.com/philsquared/Catch/blob/master/docs/slow-compiles.md - */ -#define CATCH_CONFIG_MAIN -#include "catch.hpp" diff --git a/test/functional-tests-legacy/ACTCampaignEngine.py b/test/functional-tests-legacy/ACTCampaignEngine.py deleted file mode 100755 index d4aeaf9..0000000 --- a/test/functional-tests-legacy/ACTCampaignEngine.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/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-legacy/CMakeLists.txt b/test/functional-tests-legacy/CMakeLists.txt deleted file mode 100644 index 2eb1724..0000000 --- a/test/functional-tests-legacy/CMakeLists.txt +++ /dev/null @@ -1,67 +0,0 @@ -# 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. - -# This test suite relies on remote-process - which isn't available when -# networking is disabled -if(BUILD_TESTING AND NETWORKING) - find_package(PythonInterp 2 REQUIRED) - - set(PFW_ROOT ${PROJECT_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) - file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/ACTCampaignEngine.py DESTINATION ${PFW_ROOT}/) - file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/PfwTestCase DESTINATION ${PFW_ROOT}/) - file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/Util DESTINATION ${PFW_ROOT}/) - file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/xml/XML_Test DESTINATION ${PFW_ROOT}/xml/) - - add_test(NAME functional-test-legacy - WORKING_DIRECTORY ${PFW_ROOT} - COMMAND ${PYTHON_EXECUTABLE} ${PFW_ROOT}/ACTCampaignEngine.py) - - # Custom function defined in the top-level CMakeLists - set_test_env(functional-test-legacy) - set_property(TEST functional-test-legacy APPEND PROPERTY ENVIRONMENT - PFW_ROOT=${PFW_ROOT} - PFW_RESULT=${PFW_RESULT} - PFW_SCHEMAS=${PROJECT_SOURCE_DIR}/schemas) -endif() diff --git a/test/functional-tests-legacy/PfwTestCase/Domains/__init__.py b/test/functional-tests-legacy/PfwTestCase/Domains/__init__.py deleted file mode 100644 index e49f417..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Domains/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -""" -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-legacy/PfwTestCase/Domains/tDomain_Configuration.py b/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Configuration.py deleted file mode 100644 index 8c5e641..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Configuration.py +++ /dev/null @@ -1,495 +0,0 @@ -# -*-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, expectSuccess=False) - 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, expectSuccess=False) - 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, expectSuccess=False) - 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") - listed_conf_backup = f_configurations_backup.read().splitlines() - listed_conf = f_configurations.read().splitlines() - 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, expectSuccess=False) - 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, expectSuccess=False) - 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", expectSuccess=False) - 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") - listed_conf_backup = f_configurations_backup.read().splitlines() - listed_conf = f_configurations.read().splitlines() - 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", expectSuccess=False) - 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, expectSuccess=False) - 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, expectSuccess=False) - 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") - listed_conf_backup = f_configurations_backup.read().splitlines() - listed_conf = f_configurations.read().splitlines() - 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") - new_conf_names = [self.conf_test + "_" + str(iteration) for iteration in range(self.new_conf_number)] - listed_conf = f_configurations.read().strip('\r\n').splitlines() - assert listed_conf == new_conf_names, "ERROR : Error while listing configuration, expected '%s', found '%s'" % (new_conf_names, listed_conf) - 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 - configurations_renamed = out - # Checking configurations names integrity - log.I("Configurations listing conformity check") - new_conf_names = [self.conf_test_renamed + "_" + str(iteration) for iteration in range(self.new_conf_number)] - listed_conf = configurations_renamed.strip('\r\n').splitlines() - assert listed_conf == new_conf_names, "ERROR : Error while renaming configuration, expected '%s', found '%s'" % (new_conf_names, 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") diff --git a/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Configuration_Backup.py b/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Configuration_Backup.py deleted file mode 100644 index 26dd03a..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Configuration_Backup.py +++ /dev/null @@ -1,239 +0,0 @@ -# -*-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, expectSuccess=False) - 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, expectSuccess=False) - 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", expectSuccess=False) - 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, expectSuccess=False) - 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, expectSuccess=False) - 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", expectSuccess=False) - 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-legacy/PfwTestCase/Domains/tDomain_Configuration_Selection.py b/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Configuration_Selection.py deleted file mode 100644 index eaaa17d..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Configuration_Selection.py +++ /dev/null @@ -1,171 +0,0 @@ -# -*-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 = os.environ["PFW_TEST_TOOLS"] + "/xml/XML_Test/Reference_Criteria.xml" - 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", expectSuccess=False) - - 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") - - # 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 (len(self.expected_result[0])): - 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_status) diff --git a/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Elements.py b/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Elements.py deleted file mode 100644 index cd8a0be..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Elements.py +++ /dev/null @@ -1,311 +0,0 @@ -# -*-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('\r\n') - element_name_backup = f_DomainElements_Backup.readline().strip('\r\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('\r\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), expectSuccess=False) - 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", expectSuccess=False) - 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('\r\n') - element_name_backup = f_DomainElements_Backup.readline().strip('\r\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), expectSuccess=False) - 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", expectSuccess=False) - 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('\r\n') - element_name_backup = f_DomainElements_Backup.readline().strip('\r\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-legacy/PfwTestCase/Domains/tDomain_Elements_Sequences.py b/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Elements_Sequences.py deleted file mode 100644 index 8baad70..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Elements_Sequences.py +++ /dev/null @@ -1,279 +0,0 @@ -# -*-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") - expected = [self.elem_2_path, self.elem_0_path, self.elem_1_path] - # Only check the element reordered - configElementOrder = out.strip('\r\n').splitlines()[:len(expected)] - assert configElementOrder == expected, "ERROR : Error while modifying configuration %s elements order on domain %s, expected %s, found %s" % (self.configuration, self.domain_name, expected, configElementOrder) - log.I("New elements sequence order conform to expected order for configuration %s" % (self.configuration)) - # 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, expectSuccess=False) - 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, expectSuccess=False) - 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.read().splitlines() - element_name = f_ConfigElementsOrder_Backup.read().splitlines() - 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: %s" % (self.elem_1_path, out) - 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: %s" % (self.elem_2_path, out) - 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, expectSuccess=False) - 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", expectSuccess=False) - 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_names = f_ConfigElementsOrder.read().splitlines() - element_name = f_ConfigElementsOrder_Backup.read().splitlines() - assert element_name==new_element_names, "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-legacy/PfwTestCase/Domains/tDomain_Rules.py b/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Rules.py deleted file mode 100644 index 407047f..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Rules.py +++ /dev/null @@ -1,443 +0,0 @@ -# -*-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", expectSuccess=False) - 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, expectSuccess=False) - 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, expectSuccess=False) - 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, expectSuccess=False) - 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, expectSuccess=False) - 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", expectSuccess=False) - 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, expectSuccess=False) - 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", expectSuccess=False) - 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, expectSuccess=False) - 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, expectSuccess=False) - 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-legacy/PfwTestCase/Domains/tDomain_Split.py b/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Split.py deleted file mode 100644 index c714224..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Split.py +++ /dev/null @@ -1,247 +0,0 @@ -# -*-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 -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 = os.environ["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-legacy/PfwTestCase/Domains/tDomain_creation_deletion.py b/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_creation_deletion.py deleted file mode 100644 index c5d43f3..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_creation_deletion.py +++ /dev/null @@ -1,344 +0,0 @@ -# -*-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, "", expectSuccess=False) - 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('\r\n'), - domain_name = f_Domains.readline().strip('\r\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, "", expectSuccess=False) - 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('\r\n'), - domain_name = f_Domains.readline().strip('\r\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\r'), - 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-legacy/PfwTestCase/Domains/tDomain_rename.py b/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_rename.py deleted file mode 100644 index 2ee5414..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Domains/tDomain_rename.py +++ /dev/null @@ -1,337 +0,0 @@ -# -*-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', expectSuccess=False) - 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, expectSuccess=False) - 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-legacy/PfwTestCase/Functions/__init__.py b/test/functional-tests-legacy/PfwTestCase/Functions/__init__.py deleted file mode 100644 index 7b72df8..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Functions/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -""" -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-legacy/PfwTestCase/Functions/tFunction_Export_Import_Domains.py b/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_Export_Import_Domains.py deleted file mode 100644 index 2bfc50a..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_Export_Import_Domains.py +++ /dev/null @@ -1,800 +0,0 @@ -# -*-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 - -Test cases : ------------- - - Testing importDomainsWithSettingsXML nominal case - - Testing exportDomainsWithSettingsXML nominal case - - Testing exportDomainsXML/importDomainsXML 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 = os.environ["PFW_RESULT"] + "/UINT16" - self.param_name_02 = "/Test/Test/TEST_DOMAIN_0/Param_00" - self.filesystem_02 = os.environ["PFW_RESULT"] + "/Param_00" - self.param_name_03 = "/Test/Test/TEST_DOMAIN_1/Param_12" - self.filesystem_03 = os.environ["PFW_RESULT"] + "/Param_12" - - pfw_test_tools=os.environ["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.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", expectSuccess=None) - 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) - - 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 - domainBackup = out.strip('\r\n').splitlines() - log.I("Actual domains: %s" % domainBackup) - assert len(domainBackup)==self.nb_domains_in_reference_xml, log.F("Number of listed domains is not compliant with the file %s - expected : %s domains, found domains %s"%(self.reference_xml,self.nb_domains_in_reference_xml, domainBackup)) - - #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.strip('\r\n')) - 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], config_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 open(self.filesystem_01).read()[:-1] == 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 open(self.filesystem_02).read()[:-1] == 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 open(self.filesystem_03).read()[:-1] == 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 = open(self.filesystem_01).read()[:-1] - init_filesystem_02 = open(self.filesystem_02).read()[:-1] - init_filesystem_03 = open(self.filesystem_03).read()[:-1] - - ### 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 open(self.filesystem_01).read()[:-1] != 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 open(self.filesystem_02).read()[:-1] != 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 open(self.filesystem_03).read()[:-1] != 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 open(self.filesystem_01).read()[:-1] == 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 open(self.filesystem_02).read()[:-1] == 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 open(self.filesystem_03).read()[:-1] == 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 = open(self.filesystem_01).read()[:-1] - init_filesystem_02 = open(self.filesystem_02).read()[:-1] - init_filesystem_03 = open(self.filesystem_03).read()[:-1] - - ### 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 open(self.filesystem_01).read()[:-1] != 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 open(self.filesystem_02).read()[:-1] != 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 open(self.filesystem_03).read()[:-1] != 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 open(self.filesystem_01).read()[:-1] != 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 open(self.filesystem_02).read()[:-1] != 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 open(self.filesystem_03).read()[:-1] != 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 open(self.filesystem_01).read()[:-1] != 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 open(self.filesystem_02).read()[:-1] != 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 open(self.filesystem_03).read()[:-1] != 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 - 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 = open(self.filesystem_01).read()[:-1] - init_filesystem_02 = open(self.filesystem_02).read()[:-1] - init_filesystem_03 = open(self.filesystem_03).read()[:-1] - xml_path=os.environ["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, "", expectSuccess=False) - 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, "", expectSuccess=False) - 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, "", expectSuccess=False) - 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, "", expectSuccess=False) - 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, "", expectSuccess=False) - 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.strip('\r\n')) - 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.strip('\r\n')) - 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 open(self.filesystem_01).read()[:-1] == 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 open(self.filesystem_02).read()[:-1] == 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 open(self.filesystem_03).read()[:-1] == 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 - 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=os.environ["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, "", expectSuccess=False) - 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, "", expectSuccess=False) - 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, "", expectSuccess=False) - #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, "", expectSuccess=False) - 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, "", expectSuccess=False) - 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.strip('\r\n')) - 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 domains, found domains: %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.strip('\r\n')) - 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 #### diff --git a/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_Sync.py b/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_Sync.py deleted file mode 100644 index d95318d..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_Sync.py +++ /dev/null @@ -1,250 +0,0 @@ -# -*-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.environ["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 = open(self.filesystem_01).read()[:-1] - init_filesystem_02 = open(self.filesystem_02).read()[:-1] - init_filesystem_03 = open(self.filesystem_03).read()[:-1] - #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 open(self.filesystem_01).read()[:-1] != init_filesystem_01, log.F("FILESYSTEM : parameter %s update error"%self.param_name_01) - #INT16 - assert open(self.filesystem_02).read()[:-1] != init_filesystem_02, log.F("FILESYSTEM : parameter %s update error"%self.param_name_02) - #UINT32 - assert open(self.filesystem_03).read()[:-1] != 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 open(self.filesystem_01).read()[:-1] != init_filesystem_01, log.F("FILESYSTEM : parameter %s is updated, autosync is still enabled"%self.param_name_01) - #INT16 - assert open(self.filesystem_02).read()[:-1] != init_filesystem_02, log.F("FILESYSTEM : parameter %s is updated, autosync is still enabled"%self.param_name_02) - #UINT32 - assert open(self.filesystem_03).read()[:-1] != 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 = open(self.filesystem_01).read()[:-1] - init_filesystem_02 = open(self.filesystem_02).read()[:-1] - init_filesystem_03 = open(self.filesystem_03).read()[:-1] - #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 open(self.filesystem_01).read()[:-1] == init_filesystem_01, log.F("FILESYSTEM : parameter %s update error"%self.param_name_01) - #INT16 - assert open(self.filesystem_02).read()[:-1] == init_filesystem_02, log.F("FILESYSTEM : parameter %s update error"%self.param_name_02) - #UINT32 - assert open(self.filesystem_03).read()[:-1] == 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 open(self.filesystem_01).read()[:-1] != init_filesystem_01, log.F("FILESYSTEM : parameter %s is updated, autosync is still enabled"%self.param_name_01) - #INT16 - assert open(self.filesystem_02).read()[:-1] != init_filesystem_02, log.F("FILESYSTEM : parameter %s is updated, autosync is still enabled"%self.param_name_02) - #UINT32 - assert open(self.filesystem_03).read()[:-1] != 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-legacy/PfwTestCase/Functions/tFunction_getParameter.py b/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_getParameter.py deleted file mode 100644 index e0c7fb9..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_getParameter.py +++ /dev/null @@ -1,76 +0,0 @@ -# -*-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", expectSuccess=False) - 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-legacy/PfwTestCase/Functions/tFunction_listingFunctions.py b/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_listingFunctions.py deleted file mode 100644 index 327f2e4..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_listingFunctions.py +++ /dev/null @@ -1,551 +0,0 @@ -# -*-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.environ["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)) - self.assertEqual(out.splitlines(), open(self.reference_dumpDomains_file).read().splitlines()) - 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", "XML") - assert err == None, log.E("Command [listCriteria] : %s"%(err)) - self.assertNotEqual(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", expectSuccess=False) - 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", expectSuccess=False) - 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", expectSuccess=False) - 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", expectSuccess=False) - 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", expectSuccess=False) - 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-legacy/PfwTestCase/Functions/tFunction_setParameter.py b/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_setParameter.py deleted file mode 100644 index 62a7ca2..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Functions/tFunction_setParameter.py +++ /dev/null @@ -1,90 +0,0 @@ -# -*-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", expectSuccess=False) - 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", expectSuccess=False) - 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", expectSuccess=False) - 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-legacy/PfwTestCase/Types/__init__.py b/test/functional-tests-legacy/PfwTestCase/Types/__init__.py deleted file mode 100644 index 9fbd9f6..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -""" -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-legacy/PfwTestCase/Types/tBit_Block.py b/test/functional-tests-legacy/PfwTestCase/Types/tBit_Block.py deleted file mode 100644 index f0161ad..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tBit_Block.py +++ /dev/null @@ -1,320 +0,0 @@ -# -*-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 os -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=os.environ["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 open(self.filesystem_name).read()[:-1] == 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=open(self.filesystem_name).read()[:-1] - - 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, expectSuccess=False) - 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, expectSuccess=False) - 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 open(self.filesystem_name).read()[:-1] == 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=open(self.filesystem_name).read()[:-1] - - 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, expectSuccess=False) - 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 open(self.filesystem_name).read()[:-1] == 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=open(self.filesystem_name).read()[:-1] - - 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, expectSuccess=False) - 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 open(self.filesystem_name).read()[:-1] == 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=open(self.filesystem_name).read()[:-1] - - 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 open(self.filesystem_name).read()[:-1] == init_filesystem_value, log.F("FILESYSTEM : parameter update error for %s"%(self.block_name)) diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tBoolean.py b/test/functional-tests-legacy/PfwTestCase/Types/tBoolean.py deleted file mode 100644 index 9c95692..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tBoolean.py +++ /dev/null @@ -1,161 +0,0 @@ -# -*-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, expectSuccess=False) - 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, expectSuccess=False) - 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-legacy/PfwTestCase/Types/tEnum.py b/test/functional-tests-legacy/PfwTestCase/Types/tEnum.py deleted file mode 100644 index 524e763..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tEnum.py +++ /dev/null @@ -1,266 +0,0 @@ -# -*-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 os -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=os.environ["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 open(self.filesystem_name).read()[:-1] == 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 open(self.filesystem_name).read()[:-1] == 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 open(self.filesystem_name).read()[:-1] == 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=open(self.filesystem_name).read()[:-1] - log.I("Set parameter %s to %s"%(self.param_name,value)) - out,err = self.pfw.sendCmd("setParameter",self.param_name, value, expectSuccess=False) - 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 open(self.filesystem_name).read()[:-1] == 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=open(self.filesystem_name).read()[:-1] - log.I("Set parameter %s to %s"%(self.param_name,value)) - out,err = self.pfw.sendCmd("setParameter",self.param_name, value, expectSuccess=False) - 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 open(self.filesystem_name).read()[:-1] == 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=open(self.filesystem_name).read()[:-1] - log.I("Set parameter %s to %s"%(self.param_name,value)) - out,err = self.pfw.sendCmd("setParameter",self.param_name, value, expectSuccess=False) - 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 open(self.filesystem_name).read()[:-1] == init_filesystem_value, log.F("FILESYSTEM : parameter update error for %s"%(self.param_name)) diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q0_15.py b/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q0_15.py deleted file mode 100755 index 0c9e273..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q0_15.py +++ /dev/null @@ -1,233 +0,0 @@ -# -*-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 os -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 open(os.environ["PFW_RESULT"] + "/FP16_Q0.15").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP16_Q0.15").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP16_Q0.15").read()[:-1] - log.I("Setting %s to value %s" % (self.type_name, value)) - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP16_Q0.15").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP16_Q0.15").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP16_Q0.15").read()[:-1] - log.I("Setting %s to value %s" % (self.type_name, value)) - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP16_Q0.15").read()[:-1] == param_check, log.F("FILESYSTEM : Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q15_0.py b/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q15_0.py deleted file mode 100755 index 11e237b..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q15_0.py +++ /dev/null @@ -1,231 +0,0 @@ -# -*-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 os -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 open(os.environ["PFW_RESULT"] + "/FP16_Q15.0").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP16_Q15.0").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP16_Q15.0").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP16_Q15.0").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP16_Q15.0").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP16_Q15.0").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP16_Q15.0").read()[:-1] == param_check, log.F("FILESYSTEM : Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q7_8.py b/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q7_8.py deleted file mode 100755 index 2fb44d3..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tFP16_Q7_8.py +++ /dev/null @@ -1,236 +0,0 @@ -# -*-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 os -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 open(os.environ["PFW_RESULT"] + "/FP16_Q7.8").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP16_Q7.8").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP16_Q7.8").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP16_Q7.8").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP16_Q7.8").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP16_Q7.8").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP16_Q7.8").read()[:-1] == param_check, log.F("FILESYSTEM : Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q0_31.py b/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q0_31.py deleted file mode 100755 index 133d481..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q0_31.py +++ /dev/null @@ -1,237 +0,0 @@ -# -*-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 os -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 open(os.environ["PFW_RESULT"] + "/FP32_Q0.31").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP32_Q0.31").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP32_Q0.31").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP32_Q0.31").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP32_Q0.31").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP32_Q0.31").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP32_Q0.31").read()[:-1] == param_check, log.F("FILESYSTEM : Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q15_16.py b/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q15_16.py deleted file mode 100755 index 013855a..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q15_16.py +++ /dev/null @@ -1,239 +0,0 @@ -# -*-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 os -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 open(os.environ["PFW_RESULT"] + "/FP32_Q15.16").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP32_Q15.16").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP32_Q15.16").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP32_Q15.16").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP32_Q15.16").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP32_Q15.16").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP32_Q15.16").read()[:-1] == param_check, log.F("FILESYSTEM : Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q31_0.py b/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q31_0.py deleted file mode 100755 index 4497d52..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q31_0.py +++ /dev/null @@ -1,247 +0,0 @@ -# -*-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 os -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 open(os.environ["PFW_RESULT"] + "/FP32_Q31.0").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP32_Q31.0").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP32_Q31.0").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP32_Q31.0").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP32_Q31.0").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP32_Q31.0").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP32_Q31.0").read()[:-1] == param_check, log.F("FILESYSTEM : Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q8_20.py b/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q8_20.py deleted file mode 100755 index 126a6a2..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tFP32_Q8_20.py +++ /dev/null @@ -1,245 +0,0 @@ -# -*-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 os -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 open(os.environ["PFW_RESULT"] + "/FP32_Q8.20").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP32_Q8.20").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP32_Q8.20").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP32_Q8.20").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP32_Q8.20").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP32_Q8.20").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP32_Q8.20").read()[:-1] == param_check, log.F("FILESYSTEM : Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q0_7.py b/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q0_7.py deleted file mode 100755 index dc1d733..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q0_7.py +++ /dev/null @@ -1,249 +0,0 @@ -# -*-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 os -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 open(os.environ["PFW_RESULT"] + "/FP8_Q0.7").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP8_Q0.7").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP8_Q0.7").read()[:-1] - log.I("Setting %s to value %s" % (self.type_name, value)) - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP8_Q0.7").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP8_Q0.7").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP8_Q0.7").read()[:-1] - log.I("Setting %s to value %s" % (self.type_name, value)) - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP8_Q0.7").read()[:-1] == param_check, log.F("FILESYSTEM - Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q3_4.py b/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q3_4.py deleted file mode 100755 index 825d3d2..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q3_4.py +++ /dev/null @@ -1,248 +0,0 @@ -# -*-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 os -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 open(os.environ["PFW_RESULT"] + "/FP8_Q3.4").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP8_Q3.4").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP8_Q3.4").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP8_Q3.4").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP8_Q3.4").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP8_Q3.4").read()[:-1] - log.I("Setting %s to value %s" % (self.type_name, value)) - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP8_Q3.4").read()[:-1] == param_check, log.F("FILESYSTEM : Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q7_0.py b/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q7_0.py deleted file mode 100755 index 4918aa7..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tFP8_Q7_0.py +++ /dev/null @@ -1,248 +0,0 @@ -# -*-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 os -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 open(os.environ["PFW_RESULT"] + "/FP8_Q7.0").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP8_Q7.0").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP8_Q7.0").read()[:-1] - log.I("Setting %s to value %s" % (self.type_name, value)) - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP8_Q7.0").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/FP8_Q7.0").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/FP8_Q7.0").read()[:-1] - log.I("Setting %s to value %s" % (self.type_name, value)) - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/FP8_Q7.0").read()[:-1] == param_check, log.F("FILESYSTEM : Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tINT16.py b/test/functional-tests-legacy/PfwTestCase/Types/tINT16.py deleted file mode 100644 index 774bc56..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tINT16.py +++ /dev/null @@ -1,246 +0,0 @@ -# -*-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 os -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 open(os.environ["PFW_RESULT"] + "/INT16").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/INT16").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/INT16").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/INT16").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/INT16").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/INT16").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/INT16").read()[:-1] == param_check, log.F("FILESYSTEM : Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tINT16_ARRAY.py b/test/functional-tests-legacy/PfwTestCase/Types/tINT16_ARRAY.py deleted file mode 100644 index 34fa1cc..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tINT16_ARRAY.py +++ /dev/null @@ -1,319 +0,0 @@ -# -*-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 os -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 = os.environ["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 - indexed_files_system_array_value = open(self.param_short_name).read().splitlines()[index] - 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 - indexed_files_system_array_value = open(self.param_short_name).read().splitlines()[index] - 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)) - param_check = open(self.param_short_name).read().splitlines()[index] - #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), expectSuccess=False) - 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 = open(self.param_short_name).read().splitlines()[index] - 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 - indexed_files_system_array_value = open(self.param_short_name).read().splitlines()[index] - 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)) - param_check = open(self.param_short_name).read().splitlines()[index] - #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), expectSuccess=False) - 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 = open(self.param_short_name).read().splitlines()[index] - 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), expectSuccess=None) - 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-legacy/PfwTestCase/Types/tINT16_Max.py b/test/functional-tests-legacy/PfwTestCase/Types/tINT16_Max.py deleted file mode 100644 index 62d2db1..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tINT16_Max.py +++ /dev/null @@ -1,246 +0,0 @@ -# -*-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 os -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 open(os.environ["PFW_RESULT"] + "/INT16_Max").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/INT16_Max").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/INT16_Max").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/INT16_Max").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/INT16_Max").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/INT16_Max").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/INT16_Max").read()[:-1] == param_check, log.F("FILESYSTEM : Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tINT32.py b/test/functional-tests-legacy/PfwTestCase/Types/tINT32.py deleted file mode 100644 index fc82b03..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tINT32.py +++ /dev/null @@ -1,230 +0,0 @@ -# -*-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 os -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 open(os.environ["PFW_RESULT"] + "/INT32").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/INT32").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/INT32").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/INT32").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/INT32").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/INT32").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/INT32").read()[:-1] == param_check, "FILESYSTEM : Forbiden parameter change" - print "INFO : test OK" diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tINT32_Max.py b/test/functional-tests-legacy/PfwTestCase/Types/tINT32_Max.py deleted file mode 100644 index 15e5dde..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tINT32_Max.py +++ /dev/null @@ -1,245 +0,0 @@ -# -*-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 os -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 open(os.environ["PFW_RESULT"] + "/INT32_Max").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/INT32_Max").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/INT32_Max").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/INT32_Max").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/INT32_Max").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/INT32_Max").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/INT32_Max").read()[:-1] == param_check, log.F("FILESYSTEM : Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tINT8.py b/test/functional-tests-legacy/PfwTestCase/Types/tINT8.py deleted file mode 100644 index f82a524..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tINT8.py +++ /dev/null @@ -1,246 +0,0 @@ -# -*-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 os -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 open(os.environ["PFW_RESULT"] + "/INT8").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/INT8").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/INT8").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/INT8").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/INT8").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/INT8").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/INT8").read()[:-1] == param_check, log.F("FILESYSTEM : Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tINT8_Max.py b/test/functional-tests-legacy/PfwTestCase/Types/tINT8_Max.py deleted file mode 100644 index 9eff0bb..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tINT8_Max.py +++ /dev/null @@ -1,230 +0,0 @@ -# -*-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 os -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 open(os.environ["PFW_RESULT"] + "/INT8_Max").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/INT8_Max").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/INT8_Max").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/INT8_Max").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/INT8_Max").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/INT8_Max").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/INT8_Max").read()[:-1] == param_check, "FILESYSTEM : Forbiden parameter change" - print "INFO : test OK" diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tParameter_Block.py b/test/functional-tests-legacy/PfwTestCase/Types/tParameter_Block.py deleted file mode 100644 index 76317b4..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tParameter_Block.py +++ /dev/null @@ -1,290 +0,0 @@ -# -*-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 os -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+"/BLOCK_UINT8") - self.filesystem_name.append(os.environ["PFW_RESULT"] + "/BLOCK_UINT8") - #UINT16_1, size = 16 - self.param_name.append(self.block_name+"/BLOCK_UINT16") - self.filesystem_name.append(os.environ["PFW_RESULT"] + "/BLOCK_UINT16") - #UINT32_2, size = 32 - self.param_name.append(self.block_name+"/BLOCK_UINT32") - self.filesystem_name.append(os.environ["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 (open(self.filesystem_name[index_param]).read()[:-1] - == 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(open(self.filesystem_name[index_param]).read()[:-1]) - - 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, expectSuccess=False) - 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, expectSuccess=False) - 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 (open(self.filesystem_name[index_param]).read()[:-1] - == 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(open(self.filesystem_name[index_param]).read()[:-1]) - - 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, expectSuccess=False) - 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 (open(self.filesystem_name[index_param]).read()[:-1] - == 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(open(self.filesystem_name[index_param]).read()[:-1]) - - 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, expectSuccess=False) - 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 (open(self.filesystem_name[index_param]).read()[:-1] - == init_filesystem_value[index_param]), log.F("FILESYSTEM : parameter update error for %s" - %(self.block_name)) diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tRAW.py b/test/functional-tests-legacy/PfwTestCase/Types/tRAW.py deleted file mode 100644 index eb7dc5b..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tRAW.py +++ /dev/null @@ -1,724 +0,0 @@ -# -*-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 os -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=os.environ["PFW_RESULT"] + "/UINT16_Max" - self.param_name_2 = "/Test/Test/TEST_DIR/UINT16" - self.filesystem_name_2=os.environ["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 open(self.filesystem_name).read()[:-1] == 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 open(self.filesystem_name).read()[:-1] == 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 open(self.filesystem_name).read()[:-1] == 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 open(self.filesystem_name).read()[:-1] == 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 open(self.filesystem_name).read()[:-1] == 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 open(self.filesystem_name).read()[:-1] == 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 open(self.filesystem_name).read()[:-1] == 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 open(self.filesystem_name).read()[:-1] == 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 open(self.filesystem_name).read()[:-1] == 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 = open(self.filesystem_name).read()[:-1] - 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, expectSuccess=False) - 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 open(self.filesystem_name).read()[:-1] == 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 = open(self.filesystem_name_2).read()[:-1] - 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, expectSuccess=False) - 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 open(self.filesystem_name_2).read()[:-1] == filesystem_value, "FILESYSTEM : Forbiden parameter change" diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tSTRING_128.py b/test/functional-tests-legacy/PfwTestCase/Types/tSTRING_128.py deleted file mode 100644 index 78f829f..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tSTRING_128.py +++ /dev/null @@ -1,299 +0,0 @@ -# -*-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 os -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 open(os.environ["PFW_RESULT"] + "/STR_CHAR128").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/STR_CHAR128").read()[:-1] == "", 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 = open(os.environ["PFW_RESULT"] + "/STR_CHAR128").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/STR_CHAR128").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/STR_CHAR128").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/STR_CHAR128").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/STR_CHAR128").read()[:-1] - #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)) - #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 open(os.environ["PFW_RESULT"] + "/STR_CHAR128").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/STR_CHAR128").read()[:-1] - #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)) - #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 open(os.environ["PFW_RESULT"] + "/STR_CHAR128").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/STR_CHAR128").read()[:-1] == value_check, log.F("FILESYSTEM : parameter update error") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tUINT16.py b/test/functional-tests-legacy/PfwTestCase/Types/tUINT16.py deleted file mode 100644 index f7fc72e..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tUINT16.py +++ /dev/null @@ -1,250 +0,0 @@ -#!/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 os -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 open(os.environ["PFW_RESULT"] + "/UINT16").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/UINT16").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/UINT16").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/UINT16").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/UINT16").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/UINT16").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/UINT16").read()[:-1] == param_check, log.F("FILESYSTEM : Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tUINT16_Max.py b/test/functional-tests-legacy/PfwTestCase/Types/tUINT16_Max.py deleted file mode 100644 index 805017e..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tUINT16_Max.py +++ /dev/null @@ -1,249 +0,0 @@ -#!/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 os -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 open(os.environ["PFW_RESULT"] + "/UINT16_Max").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/UINT16_Max").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/UINT16_Max").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/UINT16_Max").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/UINT16_Max").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/UINT16_Max").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/UINT16_Max").read()[:-1] == param_check, log.F("FILESYSTEM : Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tUINT32.py b/test/functional-tests-legacy/PfwTestCase/Types/tUINT32.py deleted file mode 100644 index e33296b..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tUINT32.py +++ /dev/null @@ -1,249 +0,0 @@ -#!/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 os -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 open(os.environ["PFW_RESULT"] + "/UINT32").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/UINT32").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/UINT32").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/UINT32").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/UINT32").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/UINT32").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/UINT32").read()[:-1] == param_check, log.F("FILESYSTEM : Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tUINT32_ARRAY.py b/test/functional-tests-legacy/PfwTestCase/Types/tUINT32_ARRAY.py deleted file mode 100644 index c277a06..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tUINT32_ARRAY.py +++ /dev/null @@ -1,320 +0,0 @@ -#!/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 os -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 = os.environ["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 - indexed_files_system_array_value = open(self.param_short_name).read().splitlines()[index] - 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 - indexed_files_system_array_value = open(self.param_short_name).read().splitlines()[index] - 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)) - param_check = open(self.param_short_name).read().splitlines()[index] - #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), expectSuccess=False) - 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 = open(self.param_short_name).read().splitlines()[index] - 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 - indexed_files_system_array_value = open(self.param_short_name).read().splitlines()[index] - 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)) - param_check = open(self.param_short_name).read().splitlines()[index] - #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), expectSuccess=False) - 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 = open(self.param_short_name).read().splitlines()[index] - 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), expectSuccess=None) - 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-legacy/PfwTestCase/Types/tUINT32_Max.py b/test/functional-tests-legacy/PfwTestCase/Types/tUINT32_Max.py deleted file mode 100644 index 9966ac3..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tUINT32_Max.py +++ /dev/null @@ -1,249 +0,0 @@ -#!/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 os -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 open(os.environ["PFW_RESULT"] + "/UINT32_Max").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/UINT32_Max").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/UINT32_Max").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/UINT32_Max").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/UINT32_Max").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/UINT32_Max").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/UINT32_Max").read()[:-1] == param_check, log.F("FILESYSTEM : Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tUINT8.py b/test/functional-tests-legacy/PfwTestCase/Types/tUINT8.py deleted file mode 100644 index 8a6c815..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tUINT8.py +++ /dev/null @@ -1,248 +0,0 @@ -#!/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 os -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 open(os.environ["PFW_RESULT"] + "/UINT8").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/UINT8").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/UINT8").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/UINT8").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/UINT8").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/UINT8").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/UINT8").read()[:-1] == param_check, log.F("FILESYSTEM : Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tUINT8_ARRAY.py b/test/functional-tests-legacy/PfwTestCase/Types/tUINT8_ARRAY.py deleted file mode 100644 index 88c2e58..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tUINT8_ARRAY.py +++ /dev/null @@ -1,370 +0,0 @@ -#!/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 os -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 = os.environ["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 - indexed_files_system_array_value = open(self.param_short_name).read().splitlines()[index] - 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 - indexed_files_system_array_value = open(self.param_short_name).read().splitlines()[index] - 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)) - param_check= open(self.param_short_name).read().splitlines()[index] - #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), expectSuccess=False) - 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 = open(self.param_short_name).read().splitlines()[index] - 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 - indexed_files_system_array_value = open(self.param_short_name).read().splitlines()[index] - 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)) - param_check= open(self.param_short_name).read().splitlines()[index] - #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), expectSuccess=False) - 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 = open(self.param_short_name).read().splitlines()[index] - 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), expectSuccess=None) - 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)) - param_check_1 = open(self.param_short_name).read().splitlines()[index] - param_check_2 = open(self.param_short_name).read().splitlines()[index + 1] - #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 = open(self.param_short_name).read().splitlines()[index + 1] - 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-legacy/PfwTestCase/Types/tUINT8_Max.py b/test/functional-tests-legacy/PfwTestCase/Types/tUINT8_Max.py deleted file mode 100644 index 71bfdab..0000000 --- a/test/functional-tests-legacy/PfwTestCase/Types/tUINT8_Max.py +++ /dev/null @@ -1,249 +0,0 @@ -#!/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 os -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 open(os.environ["PFW_RESULT"] + "/UINT8_Max").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/UINT8_Max").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/UINT8_Max").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/UINT8_Max").read()[:-1] == 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 open(os.environ["PFW_RESULT"] + "/UINT8_Max").read()[:-1] == 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 = open(os.environ["PFW_RESULT"] + "/UINT8_Max").read()[:-1] - #Set parameter value - out, err = self.pfw.sendCmd("setParameter", self.param_name, value, expectSuccess=False) - 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 open(os.environ["PFW_RESULT"] + "/UINT8_Max").read()[:-1] == param_check, log.F("FILESYSTEM : Forbiden parameter change") - log.I("test OK") diff --git a/test/functional-tests-legacy/PfwTestCase/__init__.py b/test/functional-tests-legacy/PfwTestCase/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/test/functional-tests-legacy/PfwTestCase/__init__.py +++ /dev/null diff --git a/test/functional-tests-legacy/README.md b/test/functional-tests-legacy/README.md deleted file mode 100644 index 43f5c59..0000000 --- a/test/functional-tests-legacy/README.md +++ /dev/null @@ -1,22 +0,0 @@ -#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-legacy/Util/ACTLogging.py b/test/functional-tests-legacy/Util/ACTLogging.py deleted file mode 100644 index fdc71ef..0000000 --- a/test/functional-tests-legacy/Util/ACTLogging.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*-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-legacy/Util/PfwUnitTestLib.py b/test/functional-tests-legacy/Util/PfwUnitTestLib.py deleted file mode 100644 index 78b1f76..0000000 --- a/test/functional-tests-legacy/Util/PfwUnitTestLib.py +++ /dev/null @@ -1,155 +0,0 @@ -# -*-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 os -import subprocess -import unittest -import time -import socket - -class RemoteCli(object): - - def setRemoteProcess(self, remoteProcess): - self.remoteProcess = remoteProcess - - def sendCmd(self, cmd, *args, **kwargs): - """ Execute a remote-process command and assert its result. - @param[in] cmd, *args the command to execute and its arguments - @param[in] expectSuccess If True, assert that the command will succeed - If False, assert that the command will succeed - If None, do not assert result - Default to True - @return (command stdout, None) None is return for legacy reason - """ - expectSuccess=kwargs.get("expectSuccess", True) - - assert self.remoteProcess.poll() == None, "Can not send command to Test platform as it has died. Return code: %s" % self.remoteProcess.returncode - - sys_cmd = self.platform_command + [cmd] - if args is not None: - sys_cmd += args - print "CMD : %s" % sys_cmd - - try: - p = subprocess.Popen(sys_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - except Exception as (errno, strerror): - return None, strerror - out, err = p.communicate() - out = out.rstrip('\r\n') - - if (expectSuccess != None): - assert (p.returncode == 0) == expectSuccess, "Unexpected command result:\nexpectedSuccess=%s\nCMD=%s\nreturncode=%s\nstdout=%s\nstderr=%s" % (expectSuccess, sys_cmd, p.returncode, out, err) - - return out, None - -class Pfw(RemoteCli): - platform_command = ["remote-process", "localhost", "5000"] - -class Hal(RemoteCli): - # Arbitrary choosen port, try to avoid conflicting with IANA registered ports - testPlatformPort = 18444 - platform_command = ["remote-process", "localhost", str(testPlatformPort)] - - def __init__(self, pfw): - self.pfw = pfw - - # Starts the HAL exe - def startHal(self): - cmd= ["test-platform", os.environ["PFW_TEST_CONFIGURATION"], str(self.testPlatformPort)] - self.setRemoteProcess(subprocess.Popen(cmd)) - # Wait for the test-platform listening socket - while socket.socket().connect_ex(("localhost", self.testPlatformPort)) != 0: - assert self.remoteProcess.poll() == None, "Test platform has failed to start. Return code: %s" % self.remoteProcess.returncode - time.sleep(0.01) - - # Send command "stop" to the HAL - def stopHal(self): - try: - self.sendCmd("exit") - except Exception as exitEx: - # Kill test-platform as cooperative exit failed - try: - self.remoteProcess.terminate() - except Exception as killEx: - raise Exception("Fail to terminate after a exit request failed", exitEx, killEx) - raise - else: - # exit request accepted, wait for server to stop - returncode = self.remoteProcess.wait() - assert returncode == 0, "test-platform did not stop succesfully: %s" % returncode - - 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("setSchemaUri", os.environ["PFW_SCHEMAS"]) - self.sendCmd("setValidateSchemasOnStart", "true") - self.sendCmd("start") - self.pfw.setRemoteProcess(self.remoteProcess) - -# A PfwTestCase gather tests performed on one instance of the PFW. -class PfwTestCase(unittest.TestCase): - - pfw = Pfw() - hal = Hal(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() - try: - # create criterions - cls.hal.createInclusiveCriterion("Crit_0", "2") - cls.hal.createExclusiveCriterion("Crit_1", "2") - # start the Pfw - cls.hal.start() - except Exception as startE: - # Leave the hal stopped in case of start failure - try: - cls.stopHal() - except Exception as stopE: - raise Exception("Fail to stop after a failed start: ", startE, stopE) - raise - - @classmethod - def stopHal(cls): - cls.hal.stopHal() diff --git a/test/functional-tests-legacy/Util/__init__.py b/test/functional-tests-legacy/Util/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/test/functional-tests-legacy/Util/__init__.py +++ /dev/null diff --git a/test/functional-tests-legacy/xml/XML_Test/Reference_Compliant.xml b/test/functional-tests-legacy/xml/XML_Test/Reference_Compliant.xml deleted file mode 100644 index 29bd3c5..0000000 --- a/test/functional-tests-legacy/xml/XML_Test/Reference_Compliant.xml +++ /dev/null @@ -1,185 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ConfigurableDomains - 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"> - <!-- The 'Component' tag has been renamed to 'ParameterBlock', but retro-compatibility is needed. - So keeping 'Component' to test it. --> - <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-legacy/xml/XML_Test/Reference_Criteria.xml b/test/functional-tests-legacy/xml/XML_Test/Reference_Criteria.xml deleted file mode 100644 index a2bd7cf..0000000 --- a/test/functional-tests-legacy/xml/XML_Test/Reference_Criteria.xml +++ /dev/null @@ -1,182 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ConfigurableDomains 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"> - <ParameterBlock 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> - </ParameterBlock> - </ConfigurableElement> - </Configuration> - <Configuration Name="Conf_1_0"> - <ConfigurableElement Path="/Test/Test/TEST_DIR"> - <ParameterBlock 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> - </ParameterBlock> - </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"> - <ParameterBlock Name="TEST_DOMAIN_0"> - <IntegerParameter Name="Param_00">4</IntegerParameter> - <IntegerParameter Name="Param_01">4</IntegerParameter> - <IntegerParameter Name="Param_02">4</IntegerParameter> - </ParameterBlock> - </ConfigurableElement> - </Configuration> - <Configuration Name="Conf_2_0"> - <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_0"> - <ParameterBlock Name="TEST_DOMAIN_0"> - <IntegerParameter Name="Param_00">5</IntegerParameter> - <IntegerParameter Name="Param_01">5</IntegerParameter> - <IntegerParameter Name="Param_02">5</IntegerParameter> - </ParameterBlock> - </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"> - <ParameterBlock Name="TEST_DOMAIN_1"> - <IntegerParameter Name="Param_10">4</IntegerParameter> - <IntegerParameter Name="Param_11">4</IntegerParameter> - <IntegerParameter Name="Param_12">4</IntegerParameter> - </ParameterBlock> - </ConfigurableElement> - </Configuration> - <Configuration Name="Conf_3_0"> - <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_1"> - <ParameterBlock Name="TEST_DOMAIN_1"> - <IntegerParameter Name="Param_10">5</IntegerParameter> - <IntegerParameter Name="Param_11">5</IntegerParameter> - <IntegerParameter Name="Param_12">5</IntegerParameter> - </ParameterBlock> - </ConfigurableElement> - </Configuration> - </Settings> - </ConfigurableDomain> -</ConfigurableDomains> diff --git a/test/functional-tests-legacy/xml/XML_Test/Reference_Split_Domain.xml b/test/functional-tests-legacy/xml/XML_Test/Reference_Split_Domain.xml deleted file mode 100644 index e6dfa55..0000000 --- a/test/functional-tests-legacy/xml/XML_Test/Reference_Split_Domain.xml +++ /dev/null @@ -1,167 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--DOMAIN 1 DEFINITION--> -<ConfigurableDomains - 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"> - <ParameterBlock Name="TEST_MAIN"> - <ParameterBlock 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> - </ParameterBlock> - <ParameterBlock Name="TEST_DIR_1"> - <IntegerParameter Name="Param_00">4</IntegerParameter> - <IntegerParameter Name="Param_01">4</IntegerParameter> - <IntegerParameter Name="Param_02">4</IntegerParameter> - </ParameterBlock> - <ParameterBlock Name="TEST_DIR_2"> - <IntegerParameter Name="Param_10">4</IntegerParameter> - <IntegerParameter Name="Param_11">4</IntegerParameter> - <IntegerParameter Name="Param_12">4</IntegerParameter> - </ParameterBlock> - </ParameterBlock> - </ConfigurableElement> - </Configuration> - <Configuration Name="Conf_1_0"> - <ConfigurableElement Path="/Test/Test/TEST_MAIN"> - <ParameterBlock Name="TEST_MAIN"> - <ParameterBlock 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> - </ParameterBlock> - <ParameterBlock Name="TEST_DIR_1"> - <IntegerParameter Name="Param_00">5</IntegerParameter> - <IntegerParameter Name="Param_01">5</IntegerParameter> - <IntegerParameter Name="Param_02">5</IntegerParameter> - </ParameterBlock> - <ParameterBlock Name="TEST_DIR_2"> - <IntegerParameter Name="Param_10">5</IntegerParameter> - <IntegerParameter Name="Param_11">5</IntegerParameter> - <IntegerParameter Name="Param_12">5</IntegerParameter> - </ParameterBlock> - </ParameterBlock> - </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-legacy/xml/XML_Test/Reference_dumpDomains b/test/functional-tests-legacy/xml/XML_Test/Reference_dumpDomains deleted file mode 100644 index 9277d20..0000000 --- a/test/functional-tests-legacy/xml/XML_Test/Reference_dumpDomains +++ /dev/null @@ -1,12 +0,0 @@ -- 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-legacy/xml/XML_Test/Reference_dumpDomains.xml b/test/functional-tests-legacy/xml/XML_Test/Reference_dumpDomains.xml deleted file mode 100644 index b80cc61..0000000 --- a/test/functional-tests-legacy/xml/XML_Test/Reference_dumpDomains.xml +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ConfigurableDomains - 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"> - <ParameterBlock Name="TEST_DOMAIN_0"> - <IntegerParameter Name="Param_00">0</IntegerParameter> - <IntegerParameter Name="Param_01">0</IntegerParameter> - <IntegerParameter Name="Param_02">0</IntegerParameter> - </ParameterBlock> - </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"> - <ParameterBlock Name="TEST_DOMAIN_1"> - <IntegerParameter Name="Param_10">4</IntegerParameter> - <IntegerParameter Name="Param_11">4</IntegerParameter> - <IntegerParameter Name="Param_12">4</IntegerParameter> - </ParameterBlock> - </ConfigurableElement> - </Configuration> - <Configuration Name="Conf_1_0"> - <ConfigurableElement Path="/Test/Test/TEST_DOMAIN_1"> - <ParameterBlock Name="TEST_DOMAIN_1"> - <IntegerParameter Name="Param_10">5</IntegerParameter> - <IntegerParameter Name="Param_11">5</IntegerParameter> - <IntegerParameter Name="Param_12">5</IntegerParameter> - </ParameterBlock> - </ConfigurableElement> - </Configuration> - </Settings> - </ConfigurableDomain> -</ConfigurableDomains> diff --git a/test/functional-tests-legacy/xml/XML_Test/Uncompliant_OutboundParameter.xml b/test/functional-tests-legacy/xml/XML_Test/Uncompliant_OutboundParameter.xml deleted file mode 100644 index f7fd329..0000000 --- a/test/functional-tests-legacy/xml/XML_Test/Uncompliant_OutboundParameter.xml +++ /dev/null @@ -1,103 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ConfigurableDomains - 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"> - <ParameterBlock 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> - </ParameterBlock> - </ConfigurableElement> - </Configuration> - <Configuration Name="Conf_1_0"> - <ConfigurableElement Path="/Test/Test/TEST_DIR"> - <ParameterBlock 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> - </ParameterBlock> - </ConfigurableElement> - </Configuration> - </Settings> - </ConfigurableDomain> -</ConfigurableDomains> diff --git a/test/functional-tests-legacy/xml/XML_Test/Uncompliant_UndeclaredConfigurableElement.xml b/test/functional-tests-legacy/xml/XML_Test/Uncompliant_UndeclaredConfigurableElement.xml deleted file mode 100644 index 98be4c5..0000000 --- a/test/functional-tests-legacy/xml/XML_Test/Uncompliant_UndeclaredConfigurableElement.xml +++ /dev/null @@ -1,103 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ConfigurableDomains - 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"> - <ParameterBlock 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> - </ParameterBlock> - </ConfigurableElement> - </Configuration> - <Configuration Name="Conf_1_0"> - <ConfigurableElement Path="/Test/Test/TEST_DIR"> - <ParameterBlock 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> - </ParameterBlock> - </ConfigurableElement> - </Configuration> - </Settings> - </ConfigurableDomain> -</ConfigurableDomains> diff --git a/test/functional-tests-legacy/xml/XML_Test/Uncompliant_UndeclaredParameter.xml b/test/functional-tests-legacy/xml/XML_Test/Uncompliant_UndeclaredParameter.xml deleted file mode 100644 index 01d4507..0000000 --- a/test/functional-tests-legacy/xml/XML_Test/Uncompliant_UndeclaredParameter.xml +++ /dev/null @@ -1,105 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ConfigurableDomains - 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"> - <ParameterBlock 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> - </ParameterBlock> - </ConfigurableElement> - </Configuration> - <Configuration Name="Conf_1_0"> - <ConfigurableElement Path="/Test/Test/TEST_DIR"> - <ParameterBlock 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> - </ParameterBlock> - </ConfigurableElement> - </Configuration> - </Settings> - </ConfigurableDomain> -</ConfigurableDomains> diff --git a/test/functional-tests-legacy/xml/XML_Test/Uncompliant_UnorderConfigurableElement.xml b/test/functional-tests-legacy/xml/XML_Test/Uncompliant_UnorderConfigurableElement.xml deleted file mode 100644 index 39af533..0000000 --- a/test/functional-tests-legacy/xml/XML_Test/Uncompliant_UnorderConfigurableElement.xml +++ /dev/null @@ -1,102 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ConfigurableDomains 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"> - <ParameterBlock 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> - </ParameterBlock> - </ConfigurableElement> - </Configuration> - <Configuration Name="Conf_1_0"> - <ConfigurableElement Path="/Test/Test/TEST_DIR"> - <ParameterBlock 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> - </ParameterBlock> - </ConfigurableElement> - </Configuration> - </Settings> - </ConfigurableDomain> -</ConfigurableDomains> diff --git a/test/functional-tests-legacy/xml/configuration/ParameterFrameworkConfiguration.xml b/test/functional-tests-legacy/xml/configuration/ParameterFrameworkConfiguration.xml deleted file mode 100644 index d050376..0000000 --- a/test/functional-tests-legacy/xml/configuration/ParameterFrameworkConfiguration.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ParameterFrameworkConfiguration - SystemClassName="Test" ServerPort="5000" TuningAllowed="true"> - <SubsystemPlugins> - <Location Folder=""> - <Plugin Name="test-subsystem"/> - </Location> - </SubsystemPlugins> - <StructureDescriptionFileLocation Path="Structure/Test/TestClass.xml"/> - <SettingsConfiguration> - <ConfigurableDomainsFileLocation Path="Settings/Test/TestConfigurableDomains.xml"/> - </SettingsConfiguration> -</ParameterFrameworkConfiguration> diff --git a/test/functional-tests-legacy/xml/configuration/Settings/Test/TestConfigurableDomains.xml b/test/functional-tests-legacy/xml/configuration/Settings/Test/TestConfigurableDomains.xml deleted file mode 100644 index c53e027..0000000 --- a/test/functional-tests-legacy/xml/configuration/Settings/Test/TestConfigurableDomains.xml +++ /dev/null @@ -1,142 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ConfigurableDomains - 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"> - <ParameterBlock 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> - </ParameterBlock> - </ConfigurableElement> - <ConfigurableElement Path="/Test/Test/TEST_TYPES"> - <ParameterBlock 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="BLOCK_UINT8">0</IntegerParameter> - <IntegerParameter Name="BLOCK_UINT16">0</IntegerParameter> - <IntegerParameter Name="BLOCK_UINT32">0</IntegerParameter> - </ParameterBlock> - </ParameterBlock> - </ConfigurableElement> - </Configuration> - <Configuration Name="Conf_1"> - <ConfigurableElement Path="/Test/Test/TEST_DIR"> - <ParameterBlock 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> - </ParameterBlock> - </ConfigurableElement> - <ConfigurableElement Path="/Test/Test/TEST_TYPES"> - <ParameterBlock 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="BLOCK_UINT8">0</IntegerParameter> - <IntegerParameter Name="BLOCK_UINT16">0</IntegerParameter> - <IntegerParameter Name="BLOCK_UINT32">0</IntegerParameter> - </ParameterBlock> - </ParameterBlock> - </ConfigurableElement> - </Configuration> - </Settings> - </ConfigurableDomain> -</ConfigurableDomains> diff --git a/test/functional-tests-legacy/xml/configuration/Structure/Test/TestClass.xml b/test/functional-tests-legacy/xml/configuration/Structure/Test/TestClass.xml deleted file mode 100644 index f2bd54c..0000000 --- a/test/functional-tests-legacy/xml/configuration/Structure/Test/TestClass.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<SystemClass - Name="Test"> - <SubsystemInclude Path="TestSubsystem.xml"/> -</SystemClass> diff --git a/test/functional-tests-legacy/xml/configuration/Structure/Test/TestSubsystem.xml.in b/test/functional-tests-legacy/xml/configuration/Structure/Test/TestSubsystem.xml.in deleted file mode 100644 index e7a8155..0000000 --- a/test/functional-tests-legacy/xml/configuration/Structure/Test/TestSubsystem.xml.in +++ /dev/null @@ -1,85 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Subsystem - Name="Test" Type="TEST"> - <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="BLOCK_UINT8" Size="8" Signed="false" Mapping="Binary:BLOCK_UINT8"/> - <IntegerParameter Name="BLOCK_UINT16" Size="16" Signed="false" Mapping="Binary:BLOCK_UINT16"/> - <IntegerParameter Name="BLOCK_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/functional-tests/AutoSync.cpp b/test/functional-tests/AutoSync.cpp deleted file mode 100644 index 9353b8d..0000000 --- a/test/functional-tests/AutoSync.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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 "Config.hpp" -#include "ParameterFramework.hpp" -#include <SubsystemObject.h> -#include <IntrospectionEntryPoint.h> -#include "Test.hpp" -#include <catch.hpp> -#include <string> - -using std::string; - -namespace parameterFramework -{ - -struct BoolPF : public ParameterFramework -{ - BoolPF() : ParameterFramework{createConfig()} {} - - /** Set the boolean parameter value within the "Conf" configuration, - * which is always applicable. */ - void setParameterValue(bool value) - { - std::string valueStr = value ? "1" : "0"; - setConfigurationParameter("Domain", "Conf", "/test/test/param", valueStr); - } - -private: - static Config createConfig() - { - Config config; - config.instances = R"(<BooleanParameter Name="param" Mapping="Object"/>)"; - config.plugins = {{"", {"introspection-subsystem"}}}; - config.subsystemType = "INTROSPECTION"; - - config.domains = R"(<ConfigurableDomain Name="Domain"> - <Configurations> - <Configuration Name="Conf"> - <CompoundRule Type="All"/> - </Configuration> - </Configurations> - - <ConfigurableElements> - <ConfigurableElement Path="/test/test/param"/> - </ConfigurableElements> - - <Settings> - <Configuration Name="Conf"> - <ConfigurableElement Path="/test/test/param"> - <BooleanParameter Name="param">0</BooleanParameter> - </ConfigurableElement> - </Configuration> - </Settings> - </ConfigurableDomain>)"; - - return config; - } -}; - -SCENARIO_METHOD(BoolPF, "Auto sync") -{ - GIVEN ("A Pfw that starts") { - REQUIRE_NOTHROW(start()); - - THEN ("Parameter value is false according to the settings") { - REQUIRE_FALSE(introspectionSubsystem::getParameterValue()); - - AND_THEN ("Tuning is off") { - REQUIRE_FALSE(isTuningModeOn()); - - WHEN ("Turning autosync on") { - REQUIRE_NOTHROW(setAutoSync(true)); - - AND_WHEN ("A parameter is set") { - REQUIRE_NOTHROW(setParameterValue(true)); - - THEN ("Sync is done") { - CHECK(introspectionSubsystem::getParameterValue()); - } - } - } - WHEN ("Turning autosync off") { - REQUIRE_NOTHROW(setAutoSync(false)); - - AND_WHEN ("A parameter is set") { - REQUIRE_NOTHROW(setParameterValue(true)); - - THEN ("Sync should not have occurred yet") { - REQUIRE_FALSE(introspectionSubsystem::getParameterValue()); - - WHEN ("Turning autosync on") { - REQUIRE_NOTHROW(setAutoSync(true)); - - THEN ("Sync is done") { - CHECK(introspectionSubsystem::getParameterValue()); - } - } - } - } - } - } - } - } -} -} diff --git a/test/functional-tests/Basic.cpp b/test/functional-tests/Basic.cpp deleted file mode 100644 index 60e6bbc..0000000 --- a/test/functional-tests/Basic.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* - * 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 "Test.hpp" -#include "Config.hpp" -#include "StoreLogger.hpp" -#include "ParameterFramework.hpp" - -#include <catch.hpp> - -#include <list> -#include <string> - -#include <cstdio> - -namespace parameterFramework -{ - -SCENARIO_METHOD(ParameterFramework, "Default logger", "[log]") -{ - WHEN ("No logger is set") { - THEN ("Start should succeed") { - CHECK_NOTHROW(start()); - } - } -} - -SCENARIO_METHOD(ParameterFramework, "No Logger", "[log]") -{ - WHEN ("A nullptr logger is set") { - setLogger(nullptr); - THEN ("Start should succeed") { - CHECK_NOTHROW(start()); - } - } -} - -SCENARIO("Logger should receive info and warnings", "[log]") -{ - GIVEN ("A logger that stores logs") { - /* Instantiating logger first to ensure that its lifetime is longer than the pfw's one, - * because the pfw references the logger. */ - StoreLogger logger{}; - GIVEN ("A parameter framework") { - WarningPF pfw; - GIVEN ("Config files that emit warnings") { - WHEN ("The record logger is set") { - pfw.setLogger(&logger); - THEN ("Start should succeed") { - REQUIRE_NOTHROW(pfw.start()); - AND_THEN ("The logger should have stored info and warning log") { - using Logs = StoreLogger::Logs; - using Level = StoreLogger::Log::Level; - CHECK(logger.filter(Level::warning) != Logs{}); - CHECK(logger.getLogs() != Logs{}); - } - } - AND_WHEN ("A nullptr logger is set") { - pfw.setLogger(nullptr); - THEN ("Start should succeed") { - REQUIRE_NOTHROW(pfw.start()); - AND_THEN ("The record logger should NOT have stored any info or " - "warning log") { - CHECK(logger.getLogs() == StoreLogger::Logs{}); - } - } - } - } - } - } - } -} - -SCENARIO_METHOD(LazyPF, "Tuning OK", "[properties][remote interface]") -{ -} - -SCENARIO_METHOD(LazyPF, "Invalid XML configuration") -{ - for (auto &xmlT : Tests<std::string>{{"an unknown tag", "<unknown_tag/>"}, - {"an unclosed tag", "<unclosed>"}}) { - auto invalidXml = xmlT.payload; - GIVEN ("An invalid xml: containing " + xmlT.title) { - Config::Plugins ps{}; - for (auto &&configT : Tests<Config>{ - {"top config", {&Config::plugins, Config::Plugins{{"", {invalidXml}}}}}, - {"structure", {&Config::instances, invalidXml}}, - {"settings", {&Config::domains, invalidXml}}}) { - WHEN ("Used in the " + configT.title) { - create(std::move(configT.payload)); - THEN ("Start should fail") { - CHECK_THROWS_AS(mPf->start(), Exception); - } - } - } - } - } -} - -SCENARIO_METHOD(LazyPF, "Plugin OK", "[properties][missing plugin policy]") -{ - for (auto &pluginNameT : - Tests<std::string>{{"an non existing plugin", "libdonetexist.so"}, - {"an existing library but invalid (linux) PF plugin", "libc.so.6"}}) { - GIVEN ("An" + pluginNameT.title) { - create({&Config::plugins, Config::Plugins{{"", {pluginNameT.payload}}}}); - WHEN ("The missing subsystem policy is left to default") { - THEN ("Start should fail") { - CHECK_THROWS_AS(mPf->start(), Exception); - } - } - WHEN ("The missing subsystem policy is set to failure") { - mPf->setFailureOnMissingSubsystem(true); - THEN ("Start should fail") { - CHECK_THROWS_AS(mPf->start(), Exception); - } - } - WHEN ("The missing subsystem policy is set to ignore") { - mPf->setFailureOnMissingSubsystem(false); - THEN ("Start should success") { - CHECK_NOTHROW(mPf->start()); - } - } - } - } -} - -SCENARIO_METHOD(LazyPF, "Invalid domains", "[properties]") -{ - GIVEN ("An invalid domain file") { - create({&Config::domains, "<Domain name='Invalid'/>"}); - THEN ("Start should fail") { - CHECK_THROWS_AS(mPf->start(), Exception); - } - WHEN ("Changing failure setting load policy to ignore") { - mPf->setFailureOnFailedSettingsLoad(false); - THEN ("Start should succeed") { - CHECK_NOTHROW(mPf->start()); - } - } - } -} - -SCENARIO_METHOD(ParameterFramework, "Raw value space") -{ - WHEN ("Raw value space is set") { - setRawValueSpace(true); - THEN ("Value space should be raw") { - CHECK(isValueSpaceRaw() == true); - } - } -} - -} // parameterFramework diff --git a/test/functional-tests/CMakeLists.txt b/test/functional-tests/CMakeLists.txt deleted file mode 100644 index 1ab0449..0000000 --- a/test/functional-tests/CMakeLists.txt +++ /dev/null @@ -1,52 +0,0 @@ -# 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) - - # TODO: create a libxml2 library to properly export those definition & include - # so that client only have to link with libxml2 - include_directories(include) - - # Add unit test - add_executable(parameterFunctionalTest - Basic.cpp - FloatingPoint.cpp - Handle.cpp - AutoSync.cpp) - - find_package(LibXml2 REQUIRED) - - target_link_libraries(parameterFunctionalTest - PRIVATE parameter catch tmpfile LibXml2::libxml2 introspection-subsystem) - - add_test(NAME parameterFunctionalTest - COMMAND parameterFunctionalTest) - - # Custom function defined in the top-level CMakeLists - set_test_env(parameterFunctionalTest) -endif() diff --git a/test/functional-tests/FloatingPoint.cpp b/test/functional-tests/FloatingPoint.cpp deleted file mode 100644 index fd41797..0000000 --- a/test/functional-tests/FloatingPoint.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* - * 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 "Config.hpp" -#include "ParameterFramework.hpp" -#include "ElementHandle.hpp" -#include "Test.hpp" -#include "BinaryCopy.hpp" - -#include <catch.hpp> - -#include <string> - -using std::string; - -namespace parameterFramework -{ - -const auto validInstances = Config{&Config::instances, - // Size is fixed at 32 and as such is optional */ - R"(<FloatingPointParameter Name="Empty"/> - <FloatingPointParameter Name="trivial" Size="32"/> - <FloatingPointParameter Name="nominal" Size="32" Min="-50.4" Max="12.2"/> - <FloatingPointParameter Name="defaultMin" Size="32" Max="12.2"/> - <FloatingPointParameter Name="defaultMax" Size="32" Min="-50.4"/>)"}; -const auto &invalidParameters = - Tests<string>{{"invalid Size(64)", "<FloatingPointParameter Name='error' Size='64'/>"}, - {"invalid Size(16)", "<FloatingPointParameter Name='error' Size='16'/>"}, - {"minimum > maximum", "<FloatingPointParameter Name='error' Min='1' Max='0'/>"}}; - -struct FloatsPF : public ParameterFramework -{ - FloatsPF() : ParameterFramework{std::move(validInstances)} {} -}; - -SCENARIO_METHOD(LazyPF, "Invalid floating points XML structure", "[floating point]") -{ - for (auto &vec : invalidParameters) { - GIVEN ("intentional error: " + vec.title) { - create(Config{&Config::instances, vec.payload}); - THEN ("Start should fail") { - CHECK_THROWS_AS(mPf->start(), Exception); - } - } - } -} - -SCENARIO_METHOD(FloatsPF, "Floating points", "[floating points]") -{ - GIVEN ("A valid XML structure file") { - THEN ("Start should succeed") { - CHECK_NOTHROW(start()); - REQUIRE_NOTHROW(setTuningMode(true)); - string path = "/test/test/nominal"; - - AND_THEN ("Set/Get a floating point parameter in real value space") { - - for (auto &vec : Tests<string>{ - {"(too high)", "12.3"}, - {"(too low)", "-50.5"}, - {"(not a number)", "foobar"}, - }) { - GIVEN ("Invalid value " + vec.title) { - CHECK_THROWS_AS(setParameter(path, vec.payload), Exception); - } - } - for (auto &vec : Tests<string>{ - {"(upper limit)", "12.2"}, - {"(lower limit)", "-50.4"}, - {"(inside range)", "0"}, - }) { - GIVEN ("A valid value " + vec.title) { - CHECK_NOTHROW(setParameter(path, vec.payload)); - string getValueBack; - REQUIRE_NOTHROW(getParameter(path, getValueBack)); - CHECK(getValueBack == vec.payload); - } - } - } - - AND_THEN ("Set/Get a floating point parameter in raw value space") { - const float tooHigh = 12.3f; - const float tooLow = -50.5f; - const float nan = std::numeric_limits<float>::quiet_NaN(); - const float inf = std::numeric_limits<float>::infinity(); - REQUIRE_NOTHROW(setRawValueSpace(true)); - for (auto &vec : Tests<string>{ - {"(too high, as decimal)", - std::to_string(::utility::binaryCopy<uint32_t>(tooHigh))}, - {"(too low, as decimal)", - std::to_string(::utility::binaryCopy<uint32_t>(tooLow))}, - {"(meaningless)", "foobar"}, - {"(infinity)", std::to_string(::utility::binaryCopy<uint32_t>(inf))}, - {"(NaN)", std::to_string(::utility::binaryCopy<uint32_t>(nan))}, - }) { - GIVEN ("Invalid value " + vec.title) { - CHECK_THROWS_AS(setParameter(path, vec.payload), Exception); - } - } - const float upper = 12.2f; - const float lower = -50.4f; - const float zero = 0.0f; - for (auto &vec : Tests<string>{ - {"(upper limit, as decimal)", - std::to_string(::utility::binaryCopy<uint32_t>(upper))}, - {"(lower limit, as decimal)", - std::to_string(::utility::binaryCopy<uint32_t>(lower))}, - {"(inside range, as decimal)", - std::to_string(::utility::binaryCopy<uint32_t>(zero))}, - }) { - GIVEN ("A valid value " + vec.title) { - CHECK_NOTHROW(setParameter(path, vec.payload)); - string getValueBack; - REQUIRE_NOTHROW(getParameter(path, getValueBack)); - CHECK(getValueBack == vec.payload); - } - } - } - - AND_THEN ("Set/Get floating point parameter handle") { - ElementHandle handle{*this, path}; - /** @FIXME: 'set' operations on a ParameterHandle are silently - * ignored in tuning mode. Does it make sense ? */ - REQUIRE_NOTHROW(setTuningMode(false)); - - /* warning: even though the API below takes a double as - * argument, we need to define the test vector as floats in - * order to prevent rounding issues */ - for (auto &vec : Tests<float>{ - {"(upper limit)", 12.2f}, - {"(lower limit)", -50.4f}, - {"(inside range)", 0.0f}, - }) { - GIVEN ("A valid value " + vec.title) { - CHECK_NOTHROW(handle.setAsDouble(vec.payload)); - double getValueBack; - REQUIRE_NOTHROW(handle.getAsDouble(getValueBack)); - CHECK(getValueBack == vec.payload); - } - } - for (auto &vec : Tests<float>{ - {"(too high)", 12.3f}, {"(too low)", -50.5f}, - }) { - GIVEN ("An invalid value " + vec.title) { - CHECK_THROWS_AS(handle.setAsDouble(vec.payload), Exception); - } - } - } - } - } -} -} diff --git a/test/functional-tests/Handle.cpp b/test/functional-tests/Handle.cpp deleted file mode 100644 index d7aafb9..0000000 --- a/test/functional-tests/Handle.cpp +++ /dev/null @@ -1,665 +0,0 @@ -/* - * 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 "Config.hpp" -#include "Test.hpp" -#include "Exception.hpp" -#include "TmpFile.hpp" - -#include "ParameterFramework.hpp" -#include "ElementHandle.hpp" - -#include <catch.hpp> - -#include <libxml/parser.h> -#include <libxml/tree.h> - -#include <string> -#include <list> - -#include <stdlib.h> - -using std::string; -using std::list; -using Bytes = std::vector<uint8_t>; - -namespace parameterFramework -{ - -struct AllParamsPF : public ParameterFramework -{ - AllParamsPF() : ParameterFramework{getConfig()} { REQUIRE_NOTHROW(start()); } - - string getBasicParams() - { - string structure = R"( - <BooleanParameter Name="bool" Description="bool"/> - <BooleanParameter ArrayLength="2" Name="bool_array" Description="bool-array"/> - - <IntegerParameter Signed="false" Min="33" Max="123" Size="16" Name="integer"/> - <IntegerParameter Signed="true" Min="-10" Max="10" Size="32" ArrayLength="4" Name="integer_array"/> - - <FixedPointParameter Size="32" Integral="3" Fractional="4" Name="fix_point"/> - <FixedPointParameter Size="32" Integral="3" Fractional="4" ArrayLength="3" Name="fix_point_array"/> - - <EnumParameter Size="8" Name="enum"> - <ValuePair Literal="min" Numerical="-128"/> - <ValuePair Literal="five" Numerical="5"/> - <ValuePair Literal="max" Numerical="127"/> - </EnumParameter> - <EnumParameter Size="16" ArrayLength="4" Name="enum_array"> - <ValuePair Literal="eight" Numerical="8"/> - <ValuePair Literal="min" Numerical="-32767"/> - </EnumParameter>)"; - - // String and bit parameter arrays are not supported - structure += R"( - <StringParameter MaxLength="63" Name="string"/> - - <BitParameterBlock Size="64" Name="bit_block"> - <BitParameter Pos="1" Size="1" Max="1" Name="one"/> - <BitParameter Pos="2" Size="2" Max="2" Name="two"/> - <BitParameter Pos="6" Size="6" Max="10" Name="six"/> - <BitParameter Pos="16" Size="16" Max="99" Name="sixteen"/> - <BitParameter Pos="32" Size="32" Max="4294967295" Name="thirty_two"/> - </BitParameterBlock> - )"; - return structure; - } - - Config getConfig() - { - Config config; - config.components = nodeDesc("ComponentType", "component_type", getBasicParams()); - config.instances = - getBasicParams() + nodeDesc("ParameterBlock", "parameter_block", getBasicParams()) + - nodeDesc("ParameterBlock", "parameter_block_array", getBasicParams(), - "ArrayLength='2'") + - nodeDesc("Component", "component_scalar", "", "Type='component_type'") + - nodeDesc("Component", "component_array", "", "Type='component_type' ArrayLength='2'"); - return config; - } - - void checkStructure(const string &path, const string &expected) - { - CHECK_NOTHROW(checkXMLEq(ElementHandle{*this, path}.getStructureAsXML(), expected)); - } - - /** Use libxml2 to pretty format xml. - * Equivalent of xmllint --format - */ - static string canonicalizeXML(const string &xml) - { - // Parse xml - // Might be better to specialize std::default_delete<xmlDoc>. - std::unique_ptr<xmlDoc, void (*)(xmlDoc *)> doc{ - xmlReadMemory(xml.c_str(), (int)xml.length(), "structure.xml", nullptr, - XML_PARSE_NOBLANKS), - xmlFreeDoc}; - if (doc == nullptr) { - throw Exception{"Failed to parse document: " + xml}; - } - - // Dump it formated - int size; - - // Need to use exception unsafe raw pointer as of libxml2 c api - xmlChar *unsafeFormated; - - // TODO: Should use canonicalization (aka c14n). - // cf: http://xmlsoft.org/html/libxml-c14n.html - // https://en.wikipedia.org/wiki/Canonical_XML - // Additionally to what is listed on that page, - // attributes are also ordered deterministically. - // That would solve the workaround in the node function with pre/post attributes. - // Unfortunately c14n is not available in appveyor (Windows CI) libxml2 prebuild - xmlDocDumpFormatMemoryEnc(doc.get(), &unsafeFormated, &size, "UTF-8", 1); - std::unique_ptr<xmlChar, void (*)(void *)> formated{unsafeFormated, xmlFree}; - - if (formated == nullptr) { - throw Exception{"Could not dump xml: " + xml}; - } - - return string{(char *)formated.get()}; - } - - static void checkEq(const string &result, const string &expected) - { - CHECK(result == expected); - - // Pretty print the word differences with colors - // It does not matter if it fails as the test would still fail - // due to the above CHECK. - if (result != expected) { - utility::TmpFile resultFile(result); - utility::TmpFile expectedFile(expected); - string command = "git --no-pager diff --word-diff-regex='[^ <>]+'" - " --color --no-index --exit-code " + - resultFile.getPath() + ' ' + expectedFile.getPath(); - - // `system` return -1 or 127 on failure, the command error code otherwise - // `git diff` return 1 if the files are the different (thanks to --exit-code) - auto status = system(command.c_str()); -#ifdef WIFEXITED // Posix platform - bool success = WIFEXITED(status) and WEXITSTATUS(status) == 1; -#else - bool success = status == 1; -#endif - if (not success) { - WARN("Warning: Failed to pretty-print the difference between " - "actual and expected results with `git diff'"); - } - } - } - - static void checkXMLEq(const string &result, const string &expected) - { - checkEq(canonicalizeXML(result), canonicalizeXML(expected)); - } - - static string node(string tag, string name, string content, string attributes = "", - string postAttributes = "") - { - return "<" + tag + " " + attributes + " Name='" + name + "' " + postAttributes + ">" + - content + "</" + tag + ">"; - } - /** Node with a description. - * @param[in] maybeDescription If nullptr, description will be generated from the name - * Otherwise, the description. - */ - static string nodeDesc(string tag, string name, string content, string attributes = "", - const char *maybeDescription = nullptr) - { - string description = "description_" + name; - if (maybeDescription != nullptr) { - description = maybeDescription; - } - return node(tag, name, content, attributes, "Description='" + description + "'"); - } - - static string rootNode(string name, string attributes, string content) - { - return '<' + name + ' ' + attributes + '>' + content + "</" + name + '>'; - } -}; - -SCENARIO_METHOD(AllParamsPF, "Export boolean", "[handler][structure][xml]") -{ - string expected = rootNode("BooleanParameter", "Name='bool' Description='bool'", ""); - checkStructure("/test/test/bool", expected); -} - -SCENARIO_METHOD(AllParamsPF, "Export component", "[handler][structure][xml]") -{ - string expected = rootNode("ParameterBlock", "Name='component_scalar' " - "Description='description_component_scalar'", - getBasicParams()); - checkStructure("/test/test/component_scalar", expected); -} - -SCENARIO_METHOD(AllParamsPF, "Export component array", "[handler][structure][xml]") -{ - string expected = rootNode( - "ParameterBlock", "Name='component_array' Description='description_component_array'", - nodeDesc("ParameterBlock", "0", getBasicParams(), "", "description_component_array") + - nodeDesc("ParameterBlock", "1", getBasicParams(), "", "description_component_array")); - checkStructure("/test/test/component_array", expected); -} - -SCENARIO_METHOD(AllParamsPF, "Export all parameters", "[handler][structure][xml]") -{ - string paramExpected = getBasicParams() + - nodeDesc("ParameterBlock", "parameter_block", getBasicParams()) + - nodeDesc("ParameterBlock", "parameter_block_array", - nodeDesc("ParameterBlock", "0", getBasicParams(), "", - // description is inherited from array - "description_parameter_block_array") + - nodeDesc("ParameterBlock", "1", getBasicParams(), "", - "description_parameter_block_array")) + - // Components should be exported as parameterBlock - nodeDesc("ParameterBlock", "component_scalar", getBasicParams()) + - nodeDesc("ParameterBlock", "component_array", - nodeDesc("ParameterBlock", "0", getBasicParams(), "", - // description is inherited from array - "description_component_array") + - nodeDesc("ParameterBlock", "1", getBasicParams(), "", - "description_component_array")); - - WHEN ("Exporting subsystem") { - string expected = rootNode("Subsystem", "Name='test'", paramExpected); - checkStructure("/test/test", expected); - } - - WHEN ("Exporting systemClass") { - string expected = rootNode("SystemClass", "Name='test'", - "<Subsystem Name='test'>" + paramExpected + "</Subsystem>"); - - // Awkwardly, the root and its first child are the same element - checkStructure("/test", expected); - checkStructure("/", expected); - } -} - -struct SettingsTestPF : public AllParamsPF -{ - static string parameterBlockNode(string name, string settings) - { - return node("ParameterBlock", name, settings); - }; - static string mkBasicSettings(string settings, string name) - { - return rootNode("ParameterBlock", "Name='" + name + "'", settings); - } - - static string fullXMLSettings(const string &basicSettings) - { - string settings = basicSettings; - settings += - parameterBlockNode("parameter_block", settings) + - parameterBlockNode("parameter_block_array", parameterBlockNode("0", settings) + - parameterBlockNode("1", settings)) + - parameterBlockNode("component_scalar", settings) + - parameterBlockNode("component_array", parameterBlockNode("0", settings) + - parameterBlockNode("1", settings)); - - return rootNode("SystemClass", "Name='test'", node("Subsystem", "test", settings, "")); - } - - static string fullBytesSettings(const string &basicSettings) - { - string fullSettings; - // We have the "basic params" repeated 7 times across the test - // structure - for (size_t i = 0; i < 7; ++i) { - fullSettings += basicSettings; - } - return fullSettings; - } - - /** Print Bytes as string separated hexadecimal number. */ - static string showBytes(const Bytes &bytes) - { - using namespace std; - ostringstream ss; - ss.exceptions(ostream::badbit | ostream::failbit); - for (auto byte : bytes) { - ss << hex << setw(2) << setfill('0') << int{byte} << ' '; - } - return ss.str(); - } - - static Bytes readBytes(const string &strBytes) - { - using namespace std; - istringstream ss{strBytes}; - ss.exceptions(istream::badbit | istream::failbit); - Bytes bytes(strBytes.size() / 3); - - for (auto &byte : bytes) { - uint16_t notCharByte; - ss >> hex >> setw(2) >> notCharByte; - byte = static_cast<char>(notCharByte); - } - return bytes; - } - - static void checkBytesEq(const Bytes &result, const string &expect) - { - checkEq(showBytes(result), expect); - } - static void checkBytesEq(const Bytes &result, const Bytes &expect) - { - checkEq(showBytes(result), showBytes(expect)); - } -}; - -static const char *defaultBasicSettingsXML = R"( - <BooleanParameter Name="bool">0</BooleanParameter> - <BooleanParameter Name="bool_array">0 0</BooleanParameter> - <IntegerParameter Name="integer">33</IntegerParameter> - <IntegerParameter Name="integer_array">-10 -10 -10 -10</IntegerParameter> - <FixedPointParameter Name="fix_point">0.0000</FixedPointParameter> - <FixedPointParameter Name="fix_point_array">0.0000 0.0000 0.0000</FixedPointParameter> - <EnumParameter Name="enum">min</EnumParameter> - <EnumParameter Name="enum_array">eight eight eight eight</EnumParameter> - <StringParameter Name="string"></StringParameter> - <BitParameterBlock Name="bit_block"> - <BitParameter Name="one">0</BitParameter> - <BitParameter Name="two">0</BitParameter> - <BitParameter Name="six">0</BitParameter> - <BitParameter Name="sixteen">0</BitParameter> - <BitParameter Name="thirty_two">0</BitParameter> - </BitParameterBlock> -)"; - -static const char *testBasicSettingsXML = R"( - <BooleanParameter Name="bool">1</BooleanParameter> - <BooleanParameter Name="bool_array">0 1</BooleanParameter> - <IntegerParameter Name="integer">100</IntegerParameter> - <IntegerParameter Name="integer_array">-10 0 8 10</IntegerParameter> - <FixedPointParameter Name="fix_point">2.2500</FixedPointParameter> - <FixedPointParameter Name="fix_point_array">7.1250 0.6875 -1.0000</FixedPointParameter> - <EnumParameter Name="enum">five</EnumParameter> - <EnumParameter Name="enum_array">eight min eight min</EnumParameter> - <StringParameter Name="string">A string of 32 character.@@@@@@@</StringParameter> - <BitParameterBlock Name="bit_block"> - <BitParameter Name="one">1</BitParameter> - <BitParameter Name="two">2</BitParameter> - <BitParameter Name="six">10</BitParameter> - <BitParameter Name="sixteen">72</BitParameter> - <BitParameter Name="thirty_two">4294967295</BitParameter> - </BitParameterBlock> -)"; -static const char *testRawHexBasicSettingsXML = R"( - <BooleanParameter Name="bool">0x1</BooleanParameter> - <BooleanParameter Name="bool_array">0x0 0x1</BooleanParameter> - <IntegerParameter Name="integer">0x0064</IntegerParameter> - <IntegerParameter Name="integer_array">0xFFFFFFF6 0x00000000 0x00000008 0x0000000A</IntegerParameter> - <FixedPointParameter ValueSpace="Raw" Name="fix_point">0x24000000</FixedPointParameter> - <FixedPointParameter ValueSpace="Raw" Name="fix_point_array">0x72000000 0x0B000000 0xF0000000</FixedPointParameter> - <EnumParameter Name="enum">five</EnumParameter> - <EnumParameter Name="enum_array">eight min eight min</EnumParameter> - <StringParameter Name="string">A string of 32 character.@@@@@@@</StringParameter> - <BitParameterBlock Name="bit_block"> - <BitParameter Name="one">0x1</BitParameter> - <BitParameter Name="two">0x2</BitParameter> - <BitParameter Name="six">0xA</BitParameter> - <BitParameter Name="sixteen">0x48</BitParameter> - <BitParameter Name="thirty_two">0xFFFFFFFF</BitParameter> - </BitParameterBlock> -)"; - -SCENARIO_METHOD(SettingsTestPF, "Export and import XML settings", "[handler][settings][xml]") -{ - WHEN ("Exporting root XML") { - auto getAsXML = [this](string path) { return ElementHandle(*this, path).getAsXML(); }; - CHECK(getAsXML("/") == getAsXML("/test")); - checkXMLEq(getAsXML("/"), fullXMLSettings(defaultBasicSettingsXML)); - } - - ElementHandle basicParams(*this, "/test/test/parameter_block"); - WHEN ("Exporting basic parameter XML") { - checkXMLEq(basicParams.getAsXML(), - mkBasicSettings(defaultBasicSettingsXML, "parameter_block")); - } - string testSettings = mkBasicSettings(testBasicSettingsXML, "parameter_block"); - string rawTestSettings = mkBasicSettings(testRawHexBasicSettingsXML, "parameter_block"); - - auto checkExport = [&] { - THEN ("Exported settings should be the ones imported") { - checkXMLEq(basicParams.getAsXML(), testSettings); - } - THEN ("Exported raw settings should be the ones imported") { - setRawValueSpace(true); - setHexOutputFormat(true); - checkXMLEq(basicParams.getAsXML(), rawTestSettings); - } - }; - WHEN ("Importing basic parameter XML") { - CHECK_NOTHROW(basicParams.setAsXML(testSettings)); - checkExport(); - } - WHEN ("Importing raw basic parameter XML") { - CHECK_NOTHROW(basicParams.setAsXML(rawTestSettings)); - checkExport(); - } -} - -static const string defaultBasicSettingsBytes = - "00 00 00 21 00 f6 ff ff ff f6 ff ff ff f6 ff ff ff f6 ff ff ff 00 00 00 00 " - "00 00 00 00 00 00 00 00 00 00 00 00 80 08 00 08 00 08 00 08 00 00 00 00 00 00 " - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 " - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 " - "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "; - -static const string testBasicSettingsBytes = - "01 00 01 64 00 f6 ff ff ff 00 00 00 00 08 00 00 00 0a 00 00 00 00 00 00 24 " - "00 00 00 72 00 00 00 0b 00 00 00 f0 05 08 00 01 80 08 00 01 80 41 20 73 74 72 " - "69 6e 67 20 6f 66 20 33 32 20 63 68 61 72 61 63 74 65 72 2e 40 40 40 40 40 40 " - "40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 " - "00 00 00 00 00 00 00 8a 02 48 00 ff ff ff ff "; - -SCENARIO_METHOD(SettingsTestPF, "Bijection of binary show and read", "[identity][test]") -{ - CHECK(showBytes(readBytes(testBasicSettingsBytes)) == testBasicSettingsBytes); -} - -SCENARIO_METHOD(SettingsTestPF, "Export and import root binary settings", - "[handler][settings][bytes]") -{ - ElementHandle root(*this, "/"); - ElementHandle systemClass(*this, "/"); - - THEN ("Root and system class should export the same binary") { - checkBytesEq(root.getAsBytes(), systemClass.getAsBytes()); - } - WHEN ("Exporting root binary") { - checkBytesEq(root.getAsBytes(), fullBytesSettings(defaultBasicSettingsBytes)); - } - WHEN ("Importing root binary") { - string rootTestSettings = fullBytesSettings(testBasicSettingsBytes); - REQUIRE_NOTHROW(root.setAsBytes(readBytes(rootTestSettings))); - THEN ("Exported settings should be the ones imported") { - checkBytesEq(root.getAsBytes(), rootTestSettings); - } - } -} - -SCENARIO_METHOD(SettingsTestPF, "Export and import basic binary settings", - "[handler][settings][bytes]") -{ - ElementHandle basicParams(*this, "/test/test/parameter_block"); - WHEN ("Exporting basic parameter binary") { - checkBytesEq(basicParams.getAsBytes(), defaultBasicSettingsBytes); - } - WHEN ("Importing basic parameter binary") { - REQUIRE_NOTHROW(basicParams.setAsBytes(readBytes(testBasicSettingsBytes))); - THEN ("Exported settings should be the ones imported") { - checkBytesEq(basicParams.getAsBytes(), testBasicSettingsBytes); - } - } -} - -SCENARIO_METHOD(SettingsTestPF, "Export and import array binary settings", - "[handler][settings][bytes]") -{ - ElementHandle array(*this, "/test/test/parameter_block_array"); - ElementHandle elem0(*this, "/test/test/parameter_block_array/0"); - WHEN ("Importing one array element") { - REQUIRE_NOTHROW(elem0.setAsBytes(readBytes(testBasicSettingsBytes))); - THEN ("The other element should not have changed") { - checkBytesEq(array.getAsBytes(), testBasicSettingsBytes + defaultBasicSettingsBytes); - } - } -} - -SCENARIO_METHOD(SettingsTestPF, "Import root in one format, export in an other", - "[handler][settings][bytes][xml]") -{ - ElementHandle root(*this, "/test"); - string rootBytesSettings = fullBytesSettings(testBasicSettingsBytes); - string rootXMLSettings = fullXMLSettings(testBasicSettingsXML); - - WHEN ("Importing root binary") { - REQUIRE_NOTHROW(root.setAsBytes(readBytes(rootBytesSettings))); - THEN ("Exported XML settings should be the ones imported") { - checkXMLEq(root.getAsXML(), rootXMLSettings); - } - } - - WHEN ("Importing root XML") { - REQUIRE_NOTHROW(root.setAsXML(rootXMLSettings)); - THEN ("Exported bytes settings should be the ones imported") { - checkBytesEq(root.getAsBytes(), rootBytesSettings); - } - } -} - -SCENARIO_METHOD(SettingsTestPF, "Import basic params in one format, export in an other", - "[handler][settings][bytes][xml]") -{ - ElementHandle basicParams(*this, "/test/test/parameter_block_array/0"); - string basicXMLSettings = mkBasicSettings(testBasicSettingsXML, "0"); - - WHEN ("Importing basic parameters binary") { - REQUIRE_NOTHROW(basicParams.setAsBytes(readBytes(testBasicSettingsBytes))); - THEN ("Exported XML settings should be the ones imported") { - checkXMLEq(basicParams.getAsXML(), basicXMLSettings); - } - } - - WHEN ("Importing basic parameters XML") { - REQUIRE_NOTHROW(basicParams.setAsXML(basicXMLSettings)); - THEN ("Exported bytes settings should be the ones imported") { - checkBytesEq(basicParams.getAsBytes(), testBasicSettingsBytes); - } - } -} - -struct MappingPF : public ParameterFramework -{ - MappingPF() : ParameterFramework{getConfig()} { REQUIRE_NOTHROW(start()); } - - struct TestVector - { - string path; - string humanReadable; - list<string> valid; - list<string> invalid; - }; - - list<TestVector> testVectors = { - // clang-format off - {"/test/test", - {"rootK:rootV"}, - {"root"}, - {"param", "type", "instance", "derived"}}, - {"/test/test/param", - {"rootK:rootV, paramK:paramV"}, - {"root", "param"}, - {"type", "derived", "instance"}}, - {"/test/test/component", - {"rootK:rootV, typeK:typeV, derivedK:derivedV, instanceK:instanceV"}, - {"root", "type", "derived", "instance"}, - {"param"}} - // clang-format on - }; - - Config getConfig() - { - Config config; - config.subsystemMapping = "rootK:rootV"; - config.components = "<ComponentType Name='componentType' Mapping='typeK:typeV' />" - "<ComponentType Extends='componentType' Name='derivedComponentType' " - "Mapping='derivedK:derivedV' />"; - config.instances = "<BooleanParameter Name='param' Mapping='paramK:paramV' />" - "<Component Name='component' Mapping='instanceK:instanceV' " - " Type='derivedComponentType' />"; - return config; - } -}; - -SCENARIO_METHOD(MappingPF, "showMapping command", "[mapping]") -{ - auto cmdHandler = std::unique_ptr<CommandHandlerInterface>(createCommandHandler()); - - for (auto &testVector : testVectors) { - string output; - CHECK(cmdHandler->process("showMapping", {testVector.path}, output)); - CHECK(output == testVector.humanReadable); - } -} - -SCENARIO_METHOD(MappingPF, "Mapping handle access", "[handler][mapping]") -{ - GIVEN ("A PF with mappings") { - for (auto &test : testVectors) { - GIVEN ("An element handle of " + test.path) { - ElementHandle handle(*this, test.path); - - for (auto &valid : test.valid) { - THEN ("The following mapping should exist: " + valid) { - CHECK(handle.getMappingData(valid + "K") == valid + "V"); - } - } - - for (auto &invalid : test.invalid) { - THEN ("The following mapping should not exist: " + invalid) { - CHECK_THROWS_AS(handle.getMappingData(invalid + "K"), Exception); - } - } - } - } - } -} - -SCENARIO_METHOD(SettingsTestPF, "Handle Get/Set as various kinds", "[handler][dynamic]") -{ - ElementHandle intScalar(*this, "/test/test/parameter_block/integer"); - WHEN ("Setting a scalar integer") { - WHEN ("As an array") { - THEN ("It should fail") { - CHECK_THROWS(intScalar.setAsIntegerArray({0, 0})); - } - } - WHEN ("As a scalalar") { - THEN ("It should succeed") { - uint32_t expected = 111; - CHECK_NOTHROW(intScalar.setAsInteger(expected)); - AND_THEN ("Getting it back should give the same value") { - uint32_t back = 42; - CHECK_NOTHROW(intScalar.getAsInteger(back)); - CHECK(back == expected); - } - } - } - } - - ElementHandle intArray(*this, "/test/test/parameter_block/integer_array"); - WHEN ("Setting a array integer") { - WHEN ("As a scalar") { - THEN ("It should fail") { - CHECK_THROWS(intArray.setAsSignedInteger(0)); - } - } - WHEN ("As a integer") { - THEN ("It should succeed") { - const std::vector<int32_t> expected = {-9, 8, -7, 6}; - CHECK_NOTHROW(intArray.setAsSignedIntegerArray(expected)); - AND_THEN ("Getting it back should give the same value") { - std::vector<int32_t> back = {-42, 42, 43, -43}; - CHECK_NOTHROW(intArray.getAsSignedIntegerArray(back)); - CHECK(back == expected); - } - } - } - } -} -} // namespace parameterFramework diff --git a/test/functional-tests/include/Config.hpp b/test/functional-tests/include/Config.hpp deleted file mode 100644 index 3d3f117..0000000 --- a/test/functional-tests/include/Config.hpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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 <list> -#include <utility> - -namespace parameterFramework -{ - -/** Parameter Framework configuration. */ -struct Config -{ - Config() = default; - - /** Emulate C named parameter. - * { .instances = "fuu" } <=> { &Config::instances, "fuu" } - * Passing multiple named parameters is not implemented. */ - template <class M, class T = M> - Config(M(Config::*member), T &&value) - { - (this->*member) = std::forward<T>(value); - } - - /** Mapping attribute of the test subsystem. */ - std::string subsystemMapping; - - /** Instances of the test subsystem. - * - * Content of the configuration - * SystemClass/Subsystem[name=test]/InstanceDefinition xml node. - */ - std::string instances; - /** Content of the configuartion ConfigurableDomains xml node. */ - std::string domains; - /** Content of the configuration SubsystemPlugins xml node. */ - std::string components; - - struct Plugin - { - using Location = std::string; - using Name = std::string; - /** Each plugin has a location and a path. - * Locations can be factorized by using */ - using Collection = std::list<std::pair<Location, std::list<Name>>>; - }; - using Plugins = Plugin::Collection; - Plugins plugins; - - /** Subsystem type. Virtual by default. */ - std::string subsystemType = "Virtual"; -}; - -} // parameterFramework diff --git a/test/functional-tests/include/ConfigFiles.hpp b/test/functional-tests/include/ConfigFiles.hpp deleted file mode 100644 index 3d14b86..0000000 --- a/test/functional-tests/include/ConfigFiles.hpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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 "TmpFile.hpp" -#include "Config.hpp" - -#include <string> -#include <map> - -namespace parameterFramework -{ - -/** Create temporary config files on disk. */ -class ConfigFiles -{ -public: - ConfigFiles(const Config &config) - : mStructureFile( - format(mStructureTemplate, {{"type", config.subsystemType}, - {"instances", config.instances}, - {"components", config.components}, - {"subsystemMapping", config.subsystemMapping}})), - mDomainsFile(format(mDomainsTemplate, {{"domains", config.domains}})), - mConfigFile(format(mConfigTemplate, {{"structurePath", mStructureFile.getPath()}, - {"domainsPath", mDomainsFile.getPath()}, - {"plugins", toXml(config.plugins)}})) - { - } - - std::string getPath() { return mConfigFile.getPath(); } - -private: - std::string toXml(const Config::Plugin::Collection &plugins) - { - std::string pluginsXml; - for (auto &pluginLocation : plugins) { - std::string pluginsLocationXml; - auto location = pluginLocation.first; - auto paths = pluginLocation.second; - for (auto &path : paths) { - pluginsLocationXml += "<Plugin Name='" + path + "'/>\n"; - } - pluginsXml += - "<Location Folder='" + location + "'>\n" + pluginsLocationXml + "\n</Location>\n"; - } - return pluginsXml; - } - - std::string format(std::string format, std::map<std::string, std::string> subs) - { - for (auto &sub : subs) { - replace(format, '{' + sub.first + '}', sub.second); - } - return format; - } - - void replace(std::string &on, const std::string &from, const std::string &to) - { - auto from_pos = on.find(from); - if (from_pos != std::string::npos) { - on.replace(from_pos, from.length(), to); - } - } - - const char *mConfigTemplate = R"(<?xml version='1.0' encoding='UTF-8'?> - <ParameterFrameworkConfiguration SystemClassName='test' TuningAllowed='true'> - <SubsystemPlugins> - {plugins} - </SubsystemPlugins> - <StructureDescriptionFileLocation Path='{structurePath}'/> - <SettingsConfiguration> - <ConfigurableDomainsFileLocation Path='{domainsPath}'/> - </SettingsConfiguration> - </ParameterFrameworkConfiguration> - )"; - const char *mStructureTemplate = R"(<?xml version='1.0' encoding='UTF-8'?> - <SystemClass Name='test'> - <Subsystem Name='test' Type='{type}' Mapping='{subsystemMapping}'> - <ComponentLibrary> - {components} - </ComponentLibrary> - <InstanceDefinition> - {instances} - </InstanceDefinition> - </Subsystem> - </SystemClass> - )"; - const char *mDomainsTemplate = R"(<?xml version='1.0' encoding='UTF-8'?> - <ConfigurableDomains SystemClassName="test"> - {domains} - </ConfigurableDomains> - )"; - - utility::TmpFile mStructureFile; - utility::TmpFile mDomainsFile; - utility::TmpFile mConfigFile; -}; - -} // parameterFramework diff --git a/test/functional-tests/include/ElementHandle.hpp b/test/functional-tests/include/ElementHandle.hpp deleted file mode 100644 index fe42b71..0000000 --- a/test/functional-tests/include/ElementHandle.hpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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 "ParameterFramework.hpp" -#include "FailureWrapper.hpp" - -#include <ElementHandle.h> - -namespace parameterFramework -{ -/** Wrapper around ::ElementHandle to throw exceptions on errors and have more - * user friendly methods. - * Contrary to ::ElementHandle, is constructed through it's constructor - * and not a factory method. - * @see parameterFramework::ParameterFramework for the main PF interface. - */ -class ElementHandle : private FailureWrapper<::ElementHandle> -{ - ElementHandle(const ElementHandle &other) = delete; - ElementHandle &operator=(const ElementHandle &other) = delete; - -private: - using EH = ::ElementHandle; - -public: - ElementHandle(ParameterFramework &pf, const std::string &path) - : FailureWrapper(pf.createElementHandle(path)) - { - } - - /** Wrap EH::getSize. - * - * @note: can not use `using EH::getSize` as getSize has private overloads in EH. - */ - size_t getSize() const { return EH::getSize(); } - - std::string getMappingData(const std::string &key) - { - std::string value; - if (not EH::getMappingData(key, value)) { - throw Exception("Could not find mapping key \"" + key + "\" in " + EH::getPath()); - } - return value; - } - - /** Wrap EH::setAsDouble to throw an exception on failure. */ - void setAsDouble(double value) { mayFailCall(&EH::setAsDouble, value); } - /** Wrap EH::getAsDouble to throw an exception on failure. */ - void getAsDouble(double &value) const { mayFailCall(&EH::getAsDouble, value); } - - void setAsInteger(uint32_t value) { mayFailCall(&EH::setAsInteger, value); } - void getAsInteger(uint32_t &value) const { mayFailCall(&EH::getAsInteger, value); } - void setAsIntegerArray(const std::vector<uint32_t> &value) - { - mayFailCall(&EH::setAsIntegerArray, value); - } - void getAsIntegerArray(std::vector<uint32_t> &value) const - { - mayFailCall(&EH::getAsIntegerArray, value); - } - - void setAsSignedInteger(int32_t value) { mayFailCall(&EH::setAsSignedInteger, value); } - void getAsSignedInteger(int32_t &value) const { mayFailCall(&EH::getAsSignedInteger, value); } - void setAsSignedIntegerArray(const std::vector<int32_t> &value) - { - mayFailCall(&EH::setAsSignedIntegerArray, value); - } - void getAsSignedIntegerArray(std::vector<int32_t> &value) const - { - mayFailCall(&EH::getAsSignedIntegerArray, value); - } - - std::string getStructureAsXML() const { return mayFailGet(&EH::getStructureAsXML); } - - std::string getAsXML() const { return mayFailGet(&EH::getAsXML); } - void setAsXML(const std::string &settings) { mayFailSet(&EH::setAsXML, settings); } - - std::vector<uint8_t> getAsBytes() const - { - std::vector<uint8_t> settings(getSize()); - mayFailCall(&EH::getAsBytes, settings); - return settings; - } - void setAsBytes(const std::vector<uint8_t> &settings) { mayFailSet(&EH::setAsBytes, settings); } -}; - -} // parameterFramework diff --git a/test/functional-tests/include/Exception.hpp b/test/functional-tests/include/Exception.hpp deleted file mode 100644 index 8ae0597..0000000 --- a/test/functional-tests/include/Exception.hpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 <stdexcept> -#include <string> - -namespace parameterFramework -{ - -/** Base class to all exception thrown by the Parameter Framework. */ -struct Exception : std::runtime_error -{ - using std::runtime_error::runtime_error; -}; - -} // parameterFramework diff --git a/test/functional-tests/include/FailureWrapper.hpp b/test/functional-tests/include/FailureWrapper.hpp deleted file mode 100644 index 753e1dc..0000000 --- a/test/functional-tests/include/FailureWrapper.hpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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 <utility> -#include "Exception.hpp" - -namespace parameterFramework -{ - -namespace details -{ - -static inline bool successTest(bool res) -{ - return res; -} - -template <class T> -static inline bool successTest(T *res) -{ - return res != nullptr; -} - -} // namespace details - -template <class Base> -class FailureWrapper : protected Base -{ -public: - /** Forward construction to base. */ - template <class... Args> - FailureWrapper(Args &&... args) : Base(std::forward<Args>(args)...) - { - } - - /** Wrap a const method that may fail to throw an Exception instead of - * retuning a boolean. - * - * @param[in] method (const) that return a boolean to indicate failure. - * @param[in] args parameters to call method call with. */ - template <class K, class... MArgs, class... Args> - void mayFailCall(bool (K::*method)(MArgs...) const, Args &&... args) const - { - wrapCall<bool>(*this, method, std::forward<Args>(args)...); - } - - /** Wrap a method that may fail to throw an Exception instead of retuning a - * boolean. - * - * @param[in] method that return a boolean to indicate failure. - * @param[in] args parameters to call method call with. */ - template <class K, class... MArgs, class... Args> - void mayFailCall(bool (K::*method)(MArgs...), Args &&... args) - { - wrapCall<bool>(*this, method, std::forward<Args>(args)...); - } - - /** Wrap a method that may indicate failure by returning a null pointer to - * throw an Exception instead of retuning a null pointer. - * - * @param[in] method that return a nullprt to indicate failure. - * @param[in] args parameters to call method call with. */ - template <class K, class ReturnType, class... MArgs, class... Args> - ReturnType *mayFailCall(ReturnType *(K::*method)(MArgs...), Args &&... args) - { - return wrapCall<ReturnType *>(*this, method, std::forward<Args>(args)...); - } - - /** Wrap a const method that may indicate failure by returning a null pointer to - * throw an Exception instead of retuning a null pointer. - * - * @param[in] method that return a nullprt to indicate failure. - * @param[in] args parameters to call method call with. */ - template <class K, class ReturnType, class... MArgs, class... Args> - ReturnType *mayFailCall(ReturnType *(K::*method)(MArgs...) const, Args &&... args) const - { - return wrapCall<ReturnType *>(*this, method, std::forward<Args>(args)...); - } - - /** Wrap a getter to return by value and throw an exception on failure. */ - template <class K, class Value> - Value mayFailGet(bool (K::*accessor)(Value &, std::string &) const) const - { - Value value; - wrapCall<bool>(*this, accessor, value); - return value; - } - - /** Wrap a setter to throw an exception on failure instead of returning a boolean. */ - template <class K, class Value> - void mayFailSet(bool (K::*accessor)(const Value &, std::string &), const Value &value) - { - wrapCall<bool>(*this, accessor, value); - } - -private: - template <class Ret, class I, class M, class... Args> - static Ret wrapCall(I &instance, M method, Args &&... args) - { - std::string error; - auto res = (instance.*method)(std::forward<Args>(args)..., error); - if (not details::successTest(res)) { - throw Exception(std::move(error)); - } - return res; - } -}; -} // parameterFramework diff --git a/test/functional-tests/include/ParameterFramework.hpp b/test/functional-tests/include/ParameterFramework.hpp deleted file mode 100644 index f6f36a8..0000000 --- a/test/functional-tests/include/ParameterFramework.hpp +++ /dev/null @@ -1,173 +0,0 @@ -/* - * 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 "Config.hpp" -#include "ConfigFiles.hpp" -#include "FailureWrapper.hpp" - -#include <ParameterMgrFullConnector.h> - -namespace parameterFramework -{ - -/** This forward declaration is an implementation detail, client should expect its presence. - * @note This forward definition should not be needed as the `friend class ElementHandle` - * declaration in ParameterFramework is itself a forward declaration. - * Unfortunately there seem to be a bug in visual studio 2015, it is required. - */ -class ElementHandle; - -/** Wrapper around the Parameter Framework to throw exceptions on errors and - * have more user friendly methods. - * @see parameterFramework::ElementHandle to access elements of the parameter tree. - */ -class ParameterFramework : private parameterFramework::ConfigFiles, - private FailureWrapper<CParameterMgrFullConnector> -{ -protected: - /** Alias to the Platform Connector PF. - * It should not be usefull as PF is a super set but is useful - * to disambiguate overloaded method for MS visual compiler. - */ - using PPF = CParameterMgrPlatformConnector; - using PF = CParameterMgrFullConnector; - using EH = ::ElementHandle; - -public: - ParameterFramework(const Config &config = Config()) - : ConfigFiles(config), FailureWrapper(getPath()) - { - setForceNoRemoteInterface(true); - } - - void start() { mayFailCall(&PF::start); } - - /** @name Forwarded methods - * Forward those methods without modification as there are ergonomic and - * can not fail (no failure to throw). - * @{ */ - using PF::applyConfigurations; - using PF::getFailureOnMissingSubsystem; - using PF::getFailureOnFailedSettingsLoad; - using PF::getForceNoRemoteInterface; - using PF::setForceNoRemoteInterface; - using PF::getSchemaUri; - using PF::setSchemaUri; - using PF::getValidateSchemasOnStart; - using PF::isValueSpaceRaw; - using PF::isOutputRawFormatHex; - using PF::isTuningModeOn; - using PF::isAutoSyncOn; - using PF::setLogger; - using PF::createCommandHandler; - /** @} */ - - /** Wrap PF::setValidateSchemasOnStart to throw an exception on failure. */ - void setValidateSchemasOnStart(bool validate) - { - mayFailCall(&PPF::setValidateSchemasOnStart, validate); - } - - /** Wrap PF::setFailureOnFailedSettingsLoad to throw an exception on failure. */ - void setFailureOnFailedSettingsLoad(bool fail) - { - mayFailCall(&PPF::setFailureOnFailedSettingsLoad, fail); - } - - /** Wrap PF::setFailureOnMissingSubsystem to throw an exception on failure. */ - void setFailureOnMissingSubsystem(bool fail) - { - mayFailCall(&PPF::setFailureOnMissingSubsystem, fail); - } - - /** Renaming for better readability (and coherency with PF::isValueSpaceRaw) - * of PF::setValueSpace. */ - void setRawValueSpace(bool enable) { setValueSpace(enable); } - - /** Renaming for better readability (and coherency with PF::isValueSpaceRaw) - * of PF::setValueSpace. */ - void setHexOutputFormat(bool enable) { setOutputRawFormat(enable); } - - /** Wrap PF::setTuningMode to throw an exception on failure. */ - void setTuningMode(bool enable) { mayFailCall(&PF::setTuningMode, enable); } - - /** Wrap PF::setAutoSync to throw an exception on failure. */ - void setAutoSync(bool enable) { mayFailCall(&PF::setAutoSync, enable); } - - /** Wrap PF::accessParameterValue in "set" mode (and rename it) to throw an - * exception on failure - */ - void setParameter(const std::string &path, std::string &value) - { - mayFailCall(&PF::accessParameterValue, path, value, true); - } - /** Wrap PF::accessParameterValue in "get" mode (and rename it) to throw an - * exception on failure - */ - void getParameter(const std::string &path, std::string &value) - { - mayFailCall(&PF::accessParameterValue, path, value, false); - } - - /** Wrap PF::accessConfigurationValue in "set" mode (and rename it) to throw an - * exception on failure - */ - void setConfigurationParameter(const std::string domain, const std::string &configuration, - const std::string &path, std::string &value) - { - mayFailCall(&PF::accessConfigurationValue, domain, configuration, path, value, true); - } - - /** Wrap PF::accessConfigurationValue in "get" mode (and rename it) to throw an - * exception on failure - */ - void getConfigurationParameter(const std::string &domain, const std::string &configuration, - const std::string &path, std::string &value) - { - mayFailCall(&PF::accessConfigurationValue, domain, configuration, path, value, false); - } - -private: - /** Create an unwrapped element handle. - * - * Is not public as this method is intended to be used by ElementHandle facade. - */ - EH createElementHandle(const std::string &path) - { - // PF::createElementHandle takes it's handler in the free store - std::unique_ptr<EH> newedHandle{mayFailCall(&PF::createElementHandle, path)}; - EH handle{*newedHandle}; - return handle; - } - friend class ElementHandle; -}; - -} // parameterFramework diff --git a/test/functional-tests/include/StoreLogger.hpp b/test/functional-tests/include/StoreLogger.hpp deleted file mode 100644 index 8364157..0000000 --- a/test/functional-tests/include/StoreLogger.hpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * 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 <ParameterMgrFullConnector.h> -#include <vector> -#include <utility> -#include <string> -#include <algorithm> -#include <sstream> -#include <iterator> - -namespace parameterFramework -{ - -/** Logger that stores all fed log in order retrieve them asynchronously. - * Compatible with the ParameterFramework::Ilogger api. - * Usually used in tests to inspect what was logged by a PF instances - * (eg: test if a warring occurred). - */ -class StoreLogger : public CParameterMgrFullConnector::ILogger -{ -public: - struct Log - { - enum class Level - { - info, - warning - }; - Level level; - std::string msg; - bool operator==(const Log &other) const - { - return level == other.level and msg == other.msg; - } - }; - using Logs = std::vector<Log>; - - void warning(const std::string &strLog) override - { - logs.push_back({Log::Level::warning, strLog}); - } - void info(const std::string &strLog) override { logs.push_back({Log::Level::info, strLog}); } - - const Logs &getLogs() const { return logs; } - - const Logs filter(Log::Level level) const - { - return filter([&level](const Log &log) { return log.level == level; }); - }; - - Logs match(const std::string &pattern) const - { - return filter( - [&pattern](const Log &log) { return log.msg.find(pattern) == std::string::npos; }); - } - -private: - template <class Predicate> - Logs filter(Predicate predicate) const - { - Logs filtered; - std::copy_if(logs.begin(), logs.end(), std::back_inserter(filtered), predicate); - return filtered; - } - - Logs logs; -}; - -/** Overload input stream operator to pretty print a StoreLogger::Log::Level. */ -std::ostream &operator<<(std::ostream &os, const StoreLogger::Log::Level &level) -{ - auto levelStr = "UNREACHABLE"; - using L = StoreLogger::Log::Level; - switch (level) { - case L::info: - levelStr = "Info"; - break; - case L::warning: - levelStr = "Warn"; - break; - } - return os << levelStr << ": "; -} - -/** Overload input stream operator to pretty print a StoreLogger::Log. */ -std::ostream &operator<<(std::ostream &os, const StoreLogger::Log &log) -{ - return os << log.level << log.msg << std::endl; -} - -} // parameterFramework diff --git a/test/functional-tests/include/Test.hpp b/test/functional-tests/include/Test.hpp deleted file mode 100644 index 51f397a..0000000 --- a/test/functional-tests/include/Test.hpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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 "Config.hpp" -#include "ParameterFramework.hpp" - -#include <catch.hpp> - -#include <string> - -#ifndef SCENARIO_METHOD -/** SCENARIO_METHOD is not available in catch on ubuntu 12.04 */ -#define SCENARIO_METHOD(className, ...) TEST_CASE_METHOD(className, "Scenario: " __VA_ARGS__) -#endif - -namespace parameterFramework -{ - -/** Value to test with a title. - * - * When testing code it is often useful to have an list of possible - * values and run the test for each of them. - * This class represents one element of this list. For the complete list - * see Tests. - * - * Catch has no build-in support for such need - * (in fact it has but it is still experimental, look for "generators") - * but it can be emulated with a loop over Tests. - * - * Each Test MUST specify a unique title, Ie all titles of a Tests MUST - * be different. This is dued to the way that catch detects that a SECTION - * has already been run. For more explanation see Tests. - */ -template <class Value> -struct Test -{ - std::string title; - Value payload; -}; - -/** Use a vector to represent a collection of test input. - * - * This type is designed to be used to parametrize tests. - * Use it as follow: - * for (auto &test : Tests<std::string>{ - * // ^~~~~~~~~~~ Test parameter type - * {"an invalid tag", "<invalid tag\"/> "}, - * //^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Test parameters - * {"an unknown tag", "<unknown_tag/>"}, - * // ^~~~~~~~~~~~~~~~ Unique title across the tests - * {"an unclosed tag", "<unclosed>"} }) { - * // ^~~~~~~~~~~ Value to test - * SECTION("Testing: " + test.title) { - * // ^~~~~~~~~~ Section title MUST unique - * test.payload //< value to test - * REQUIRE(getTag() != test.payload); // Example - * ... - * } - * } - * - * - * Beware that if Value is not copyable, only movable this will - * fail to compile as initializer_list does not support move semantic - * (lets hope it will be fix in C++17). - * - * If a new test vector needs to support move, define: - * template <class Value> - * using MovableTests = Test<value>[]; - * This could be the default but VS2013 does not support it. - * VS requires that an array size be defined. Thus define - * template <class Value, size_t size> - * using MovableTests = Test<value>[size]; - * will fix the VS compilation. Nevertheless this means that - * all move only test vector will need to specify their size - * which is redondant. - * This is why it is not the default. - * Hopefully it will be when VS will support deducing the size. - */ -template <class Value> -using Tests = std::vector<Test<Value>>; - -/** Defer Parameter Framework creation. - * A custom configuration can be provided. - */ -class LazyPF -{ -public: - using PF = ParameterFramework; - - void create(Config &&configFile) { mPf.reset(new PF{std::move(configFile)}); } - std::unique_ptr<PF> mPf; -}; - -/** PF that will log a warning at start. */ -struct WarningPF : public ParameterFramework -{ - WarningPF() : ParameterFramework{{&Config::domains, "<InvalidDomain/>"}} - { - setFailureOnFailedSettingsLoad(false); - } -}; -} diff --git a/test/functional-tests/plan.md b/test/functional-tests/plan.md deleted file mode 100644 index 8497616..0000000 --- a/test/functional-tests/plan.md +++ /dev/null @@ -1,402 +0,0 @@ -# Parameter Framework (PF) test plan - -## Notes -- The unit test code MAY be able to list implemented scenarios - in this same BDD format in order to check scenario coverage. -- All scenarios implicitly start by _"GIVEN a parameter framework"_. -- If a scenario does not specify a config files, - the following minimal files SHOULD be used: - -Top level file (replace `{structurePath}` by its value): -~~~ xml -<?xml version='1.0' encoding='UTF-8'?> -<ParameterFrameworkConfiguration SystemClassName='test' - TuningAllowed='false' ServerPort='1'> - <SubsystemPlugins/> - <StructureDescriptionFileLocation Path='{structurePath}'/> -</ParameterFrameworkConfiguration> -~~~ - -Structure file: -~~~ xml -<?xml version='1.0' encoding='UTF-8'?> -<SystemClass Name='test'> - <Subsystem Name='test' Type='Virtual'> - <ComponentLibrary/> - <InstanceDefinition> - <BooleanParameter Name="placeholder"/> - </InstanceDefinition> - </Subsystem> -</SystemClass> -~~~ - -## Starting the Parameter Framework - -- set a logger - - [X] Scenario: Default logger - * WHEN no logger is set - * THEN start should succeed - - - [X] Scenario: No logger - * WHEN a nullptr logger is set - * THEN start should succeed - - - [X] Scenario: Logger should receive info and warnings - * GIVEN config files that emit warnings - * GIVEN a logger that store logs - * WHEN the record logger is set - * THEN start should succeed - * AND_THEN the logger should have stored info and warning log - - - [X] Scenario: Unset logger - * GIVEN config files that emit warnings - * GIVEN a logger that store logs - * WHEN the record logger is set - * AND_WHEN a nullptr logger is set - * THEN start should succeed - * AND_THEN the record logger should NOT have stored any info or warning log - -- set/get various properties before startup: - - "force no remote interface" - - [ ] Scenario: Tuning OK - * GIVEN config files with tuning enabled on a valid port - * WHEN the remote interface is NOT forbiden - * THEN start should succeed - - - [ ] Scenario: Invalid tunning - * GIVEN config files with tuning enabled on an invalid port (0?) - * WHEN the remote interface is NOT forbiden - * THEN start should fail - - - [ ] Scenario: Forbiden invalid tunning - * GIVEN config files with tuning enabled on an invalid port (0?) - * WHEN the remote interface is forbiden - * THEN start should succeed - - - "failure on missing subsystem" - - [ ] Scenario: Plugin OK - * GIVEN config files with a valid plugin - * WHEN the missing subsystem policy is set to failure - * THEN start should succeed - - - [X] Scenario: Wrong plugin - * GIVEN config files with a invalid plugin - * WHEN the missing subsystem policy is set to failure - * THEN start should fail - - - [ ] Scenario: Wrong plugin but fallback - * GIVEN config files with a invalid plugin - * WHEN the missing subsystem policy is set to success - * THEN start should succeed - - - "failure on failed settings load" - - [X] Scenario: Settings OK - * GIVEN config files with a valid settings file - * WHEN settings load failure is requested to abort start - * THEN start should succeed - - - [X] Scenario: Wrong settings - * GIVEN config files with a invalid (non existant?) settings file - * WHEN settings load failure is requested to abort start - * THEN start should fail - - - [X] Scenario: Wrong settings but ignore - * GIVEN config files with a invalid (non existant?) settings file - * WHEN settings load failure is requested to abort start - * THEN start should succeed - - - "schema folder location" and "validate schema on start" - - [ ] Scenario: Schema OK - * GIVEN config files with correct default schema location - * WHEN schema folder location is left to default - * WHEN schema validation is enabled - * THEN start should succeed - - - [ ] Scenario: Inexisting schemas - * GIVEN config files with correct default schema location - * WHEN schema folder location is set to an invalid location (/doesNotExist ?) - * WHEN schema validation is enabled - * THEN start should fail - - - [ ] Scenario: Inexisting ignored schemas - * GIVEN config files with correct default schema location - * WHEN schema folder location is set to an invalid location (/doesNotExist ?) - * WHEN schema validation is disabled - * THEN start should succeed - - - [ ] Scenario: Inexisting used schemas - * GIVEN config files with custom schema location (./shemaCustomFolderName) - * WHEN schema folder location is set to the custom shema location - * WHEN schema validation is enabled - * THEN start should succeed - - - [ ] Scenario: Schema OK, config KO - * GIVEN incorect config files with correct default schema location - * WHEN schema validation is enabled - * THEN start should fail - -### Error cases/special cases - -- invalid configuration or a file can't be read: - - [X] Scenario: invalid top level config file - * GIVEN an incorect (empty ? wrong balisa ?) config top level file. - * THEN start should fail - - - [X] Scenario: invalid structure - * GIVEN an incorect (empty ? wrong balisa ?) structure file. - * THEN start should fail - - - [X] Scenario: invalid settings - * GIVEN an incorect (empty ? wrong balisa ?) settings file. - * THEN start should fail - -- plugins can't be found (unless silenced by the user) - - Done in "failure on missing subsystem" - -- usage of `<xi:include .../>` - - [ ] Scenario: Arbitrary xincluded node - * GIVEN a top level file xincluding a file with the "SettingsConfiguration" balisa - * THEN start should succeed - -- plugins: - - non-empty "Location" attribute - - [ ] Scenario: Plugin location OK - * GIVEN a top level file with a plugin folder location attribute - * THEN start should succeed - - empty "Location" attribute - - relative path - - [ ] Scenario: Empty Location, standard plugin install - * GIVEN config files with an empty location attribute - * GIVEN a plugin installed in a dlopen standard path - * GIVEN that "Location/Plugin[name]" is the plugin name - * THEN start should succeed - - - [ ] Scenario: Empty Location, non standard plugin install - * GIVEN config files with an empty location attribute - * GIVEN a plugin NOT installed in a dlopen standard path - * GIVEN that "Location/Plugin[name]" is the plugin name - * THEN start should fail - - - absolute path - - [ ] Scenario: Empty Location, plugin absolute path - * GIVEN config files with an empty location attribute - * GIVEN a plugin - * GIVEN that "Location/Plugin[name]" is the plugin absolute path - * THEN start should succeed - - - [ ] Scenario: Empty Location, plugin non existing path - * GIVEN config files with an empty location attribute - * GIVEN that "Location/Plugin[name]" is an non existing path (/libDoesNotExist.so?) - * THEN start should fail - -* * * - -## Logging - -- info and warning - - Partly covered by the "set a logger" section - - [ ] Scenario: Plugin info and warning log - * GIVEN a plugin that log a unique string as info and warning - * GIVEN a logger that store logs - * WHEN the record logger is set - * THEN start should succeed - * AND_THEN the logger should have stored the plugin specific info and warning log - -* * * - -## Basic Domains & Configurations management - -- [ ] Scenario: create and delete an empty domain - * GIVEN a started parameter framework without domains - * THEN creating a domain with an arbitrary name ("domain1"?) should succeed - * (AND_THEN the domain list should contain the domain name) - * THEN deleting the domain should succeed - -- [ ] Scenario: create and delete a configuration - * GIVEN a started parameter framework with a domain - * THEN creating a configuration in this domain with an arbitrary name ("config1") should succeed - * (AND_THEN the domain configuration list should contain the configuration name) - * THEN deleting the configuration should succeed - * (AND_THEN the domain configuration list should not contain the configuration name) - -- [ ] Scenario: delete a domain with configurations - * GIVEN a started parameter framework with a domain and several configuration (3?) - * THEN deleting the domain should succeed - * (AND_THEN the domain list should not contain the domain name) - -- [ ] Scenario: delete all domains - * GIVEN a started parameter framework with several domains - * THEN deleting all domains should succeed - * (AND_THEN the domain list should be empty) - -- [ ] Scenario: rename a domain - * GIVEN a started parameter framework with a domain and several configuration (3?) - * THEN renaming the domain to an arbitrary name should succeed - - -### Error cases/special cases - -- [ ] Scenario: create a domain with an already-existing name - * GIVEN a started parameter framework with a domain (arbitrary name) - * THEN creating a second domain with the same name than the first should fail - -- [ ] Scenario: create a configuration with an already-existing name - * GIVEN a started parameter framework with a domain - containing one configuration (arbitrary name) - * THEN creating a second configuration in this domain - with the same name than the fist should fail - -- [ ] delete a non-existent domain - * GIVEN a started parameter framework without domain - * THEN deleting an arbitrary named domain should fail - -- [ ] delete a non-existent configuration - * GIVEN a started parameter framework one domain - * THEN deleting in this domain a arbitrary named configuration should fail - -- [ ] list configuration of a unknown domain - * GIVEN a started parameter framework without domain - * THEN listing configuration of an arbitrary named domain should fail - -- [ ] Scenario: rename a domain to an already used name - * GIVEN a started parameter framework with two domains - with arbitrary different names ("domain1" and "domain2") - * THEN renaming first domain ("domain1") to the name of the second one ("domain2") should fail - -- [ ] Scenario: rename a configuration to an already used name - * GIVEN a started parameter framework with one domain containing two configuration - with arbitrary different names ("config1" and "config2") - * THEN renaming first configuration ("config1") - to the name of the second one ("config2") should fail - -- [ ] Scenario: rename a domain to its own name - * GIVEN a started parameter framework one arbitrary named domain - * THEN renaming the domain to its own name should succeed - -- [ ] rename a configuration to its own name - * GIVEN a started parameter framework a domain and one configuration - * THEN renaming the configuration to its own name should succeed - -* * * - -## Domain modification - -- set/get sequence awareness -- add/list/remove elements to a domain -- *(split domain ?)* -- *(listBelongingDomains ?)* -- *(listAssociatedDomains ?)* -- *(listAssociatedElements ?)* -- *(listConflictingElements ?)* -- *(listRogueElements ?)* - -### Error cases/special cases - -- add (or remove) a non-existent element -- add (or remove) a parameter to (or from) a non-existent domain - -* * * - -## Configurations modification - -- set a configuration rule; get it back - - trivial rules, complex rules (fuzzing ?) - - clear a rule -- save/restore a configuration -- set/get element sequence -- set/get a parameter for a given configuration -- set a parameter belonging to a domain and save a configuration - -### Error cases - -- set a wrongly-formatted rule -- set a rule using an unknown criterion (or unknown criterion value) -- set/get a rule to a non-existent domain (or configuration) - -* * * - -## Criteria - -- create a criterion - - exclusive - - inclusive -- *(list criteria)* -- set a criterion; get a criterion value - - exclusive criterion - - inclusive criterion - - special case: "none" value - -### Error cases/special cases - -- duplicated criterion name (with the same type/with a different type) -- duplicated criterion value -- max supported number of criterion values - -* * * - -## Settings Import/Export - -- import xml domains - - w/ or w/o settings - - from a file/from a string - - all/single -- export xml domains - - w/ or w/o settings - - to a file/from a string - - all/single - -### Error case/special cases - -- invalid settings - - invalid xml (should we use a fuzzing framework ?) - - valid xml but not matching the XSD (ditto) - - valid but unusable data: - - unknown criterion/criterion values - - unknown parameters -- unreadable/unwritable file -- single domain import overwrite - - fail if overwrite not requested - - succeed if overwrite requested - -* * * - -## Parameters - -- structures are correctly instantiated - - parameters in the "instance definition" - - component types instantiation - - parameter blocks - - bit blocks - - arrays -- check parameter mappings are correctly applied - - at all levels possible (subsystem, component type, component instance, - block, parameter...) - - context mappings, amends, instantiation mappings -- set/get a parameter -- parameter handles -- test on parameter values - - booleans - - bit blocks - - numeric types ranges - - fixed-point tests - - string length - -* * * - -## Configuration application - -- apply configurations - - sequence aware domains -- forced sync - -* * * - -## Misc/to be classified - -- tuning mode -- auto sync -- remote interface instantiation -- value space (raw/real)/format (dec/hex) - -### Error cases - diff --git a/test/introspection-subsystem/CMakeLists.txt b/test/introspection-subsystem/CMakeLists.txt deleted file mode 100644 index faccab3..0000000 --- a/test/introspection-subsystem/CMakeLists.txt +++ /dev/null @@ -1,58 +0,0 @@ -# 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. - -# The introspection-subsystem provides ability to retrieve -# a boolean parameter value set by the parameter-framework -# at subsystem level. -# -# To get the boolean value, include the "IntrospectionEntryPoint.h" -# header and use the getParameterValue() function. - - -if (BUILD_TESTING) - add_library(introspection-subsystem SHARED - IntrospectionSubsystem.cpp - IntrospectionSubsystemObject.cpp - IntrospectionSubsystemBuilder.cpp - IntrospectionEntryPoint.cpp) - - # generating header used to export shared library symbols - include(GenerateExportHeader) - generate_export_header(introspection-subsystem - BASE_NAME introspection_subsystem) - - # exporting public headers: - # - the header that contains the introspection function - # - the header generated by cmake used to export symbols in shared library. - # - # Note : headers located in root project directory remain private. - target_include_directories(introspection-subsystem - PUBLIC "include" "${CMAKE_CURRENT_BINARY_DIR}") - - target_link_libraries(introspection-subsystem PRIVATE parameter) -endif() diff --git a/test/introspection-subsystem/IntrospectionEntryPoint.cpp b/test/introspection-subsystem/IntrospectionEntryPoint.cpp deleted file mode 100644 index b26e938..0000000 --- a/test/introspection-subsystem/IntrospectionEntryPoint.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 "IntrospectionEntryPoint.h" -#include "IntrospectionSubsystemObject.h" - -namespace parameterFramework -{ -namespace introspectionSubsystem -{ - -bool getParameterValue() -{ - return SubsystemObject::getSingletonInstanceValue(); -} -} -} diff --git a/test/introspection-subsystem/IntrospectionSubsystem.cpp b/test/introspection-subsystem/IntrospectionSubsystem.cpp deleted file mode 100644 index 7c3e945..0000000 --- a/test/introspection-subsystem/IntrospectionSubsystem.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 "IntrospectionSubsystem.h" -#include "IntrospectionSubsystemObject.h" -#include <SubsystemObjectFactory.h> - -namespace parameterFramework -{ -namespace introspectionSubsystem -{ - -Subsystem::Subsystem(const std::string &name, core::log::Logger &logger) : base(name, logger) -{ - addSubsystemObjectFactory(new TSubsystemObjectFactory<SubsystemObject>("Object", 0)); -} -} -} diff --git a/test/introspection-subsystem/IntrospectionSubsystem.h b/test/introspection-subsystem/IntrospectionSubsystem.h deleted file mode 100644 index 1f89841..0000000 --- a/test/introspection-subsystem/IntrospectionSubsystem.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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 <Subsystem.h> - -namespace parameterFramework -{ -namespace introspectionSubsystem -{ - -/** This subsystem allows to retrieve parameter value set by the - * parameter-framework */ -class Subsystem : public CSubsystem -{ -public: - Subsystem(const std::string &name, core::log::Logger &logger); - -private: - using base = CSubsystem; -}; -} -} diff --git a/test/introspection-subsystem/IntrospectionSubsystemBuilder.cpp b/test/introspection-subsystem/IntrospectionSubsystemBuilder.cpp deleted file mode 100644 index 23c7134..0000000 --- a/test/introspection-subsystem/IntrospectionSubsystemBuilder.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 <Plugin.h> -#include <LoggingElementBuilderTemplate.h> -#include "IntrospectionSubsystem.h" - -void PARAMETER_FRAMEWORK_PLUGIN_ENTRYPOINT_V1(CSubsystemLibrary *subsystemLibrary, - core::log::Logger &logger) -{ - using Subsystem = parameterFramework::introspectionSubsystem::Subsystem; - subsystemLibrary->addElementBuilder("INTROSPECTION", - new TLoggingElementBuilderTemplate<Subsystem>(logger)); -} diff --git a/test/introspection-subsystem/IntrospectionSubsystemObject.cpp b/test/introspection-subsystem/IntrospectionSubsystemObject.cpp deleted file mode 100644 index 2a05981..0000000 --- a/test/introspection-subsystem/IntrospectionSubsystemObject.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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 "IntrospectionSubsystemObject.h" -#include <InstanceConfigurableElement.h> -#include <ParameterType.h> - -namespace parameterFramework -{ -namespace introspectionSubsystem -{ - -const SubsystemObject *SubsystemObject::mSingletonInstance = nullptr; - -/* Helper function */ -const CParameterType *geParameterType(CInstanceConfigurableElement *element) -{ - return static_cast<const CParameterType *>(element->getTypeElement()); -} - -SubsystemObject::SubsystemObject(const std::string & /*mappingValue*/, - CInstanceConfigurableElement *instanceConfigurableElement, - const CMappingContext & /*context*/, core::log::Logger &logger) - : base(instanceConfigurableElement, logger), mParameter(false) -{ - /* Checking that structure matches the internal parameter */ - ALWAYS_ASSERT(geParameterType(instanceConfigurableElement)->getSize() == parameterSize, - "Wrong parameter size"); - ALWAYS_ASSERT((instanceConfigurableElement->getFootPrint() / parameterSize) == 1, - "Parameter shall not be an array"); - ALWAYS_ASSERT(geParameterType(instanceConfigurableElement)->isScalar(), - "Parameter shall be scalar"); - - /* Registering the instance into a singleton */ - registerInstance(*this); -} - -SubsystemObject::~SubsystemObject() -{ - /* Unregistering the instance from the singleton */ - unregisterInstance(*this); -} - -bool SubsystemObject::sendToHW(std::string & /*error*/) -{ - blackboardRead(&mParameter, parameterSize); - return true; -} - -bool SubsystemObject::receiveFromHW(std::string & /*error*/) -{ - blackboardRead(&mParameter, parameterSize); - return true; -} -} -} diff --git a/test/introspection-subsystem/IntrospectionSubsystemObject.h b/test/introspection-subsystem/IntrospectionSubsystemObject.h deleted file mode 100644 index f91f686..0000000 --- a/test/introspection-subsystem/IntrospectionSubsystemObject.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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 <SubsystemObject.h> -#include <AlwaysAssert.hpp> -#include <string> - -class CMappingContext; - -namespace parameterFramework -{ -namespace introspectionSubsystem -{ - -/** This subsystem object exposes a boolean parameter. The value of this parameter - * can be retrieved by an external code that calls the getSingletonInstanceValue() - * static method. - */ -class SubsystemObject final : public CSubsystemObject -{ -public: - SubsystemObject(const std::string &mappingValue, - CInstanceConfigurableElement *instanceConfigurableElement, - const CMappingContext &context, core::log::Logger &logger); - ~SubsystemObject(); - - static bool getSingletonInstanceValue() - { - ALWAYS_ASSERT(mSingletonInstance != nullptr, "Singleton value has not been registered"); - return mSingletonInstance->mParameter; - } - -private: - using base = CSubsystemObject; - - virtual bool sendToHW(std::string &error) override; - virtual bool receiveFromHW(std::string &error) override; - - static void registerInstance(const SubsystemObject &instance) - { - ALWAYS_ASSERT(mSingletonInstance == nullptr, "An instance is already registered"); - mSingletonInstance = &instance; - } - - static void unregisterInstance(const SubsystemObject &instance) - { - // instance parameter is only used by assertion, so unused in release mode - (void)instance; - - ALWAYS_ASSERT(mSingletonInstance == &instance, "This instance was not registered."); - mSingletonInstance = nullptr; - } - - static const std::size_t parameterSize = sizeof(bool); - - static const SubsystemObject *mSingletonInstance; - - bool mParameter; -}; -} -} diff --git a/test/introspection-subsystem/include/IntrospectionEntryPoint.h b/test/introspection-subsystem/include/IntrospectionEntryPoint.h deleted file mode 100644 index ce3e22c..0000000 --- a/test/introspection-subsystem/include/IntrospectionEntryPoint.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 "introspection_subsystem_export.h" - -namespace parameterFramework -{ -namespace introspectionSubsystem -{ - -INTROSPECTION_SUBSYSTEM_EXPORT bool getParameterValue(); -} -} diff --git a/test/test-fixed-point-parameter/CMakeLists.txt b/test/test-fixed-point-parameter/CMakeLists.txt deleted file mode 100644 index 1b1e0e0..0000000 --- a/test/test-fixed-point-parameter/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (c) 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. - -if(BUILD_TESTING AND PYTHON_BINDINGS) - find_package(PythonInterp 2.7 REQUIRED) - - add_test(NAME fix_point_parameter - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND ${PYTHON_EXECUTABLE} Main.py) - - # 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 deleted file mode 100755 index 31e10a5..0000000 --- a/test/test-fixed-point-parameter/Main.py +++ /dev/null @@ -1,245 +0,0 @@ -#!/usr/bin/python2.7 -# -# 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. - -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 info(self, message): - self.__logger.info(message) - - def warning(self, message): - self.__logger.warning(message) - -class FixedPointTester(): - """ Made for testing a particular Qn.m number - - As a convention, we use: - * n is the fractional part - * m is the integral part - - This class computes several specific numbers for a given Qn.m number. - - For each of those numbers, we run 4 checks: - * Bound check - * Sanity check - * Consistency check - * Bijectivity check - Which are documented below. - """ - def __init__(self, pfwClient, size, integral, fractional): - self._pfwClient = pfwClient - self._paramPath = '/Test/test/%d/q%d.%d' % (size, integral, fractional) - - # quantum is the step we have between two numbers - # encoded in Qn.m format - self._quantum = 2 ** -fractional - - # The maximum value we can encode for a given Qn.m. - # Since we also need to encode the 0, we have one quantum missing on - # the positive maximum - self._upperAllowedBound = (2 ** integral) - self._quantum - - # The minimum value that we can encode for a given Qn.m. - # This one does not need a quantum substraction since we already did - # that on the maximum - self._lowerAllowedBound = -(2 ** integral) - - self._shouldWork = [ - Decimal(0), - Decimal(self._lowerAllowedBound), - Decimal(self._upperAllowedBound) - ] - - # 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 ** -(int(fractional * log10(2))) - self._shouldBreak = [ - Decimal(self._lowerAllowedBound) - Decimal(bigValue), - Decimal(self._upperAllowedBound) + Decimal(bigValue), - Decimal(self._lowerAllowedBound) - Decimal(littleValue), - 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)) - - 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 - - valueToSet -- the value we are trying to set - - returns: the value we are trying to set - returns: True if we are able to set, False otherwise - """ - (success, errorMsg) = self._pfwClient.set(self._paramPath, str(valueToSet)) - - return valueToSet, success - - - def checkSanity(self, valuePreviouslySet): - """ Checks if the value we get is still approximately the same - as we attempted to set. The value can have a slight round error which - is tolerated. - - valuePreviouslySet -- the value we had previously set - - returns: the value the parameter-framework returns us after the get - returns: True if we are able to set, False otherwise - """ - firstGet = self._pfwClient.get(self._paramPath) - - try: - returnValue = Decimal(firstGet) - except ValueError: - print("ERROR: Can't convert %s to a decimal" % firstGet) - return firstGet, False - - upperAllowedValue = Decimal(valuePreviouslySet) + (Decimal(self._quantum) / Decimal(2)) - lowerAllowedValue = Decimal(valuePreviouslySet) - (Decimal(self._quantum) / Decimal(2)) - - if not (lowerAllowedValue <= returnValue <= upperAllowedValue): - print('%s <= %s <= %s is not true' % - (lowerAllowedValue, returnValue, upperAllowedValue)) - return firstGet, False - - return firstGet, True - - def checkConsistency(self, valuePreviouslyGotten): - """ Checks if we are able to set the value that the parameter framework - just returned to us. - - valuePreviouslyGotten -- the value we are trying to set - - valueToSet -- the value we are trying to set - returns: True if we are able to set, False otherwise - """ - (success, errorMsg) = pfw.set(self._paramPath, valuePreviouslyGotten) - - return valuePreviouslyGotten, success - - def checkBijectivity(self, valuePreviouslySet): - """ Checks that the second get value is strictly equivalent to the - consistency set. This ensures that the parameter-framework behaves as - expected. - - valuePreviouslySet -- the value we had previously set - - returns: value the parameter-framework returns us after the second get - returns: True if we are able to set, False otherwise - """ - secondGet = pfw.get(self._paramPath) - - if secondGet != valuePreviouslySet: - return secondGet, False - - return secondGet, True - -class PfwClient(): - - def __init__(self, configPath): - self._instance = PyPfw.ParameterFramework(configPath) - - 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) - - self._instance.start() - self._instance.setTuningMode(True) - - def set(self, parameter, value): - print('set %s <--- %s' % (parameter, value)) - (success, _, errorMsg) = self._instance.accessParameterValue(parameter, str(value), True) - return success, errorMsg - - def get(self, parameter): - (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. - pfw = PfwClient('./ParameterFrameworkConfiguration.xml') - - 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-fixed-point-parameter/ParameterFrameworkConfiguration.xml b/test/test-fixed-point-parameter/ParameterFrameworkConfiguration.xml deleted file mode 100644 index e803682..0000000 --- a/test/test-fixed-point-parameter/ParameterFrameworkConfiguration.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ParameterFrameworkConfiguration SystemClassName="Test" ServerPort="5066" TuningAllowed="true"> - <SubsystemPlugins> - </SubsystemPlugins> - <StructureDescriptionFileLocation Path="TestClass.xml"/> -</ParameterFrameworkConfiguration> diff --git a/test/test-fixed-point-parameter/TestClass.xml b/test/test-fixed-point-parameter/TestClass.xml deleted file mode 100644 index db1b0bc..0000000 --- a/test/test-fixed-point-parameter/TestClass.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<SystemClass Name="Test"> - <SubsystemInclude Path="VirtualSubsystem.xml"/> -</SystemClass> diff --git a/test/test-fixed-point-parameter/VirtualSubsystem.xml b/test/test-fixed-point-parameter/VirtualSubsystem.xml deleted file mode 100644 index dca7bb5..0000000 --- a/test/test-fixed-point-parameter/VirtualSubsystem.xml +++ /dev/null @@ -1,721 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Subsystem Name="test" Type="Virtual"> - <ComponentLibrary> - </ComponentLibrary> - <InstanceDefinition> - - <!-- 32b --> - <ParameterBlock Name="32"> - <FixedPointParameter Name="q0.0" Size="32" Integral="0" Fractional="0"/> - <FixedPointParameter Name="q0.1" Size="32" Integral="0" Fractional="1"/> - <FixedPointParameter Name="q0.2" Size="32" Integral="0" Fractional="2"/> - <FixedPointParameter Name="q0.3" Size="32" Integral="0" Fractional="3"/> - <FixedPointParameter Name="q0.4" Size="32" Integral="0" Fractional="4"/> - <FixedPointParameter Name="q0.5" Size="32" Integral="0" Fractional="5"/> - <FixedPointParameter Name="q0.6" Size="32" Integral="0" Fractional="6"/> - <FixedPointParameter Name="q0.7" Size="32" Integral="0" Fractional="7"/> - <FixedPointParameter Name="q0.8" Size="32" Integral="0" Fractional="8"/> - <FixedPointParameter Name="q0.9" Size="32" Integral="0" Fractional="9"/> - <FixedPointParameter Name="q0.10" Size="32" Integral="0" Fractional="10"/> - <FixedPointParameter Name="q0.11" Size="32" Integral="0" Fractional="11"/> - <FixedPointParameter Name="q0.12" Size="32" Integral="0" Fractional="12"/> - <FixedPointParameter Name="q0.13" Size="32" Integral="0" Fractional="13"/> - <FixedPointParameter Name="q0.14" Size="32" Integral="0" Fractional="14"/> - <FixedPointParameter Name="q0.15" Size="32" Integral="0" Fractional="15"/> - <FixedPointParameter Name="q0.16" Size="32" Integral="0" Fractional="16"/> - <FixedPointParameter Name="q0.17" Size="32" Integral="0" Fractional="17"/> - <FixedPointParameter Name="q0.18" Size="32" Integral="0" Fractional="18"/> - <FixedPointParameter Name="q0.19" Size="32" Integral="0" Fractional="19"/> - <FixedPointParameter Name="q0.20" Size="32" Integral="0" Fractional="20"/> - <FixedPointParameter Name="q0.21" Size="32" Integral="0" Fractional="21"/> - <FixedPointParameter Name="q0.22" Size="32" Integral="0" Fractional="22"/> - <FixedPointParameter Name="q0.23" Size="32" Integral="0" Fractional="23"/> - <FixedPointParameter Name="q0.24" Size="32" Integral="0" Fractional="24"/> - <FixedPointParameter Name="q0.25" Size="32" Integral="0" Fractional="25"/> - <FixedPointParameter Name="q0.26" Size="32" Integral="0" Fractional="26"/> - <FixedPointParameter Name="q0.27" Size="32" Integral="0" Fractional="27"/> - <FixedPointParameter Name="q0.28" Size="32" Integral="0" Fractional="28"/> - <FixedPointParameter Name="q0.29" Size="32" Integral="0" Fractional="29"/> - <FixedPointParameter Name="q0.30" Size="32" Integral="0" Fractional="30"/> - <FixedPointParameter Name="q0.31" Size="32" Integral="0" Fractional="31"/> - <FixedPointParameter Name="q1.0" Size="32" Integral="1" Fractional="0"/> - <FixedPointParameter Name="q1.1" Size="32" Integral="1" Fractional="1"/> - <FixedPointParameter Name="q1.2" Size="32" Integral="1" Fractional="2"/> - <FixedPointParameter Name="q1.3" Size="32" Integral="1" Fractional="3"/> - <FixedPointParameter Name="q1.4" Size="32" Integral="1" Fractional="4"/> - <FixedPointParameter Name="q1.5" Size="32" Integral="1" Fractional="5"/> - <FixedPointParameter Name="q1.6" Size="32" Integral="1" Fractional="6"/> - <FixedPointParameter Name="q1.7" Size="32" Integral="1" Fractional="7"/> - <FixedPointParameter Name="q1.8" Size="32" Integral="1" Fractional="8"/> - <FixedPointParameter Name="q1.9" Size="32" Integral="1" Fractional="9"/> - <FixedPointParameter Name="q1.10" Size="32" Integral="1" Fractional="10"/> - <FixedPointParameter Name="q1.11" Size="32" Integral="1" Fractional="11"/> - <FixedPointParameter Name="q1.12" Size="32" Integral="1" Fractional="12"/> - <FixedPointParameter Name="q1.13" Size="32" Integral="1" Fractional="13"/> - <FixedPointParameter Name="q1.14" Size="32" Integral="1" Fractional="14"/> - <FixedPointParameter Name="q1.15" Size="32" Integral="1" Fractional="15"/> - <FixedPointParameter Name="q1.16" Size="32" Integral="1" Fractional="16"/> - <FixedPointParameter Name="q1.17" Size="32" Integral="1" Fractional="17"/> - <FixedPointParameter Name="q1.18" Size="32" Integral="1" Fractional="18"/> - <FixedPointParameter Name="q1.19" Size="32" Integral="1" Fractional="19"/> - <FixedPointParameter Name="q1.20" Size="32" Integral="1" Fractional="20"/> - <FixedPointParameter Name="q1.21" Size="32" Integral="1" Fractional="21"/> - <FixedPointParameter Name="q1.22" Size="32" Integral="1" Fractional="22"/> - <FixedPointParameter Name="q1.23" Size="32" Integral="1" Fractional="23"/> - <FixedPointParameter Name="q1.24" Size="32" Integral="1" Fractional="24"/> - <FixedPointParameter Name="q1.25" Size="32" Integral="1" Fractional="25"/> - <FixedPointParameter Name="q1.26" Size="32" Integral="1" Fractional="26"/> - <FixedPointParameter Name="q1.27" Size="32" Integral="1" Fractional="27"/> - <FixedPointParameter Name="q1.28" Size="32" Integral="1" Fractional="28"/> - <FixedPointParameter Name="q1.29" Size="32" Integral="1" Fractional="29"/> - <FixedPointParameter Name="q1.30" Size="32" Integral="1" Fractional="30"/> - <FixedPointParameter Name="q2.0" Size="32" Integral="2" Fractional="0"/> - <FixedPointParameter Name="q2.1" Size="32" Integral="2" Fractional="1"/> - <FixedPointParameter Name="q2.2" Size="32" Integral="2" Fractional="2"/> - <FixedPointParameter Name="q2.3" Size="32" Integral="2" Fractional="3"/> - <FixedPointParameter Name="q2.4" Size="32" Integral="2" Fractional="4"/> - <FixedPointParameter Name="q2.5" Size="32" Integral="2" Fractional="5"/> - <FixedPointParameter Name="q2.6" Size="32" Integral="2" Fractional="6"/> - <FixedPointParameter Name="q2.7" Size="32" Integral="2" Fractional="7"/> - <FixedPointParameter Name="q2.8" Size="32" Integral="2" Fractional="8"/> - <FixedPointParameter Name="q2.9" Size="32" Integral="2" Fractional="9"/> - <FixedPointParameter Name="q2.10" Size="32" Integral="2" Fractional="10"/> - <FixedPointParameter Name="q2.11" Size="32" Integral="2" Fractional="11"/> - <FixedPointParameter Name="q2.12" Size="32" Integral="2" Fractional="12"/> - <FixedPointParameter Name="q2.13" Size="32" Integral="2" Fractional="13"/> - <FixedPointParameter Name="q2.14" Size="32" Integral="2" Fractional="14"/> - <FixedPointParameter Name="q2.15" Size="32" Integral="2" Fractional="15"/> - <FixedPointParameter Name="q2.16" Size="32" Integral="2" Fractional="16"/> - <FixedPointParameter Name="q2.17" Size="32" Integral="2" Fractional="17"/> - <FixedPointParameter Name="q2.18" Size="32" Integral="2" Fractional="18"/> - <FixedPointParameter Name="q2.19" Size="32" Integral="2" Fractional="19"/> - <FixedPointParameter Name="q2.20" Size="32" Integral="2" Fractional="20"/> - <FixedPointParameter Name="q2.21" Size="32" Integral="2" Fractional="21"/> - <FixedPointParameter Name="q2.22" Size="32" Integral="2" Fractional="22"/> - <FixedPointParameter Name="q2.23" Size="32" Integral="2" Fractional="23"/> - <FixedPointParameter Name="q2.24" Size="32" Integral="2" Fractional="24"/> - <FixedPointParameter Name="q2.25" Size="32" Integral="2" Fractional="25"/> - <FixedPointParameter Name="q2.26" Size="32" Integral="2" Fractional="26"/> - <FixedPointParameter Name="q2.27" Size="32" Integral="2" Fractional="27"/> - <FixedPointParameter Name="q2.28" Size="32" Integral="2" Fractional="28"/> - <FixedPointParameter Name="q2.29" Size="32" Integral="2" Fractional="29"/> - <FixedPointParameter Name="q3.0" Size="32" Integral="3" Fractional="0"/> - <FixedPointParameter Name="q3.1" Size="32" Integral="3" Fractional="1"/> - <FixedPointParameter Name="q3.2" Size="32" Integral="3" Fractional="2"/> - <FixedPointParameter Name="q3.3" Size="32" Integral="3" Fractional="3"/> - <FixedPointParameter Name="q3.4" Size="32" Integral="3" Fractional="4"/> - <FixedPointParameter Name="q3.5" Size="32" Integral="3" Fractional="5"/> - <FixedPointParameter Name="q3.6" Size="32" Integral="3" Fractional="6"/> - <FixedPointParameter Name="q3.7" Size="32" Integral="3" Fractional="7"/> - <FixedPointParameter Name="q3.8" Size="32" Integral="3" Fractional="8"/> - <FixedPointParameter Name="q3.9" Size="32" Integral="3" Fractional="9"/> - <FixedPointParameter Name="q3.10" Size="32" Integral="3" Fractional="10"/> - <FixedPointParameter Name="q3.11" Size="32" Integral="3" Fractional="11"/> - <FixedPointParameter Name="q3.12" Size="32" Integral="3" Fractional="12"/> - <FixedPointParameter Name="q3.13" Size="32" Integral="3" Fractional="13"/> - <FixedPointParameter Name="q3.14" Size="32" Integral="3" Fractional="14"/> - <FixedPointParameter Name="q3.15" Size="32" Integral="3" Fractional="15"/> - <FixedPointParameter Name="q3.16" Size="32" Integral="3" Fractional="16"/> - <FixedPointParameter Name="q3.17" Size="32" Integral="3" Fractional="17"/> - <FixedPointParameter Name="q3.18" Size="32" Integral="3" Fractional="18"/> - <FixedPointParameter Name="q3.19" Size="32" Integral="3" Fractional="19"/> - <FixedPointParameter Name="q3.20" Size="32" Integral="3" Fractional="20"/> - <FixedPointParameter Name="q3.21" Size="32" Integral="3" Fractional="21"/> - <FixedPointParameter Name="q3.22" Size="32" Integral="3" Fractional="22"/> - <FixedPointParameter Name="q3.23" Size="32" Integral="3" Fractional="23"/> - <FixedPointParameter Name="q3.24" Size="32" Integral="3" Fractional="24"/> - <FixedPointParameter Name="q3.25" Size="32" Integral="3" Fractional="25"/> - <FixedPointParameter Name="q3.26" Size="32" Integral="3" Fractional="26"/> - <FixedPointParameter Name="q3.27" Size="32" Integral="3" Fractional="27"/> - <FixedPointParameter Name="q3.28" Size="32" Integral="3" Fractional="28"/> - <FixedPointParameter Name="q4.0" Size="32" Integral="4" Fractional="0"/> - <FixedPointParameter Name="q4.1" Size="32" Integral="4" Fractional="1"/> - <FixedPointParameter Name="q4.2" Size="32" Integral="4" Fractional="2"/> - <FixedPointParameter Name="q4.3" Size="32" Integral="4" Fractional="3"/> - <FixedPointParameter Name="q4.4" Size="32" Integral="4" Fractional="4"/> - <FixedPointParameter Name="q4.5" Size="32" Integral="4" Fractional="5"/> - <FixedPointParameter Name="q4.6" Size="32" Integral="4" Fractional="6"/> - <FixedPointParameter Name="q4.7" Size="32" Integral="4" Fractional="7"/> - <FixedPointParameter Name="q4.8" Size="32" Integral="4" Fractional="8"/> - <FixedPointParameter Name="q4.9" Size="32" Integral="4" Fractional="9"/> - <FixedPointParameter Name="q4.10" Size="32" Integral="4" Fractional="10"/> - <FixedPointParameter Name="q4.11" Size="32" Integral="4" Fractional="11"/> - <FixedPointParameter Name="q4.12" Size="32" Integral="4" Fractional="12"/> - <FixedPointParameter Name="q4.13" Size="32" Integral="4" Fractional="13"/> - <FixedPointParameter Name="q4.14" Size="32" Integral="4" Fractional="14"/> - <FixedPointParameter Name="q4.15" Size="32" Integral="4" Fractional="15"/> - <FixedPointParameter Name="q4.16" Size="32" Integral="4" Fractional="16"/> - <FixedPointParameter Name="q4.17" Size="32" Integral="4" Fractional="17"/> - <FixedPointParameter Name="q4.18" Size="32" Integral="4" Fractional="18"/> - <FixedPointParameter Name="q4.19" Size="32" Integral="4" Fractional="19"/> - <FixedPointParameter Name="q4.20" Size="32" Integral="4" Fractional="20"/> - <FixedPointParameter Name="q4.21" Size="32" Integral="4" Fractional="21"/> - <FixedPointParameter Name="q4.22" Size="32" Integral="4" Fractional="22"/> - <FixedPointParameter Name="q4.23" Size="32" Integral="4" Fractional="23"/> - <FixedPointParameter Name="q4.24" Size="32" Integral="4" Fractional="24"/> - <FixedPointParameter Name="q4.25" Size="32" Integral="4" Fractional="25"/> - <FixedPointParameter Name="q4.26" Size="32" Integral="4" Fractional="26"/> - <FixedPointParameter Name="q4.27" Size="32" Integral="4" Fractional="27"/> - <FixedPointParameter Name="q5.0" Size="32" Integral="5" Fractional="0"/> - <FixedPointParameter Name="q5.1" Size="32" Integral="5" Fractional="1"/> - <FixedPointParameter Name="q5.2" Size="32" Integral="5" Fractional="2"/> - <FixedPointParameter Name="q5.3" Size="32" Integral="5" Fractional="3"/> - <FixedPointParameter Name="q5.4" Size="32" Integral="5" Fractional="4"/> - <FixedPointParameter Name="q5.5" Size="32" Integral="5" Fractional="5"/> - <FixedPointParameter Name="q5.6" Size="32" Integral="5" Fractional="6"/> - <FixedPointParameter Name="q5.7" Size="32" Integral="5" Fractional="7"/> - <FixedPointParameter Name="q5.8" Size="32" Integral="5" Fractional="8"/> - <FixedPointParameter Name="q5.9" Size="32" Integral="5" Fractional="9"/> - <FixedPointParameter Name="q5.10" Size="32" Integral="5" Fractional="10"/> - <FixedPointParameter Name="q5.11" Size="32" Integral="5" Fractional="11"/> - <FixedPointParameter Name="q5.12" Size="32" Integral="5" Fractional="12"/> - <FixedPointParameter Name="q5.13" Size="32" Integral="5" Fractional="13"/> - <FixedPointParameter Name="q5.14" Size="32" Integral="5" Fractional="14"/> - <FixedPointParameter Name="q5.15" Size="32" Integral="5" Fractional="15"/> - <FixedPointParameter Name="q5.16" Size="32" Integral="5" Fractional="16"/> - <FixedPointParameter Name="q5.17" Size="32" Integral="5" Fractional="17"/> - <FixedPointParameter Name="q5.18" Size="32" Integral="5" Fractional="18"/> - <FixedPointParameter Name="q5.19" Size="32" Integral="5" Fractional="19"/> - <FixedPointParameter Name="q5.20" Size="32" Integral="5" Fractional="20"/> - <FixedPointParameter Name="q5.21" Size="32" Integral="5" Fractional="21"/> - <FixedPointParameter Name="q5.22" Size="32" Integral="5" Fractional="22"/> - <FixedPointParameter Name="q5.23" Size="32" Integral="5" Fractional="23"/> - <FixedPointParameter Name="q5.24" Size="32" Integral="5" Fractional="24"/> - <FixedPointParameter Name="q5.25" Size="32" Integral="5" Fractional="25"/> - <FixedPointParameter Name="q5.26" Size="32" Integral="5" Fractional="26"/> - <FixedPointParameter Name="q6.0" Size="32" Integral="6" Fractional="0"/> - <FixedPointParameter Name="q6.1" Size="32" Integral="6" Fractional="1"/> - <FixedPointParameter Name="q6.2" Size="32" Integral="6" Fractional="2"/> - <FixedPointParameter Name="q6.3" Size="32" Integral="6" Fractional="3"/> - <FixedPointParameter Name="q6.4" Size="32" Integral="6" Fractional="4"/> - <FixedPointParameter Name="q6.5" Size="32" Integral="6" Fractional="5"/> - <FixedPointParameter Name="q6.6" Size="32" Integral="6" Fractional="6"/> - <FixedPointParameter Name="q6.7" Size="32" Integral="6" Fractional="7"/> - <FixedPointParameter Name="q6.8" Size="32" Integral="6" Fractional="8"/> - <FixedPointParameter Name="q6.9" Size="32" Integral="6" Fractional="9"/> - <FixedPointParameter Name="q6.10" Size="32" Integral="6" Fractional="10"/> - <FixedPointParameter Name="q6.11" Size="32" Integral="6" Fractional="11"/> - <FixedPointParameter Name="q6.12" Size="32" Integral="6" Fractional="12"/> - <FixedPointParameter Name="q6.13" Size="32" Integral="6" Fractional="13"/> - <FixedPointParameter Name="q6.14" Size="32" Integral="6" Fractional="14"/> - <FixedPointParameter Name="q6.15" Size="32" Integral="6" Fractional="15"/> - <FixedPointParameter Name="q6.16" Size="32" Integral="6" Fractional="16"/> - <FixedPointParameter Name="q6.17" Size="32" Integral="6" Fractional="17"/> - <FixedPointParameter Name="q6.18" Size="32" Integral="6" Fractional="18"/> - <FixedPointParameter Name="q6.19" Size="32" Integral="6" Fractional="19"/> - <FixedPointParameter Name="q6.20" Size="32" Integral="6" Fractional="20"/> - <FixedPointParameter Name="q6.21" Size="32" Integral="6" Fractional="21"/> - <FixedPointParameter Name="q6.22" Size="32" Integral="6" Fractional="22"/> - <FixedPointParameter Name="q6.23" Size="32" Integral="6" Fractional="23"/> - <FixedPointParameter Name="q6.24" Size="32" Integral="6" Fractional="24"/> - <FixedPointParameter Name="q6.25" Size="32" Integral="6" Fractional="25"/> - <FixedPointParameter Name="q7.0" Size="32" Integral="7" Fractional="0"/> - <FixedPointParameter Name="q7.1" Size="32" Integral="7" Fractional="1"/> - <FixedPointParameter Name="q7.2" Size="32" Integral="7" Fractional="2"/> - <FixedPointParameter Name="q7.3" Size="32" Integral="7" Fractional="3"/> - <FixedPointParameter Name="q7.4" Size="32" Integral="7" Fractional="4"/> - <FixedPointParameter Name="q7.5" Size="32" Integral="7" Fractional="5"/> - <FixedPointParameter Name="q7.6" Size="32" Integral="7" Fractional="6"/> - <FixedPointParameter Name="q7.7" Size="32" Integral="7" Fractional="7"/> - <FixedPointParameter Name="q7.8" Size="32" Integral="7" Fractional="8"/> - <FixedPointParameter Name="q7.9" Size="32" Integral="7" Fractional="9"/> - <FixedPointParameter Name="q7.10" Size="32" Integral="7" Fractional="10"/> - <FixedPointParameter Name="q7.11" Size="32" Integral="7" Fractional="11"/> - <FixedPointParameter Name="q7.12" Size="32" Integral="7" Fractional="12"/> - <FixedPointParameter Name="q7.13" Size="32" Integral="7" Fractional="13"/> - <FixedPointParameter Name="q7.14" Size="32" Integral="7" Fractional="14"/> - <FixedPointParameter Name="q7.15" Size="32" Integral="7" Fractional="15"/> - <FixedPointParameter Name="q7.16" Size="32" Integral="7" Fractional="16"/> - <FixedPointParameter Name="q7.17" Size="32" Integral="7" Fractional="17"/> - <FixedPointParameter Name="q7.18" Size="32" Integral="7" Fractional="18"/> - <FixedPointParameter Name="q7.19" Size="32" Integral="7" Fractional="19"/> - <FixedPointParameter Name="q7.20" Size="32" Integral="7" Fractional="20"/> - <FixedPointParameter Name="q7.21" Size="32" Integral="7" Fractional="21"/> - <FixedPointParameter Name="q7.22" Size="32" Integral="7" Fractional="22"/> - <FixedPointParameter Name="q7.23" Size="32" Integral="7" Fractional="23"/> - <FixedPointParameter Name="q7.24" Size="32" Integral="7" Fractional="24"/> - <FixedPointParameter Name="q8.0" Size="32" Integral="8" Fractional="0"/> - <FixedPointParameter Name="q8.1" Size="32" Integral="8" Fractional="1"/> - <FixedPointParameter Name="q8.2" Size="32" Integral="8" Fractional="2"/> - <FixedPointParameter Name="q8.3" Size="32" Integral="8" Fractional="3"/> - <FixedPointParameter Name="q8.4" Size="32" Integral="8" Fractional="4"/> - <FixedPointParameter Name="q8.5" Size="32" Integral="8" Fractional="5"/> - <FixedPointParameter Name="q8.6" Size="32" Integral="8" Fractional="6"/> - <FixedPointParameter Name="q8.7" Size="32" Integral="8" Fractional="7"/> - <FixedPointParameter Name="q8.8" Size="32" Integral="8" Fractional="8"/> - <FixedPointParameter Name="q8.9" Size="32" Integral="8" Fractional="9"/> - <FixedPointParameter Name="q8.10" Size="32" Integral="8" Fractional="10"/> - <FixedPointParameter Name="q8.11" Size="32" Integral="8" Fractional="11"/> - <FixedPointParameter Name="q8.12" Size="32" Integral="8" Fractional="12"/> - <FixedPointParameter Name="q8.13" Size="32" Integral="8" Fractional="13"/> - <FixedPointParameter Name="q8.14" Size="32" Integral="8" Fractional="14"/> - <FixedPointParameter Name="q8.15" Size="32" Integral="8" Fractional="15"/> - <FixedPointParameter Name="q8.16" Size="32" Integral="8" Fractional="16"/> - <FixedPointParameter Name="q8.17" Size="32" Integral="8" Fractional="17"/> - <FixedPointParameter Name="q8.18" Size="32" Integral="8" Fractional="18"/> - <FixedPointParameter Name="q8.19" Size="32" Integral="8" Fractional="19"/> - <FixedPointParameter Name="q8.20" Size="32" Integral="8" Fractional="20"/> - <FixedPointParameter Name="q8.21" Size="32" Integral="8" Fractional="21"/> - <FixedPointParameter Name="q8.22" Size="32" Integral="8" Fractional="22"/> - <FixedPointParameter Name="q8.23" Size="32" Integral="8" Fractional="23"/> - <FixedPointParameter Name="q9.0" Size="32" Integral="9" Fractional="0"/> - <FixedPointParameter Name="q9.1" Size="32" Integral="9" Fractional="1"/> - <FixedPointParameter Name="q9.2" Size="32" Integral="9" Fractional="2"/> - <FixedPointParameter Name="q9.3" Size="32" Integral="9" Fractional="3"/> - <FixedPointParameter Name="q9.4" Size="32" Integral="9" Fractional="4"/> - <FixedPointParameter Name="q9.5" Size="32" Integral="9" Fractional="5"/> - <FixedPointParameter Name="q9.6" Size="32" Integral="9" Fractional="6"/> - <FixedPointParameter Name="q9.7" Size="32" Integral="9" Fractional="7"/> - <FixedPointParameter Name="q9.8" Size="32" Integral="9" Fractional="8"/> - <FixedPointParameter Name="q9.9" Size="32" Integral="9" Fractional="9"/> - <FixedPointParameter Name="q9.10" Size="32" Integral="9" Fractional="10"/> - <FixedPointParameter Name="q9.11" Size="32" Integral="9" Fractional="11"/> - <FixedPointParameter Name="q9.12" Size="32" Integral="9" Fractional="12"/> - <FixedPointParameter Name="q9.13" Size="32" Integral="9" Fractional="13"/> - <FixedPointParameter Name="q9.14" Size="32" Integral="9" Fractional="14"/> - <FixedPointParameter Name="q9.15" Size="32" Integral="9" Fractional="15"/> - <FixedPointParameter Name="q9.16" Size="32" Integral="9" Fractional="16"/> - <FixedPointParameter Name="q9.17" Size="32" Integral="9" Fractional="17"/> - <FixedPointParameter Name="q9.18" Size="32" Integral="9" Fractional="18"/> - <FixedPointParameter Name="q9.19" Size="32" Integral="9" Fractional="19"/> - <FixedPointParameter Name="q9.20" Size="32" Integral="9" Fractional="20"/> - <FixedPointParameter Name="q9.21" Size="32" Integral="9" Fractional="21"/> - <FixedPointParameter Name="q9.22" Size="32" Integral="9" Fractional="22"/> - <FixedPointParameter Name="q10.0" Size="32" Integral="10" Fractional="0"/> - <FixedPointParameter Name="q10.1" Size="32" Integral="10" Fractional="1"/> - <FixedPointParameter Name="q10.2" Size="32" Integral="10" Fractional="2"/> - <FixedPointParameter Name="q10.3" Size="32" Integral="10" Fractional="3"/> - <FixedPointParameter Name="q10.4" Size="32" Integral="10" Fractional="4"/> - <FixedPointParameter Name="q10.5" Size="32" Integral="10" Fractional="5"/> - <FixedPointParameter Name="q10.6" Size="32" Integral="10" Fractional="6"/> - <FixedPointParameter Name="q10.7" Size="32" Integral="10" Fractional="7"/> - <FixedPointParameter Name="q10.8" Size="32" Integral="10" Fractional="8"/> - <FixedPointParameter Name="q10.9" Size="32" Integral="10" Fractional="9"/> - <FixedPointParameter Name="q10.10" Size="32" Integral="10" Fractional="10"/> - <FixedPointParameter Name="q10.11" Size="32" Integral="10" Fractional="11"/> - <FixedPointParameter Name="q10.12" Size="32" Integral="10" Fractional="12"/> - <FixedPointParameter Name="q10.13" Size="32" Integral="10" Fractional="13"/> - <FixedPointParameter Name="q10.14" Size="32" Integral="10" Fractional="14"/> - <FixedPointParameter Name="q10.15" Size="32" Integral="10" Fractional="15"/> - <FixedPointParameter Name="q10.16" Size="32" Integral="10" Fractional="16"/> - <FixedPointParameter Name="q10.17" Size="32" Integral="10" Fractional="17"/> - <FixedPointParameter Name="q10.18" Size="32" Integral="10" Fractional="18"/> - <FixedPointParameter Name="q10.19" Size="32" Integral="10" Fractional="19"/> - <FixedPointParameter Name="q10.20" Size="32" Integral="10" Fractional="20"/> - <FixedPointParameter Name="q10.21" Size="32" Integral="10" Fractional="21"/> - <FixedPointParameter Name="q11.0" Size="32" Integral="11" Fractional="0"/> - <FixedPointParameter Name="q11.1" Size="32" Integral="11" Fractional="1"/> - <FixedPointParameter Name="q11.2" Size="32" Integral="11" Fractional="2"/> - <FixedPointParameter Name="q11.3" Size="32" Integral="11" Fractional="3"/> - <FixedPointParameter Name="q11.4" Size="32" Integral="11" Fractional="4"/> - <FixedPointParameter Name="q11.5" Size="32" Integral="11" Fractional="5"/> - <FixedPointParameter Name="q11.6" Size="32" Integral="11" Fractional="6"/> - <FixedPointParameter Name="q11.7" Size="32" Integral="11" Fractional="7"/> - <FixedPointParameter Name="q11.8" Size="32" Integral="11" Fractional="8"/> - <FixedPointParameter Name="q11.9" Size="32" Integral="11" Fractional="9"/> - <FixedPointParameter Name="q11.10" Size="32" Integral="11" Fractional="10"/> - <FixedPointParameter Name="q11.11" Size="32" Integral="11" Fractional="11"/> - <FixedPointParameter Name="q11.12" Size="32" Integral="11" Fractional="12"/> - <FixedPointParameter Name="q11.13" Size="32" Integral="11" Fractional="13"/> - <FixedPointParameter Name="q11.14" Size="32" Integral="11" Fractional="14"/> - <FixedPointParameter Name="q11.15" Size="32" Integral="11" Fractional="15"/> - <FixedPointParameter Name="q11.16" Size="32" Integral="11" Fractional="16"/> - <FixedPointParameter Name="q11.17" Size="32" Integral="11" Fractional="17"/> - <FixedPointParameter Name="q11.18" Size="32" Integral="11" Fractional="18"/> - <FixedPointParameter Name="q11.19" Size="32" Integral="11" Fractional="19"/> - <FixedPointParameter Name="q11.20" Size="32" Integral="11" Fractional="20"/> - <FixedPointParameter Name="q12.0" Size="32" Integral="12" Fractional="0"/> - <FixedPointParameter Name="q12.1" Size="32" Integral="12" Fractional="1"/> - <FixedPointParameter Name="q12.2" Size="32" Integral="12" Fractional="2"/> - <FixedPointParameter Name="q12.3" Size="32" Integral="12" Fractional="3"/> - <FixedPointParameter Name="q12.4" Size="32" Integral="12" Fractional="4"/> - <FixedPointParameter Name="q12.5" Size="32" Integral="12" Fractional="5"/> - <FixedPointParameter Name="q12.6" Size="32" Integral="12" Fractional="6"/> - <FixedPointParameter Name="q12.7" Size="32" Integral="12" Fractional="7"/> - <FixedPointParameter Name="q12.8" Size="32" Integral="12" Fractional="8"/> - <FixedPointParameter Name="q12.9" Size="32" Integral="12" Fractional="9"/> - <FixedPointParameter Name="q12.10" Size="32" Integral="12" Fractional="10"/> - <FixedPointParameter Name="q12.11" Size="32" Integral="12" Fractional="11"/> - <FixedPointParameter Name="q12.12" Size="32" Integral="12" Fractional="12"/> - <FixedPointParameter Name="q12.13" Size="32" Integral="12" Fractional="13"/> - <FixedPointParameter Name="q12.14" Size="32" Integral="12" Fractional="14"/> - <FixedPointParameter Name="q12.15" Size="32" Integral="12" Fractional="15"/> - <FixedPointParameter Name="q12.16" Size="32" Integral="12" Fractional="16"/> - <FixedPointParameter Name="q12.17" Size="32" Integral="12" Fractional="17"/> - <FixedPointParameter Name="q12.18" Size="32" Integral="12" Fractional="18"/> - <FixedPointParameter Name="q12.19" Size="32" Integral="12" Fractional="19"/> - <FixedPointParameter Name="q13.0" Size="32" Integral="13" Fractional="0"/> - <FixedPointParameter Name="q13.1" Size="32" Integral="13" Fractional="1"/> - <FixedPointParameter Name="q13.2" Size="32" Integral="13" Fractional="2"/> - <FixedPointParameter Name="q13.3" Size="32" Integral="13" Fractional="3"/> - <FixedPointParameter Name="q13.4" Size="32" Integral="13" Fractional="4"/> - <FixedPointParameter Name="q13.5" Size="32" Integral="13" Fractional="5"/> - <FixedPointParameter Name="q13.6" Size="32" Integral="13" Fractional="6"/> - <FixedPointParameter Name="q13.7" Size="32" Integral="13" Fractional="7"/> - <FixedPointParameter Name="q13.8" Size="32" Integral="13" Fractional="8"/> - <FixedPointParameter Name="q13.9" Size="32" Integral="13" Fractional="9"/> - <FixedPointParameter Name="q13.10" Size="32" Integral="13" Fractional="10"/> - <FixedPointParameter Name="q13.11" Size="32" Integral="13" Fractional="11"/> - <FixedPointParameter Name="q13.12" Size="32" Integral="13" Fractional="12"/> - <FixedPointParameter Name="q13.13" Size="32" Integral="13" Fractional="13"/> - <FixedPointParameter Name="q13.14" Size="32" Integral="13" Fractional="14"/> - <FixedPointParameter Name="q13.15" Size="32" Integral="13" Fractional="15"/> - <FixedPointParameter Name="q13.16" Size="32" Integral="13" Fractional="16"/> - <FixedPointParameter Name="q13.17" Size="32" Integral="13" Fractional="17"/> - <FixedPointParameter Name="q13.18" Size="32" Integral="13" Fractional="18"/> - <FixedPointParameter Name="q14.0" Size="32" Integral="14" Fractional="0"/> - <FixedPointParameter Name="q14.1" Size="32" Integral="14" Fractional="1"/> - <FixedPointParameter Name="q14.2" Size="32" Integral="14" Fractional="2"/> - <FixedPointParameter Name="q14.3" Size="32" Integral="14" Fractional="3"/> - <FixedPointParameter Name="q14.4" Size="32" Integral="14" Fractional="4"/> - <FixedPointParameter Name="q14.5" Size="32" Integral="14" Fractional="5"/> - <FixedPointParameter Name="q14.6" Size="32" Integral="14" Fractional="6"/> - <FixedPointParameter Name="q14.7" Size="32" Integral="14" Fractional="7"/> - <FixedPointParameter Name="q14.8" Size="32" Integral="14" Fractional="8"/> - <FixedPointParameter Name="q14.9" Size="32" Integral="14" Fractional="9"/> - <FixedPointParameter Name="q14.10" Size="32" Integral="14" Fractional="10"/> - <FixedPointParameter Name="q14.11" Size="32" Integral="14" Fractional="11"/> - <FixedPointParameter Name="q14.12" Size="32" Integral="14" Fractional="12"/> - <FixedPointParameter Name="q14.13" Size="32" Integral="14" Fractional="13"/> - <FixedPointParameter Name="q14.14" Size="32" Integral="14" Fractional="14"/> - <FixedPointParameter Name="q14.15" Size="32" Integral="14" Fractional="15"/> - <FixedPointParameter Name="q14.16" Size="32" Integral="14" Fractional="16"/> - <FixedPointParameter Name="q14.17" Size="32" Integral="14" Fractional="17"/> - <FixedPointParameter Name="q15.0" Size="32" Integral="15" Fractional="0"/> - <FixedPointParameter Name="q15.1" Size="32" Integral="15" Fractional="1"/> - <FixedPointParameter Name="q15.2" Size="32" Integral="15" Fractional="2"/> - <FixedPointParameter Name="q15.3" Size="32" Integral="15" Fractional="3"/> - <FixedPointParameter Name="q15.4" Size="32" Integral="15" Fractional="4"/> - <FixedPointParameter Name="q15.5" Size="32" Integral="15" Fractional="5"/> - <FixedPointParameter Name="q15.6" Size="32" Integral="15" Fractional="6"/> - <FixedPointParameter Name="q15.7" Size="32" Integral="15" Fractional="7"/> - <FixedPointParameter Name="q15.8" Size="32" Integral="15" Fractional="8"/> - <FixedPointParameter Name="q15.9" Size="32" Integral="15" Fractional="9"/> - <FixedPointParameter Name="q15.10" Size="32" Integral="15" Fractional="10"/> - <FixedPointParameter Name="q15.11" Size="32" Integral="15" Fractional="11"/> - <FixedPointParameter Name="q15.12" Size="32" Integral="15" Fractional="12"/> - <FixedPointParameter Name="q15.13" Size="32" Integral="15" Fractional="13"/> - <FixedPointParameter Name="q15.14" Size="32" Integral="15" Fractional="14"/> - <FixedPointParameter Name="q15.15" Size="32" Integral="15" Fractional="15"/> - <FixedPointParameter Name="q15.16" Size="32" Integral="15" Fractional="16"/> - <FixedPointParameter Name="q16.0" Size="32" Integral="16" Fractional="0"/> - <FixedPointParameter Name="q16.1" Size="32" Integral="16" Fractional="1"/> - <FixedPointParameter Name="q16.2" Size="32" Integral="16" Fractional="2"/> - <FixedPointParameter Name="q16.3" Size="32" Integral="16" Fractional="3"/> - <FixedPointParameter Name="q16.4" Size="32" Integral="16" Fractional="4"/> - <FixedPointParameter Name="q16.5" Size="32" Integral="16" Fractional="5"/> - <FixedPointParameter Name="q16.6" Size="32" Integral="16" Fractional="6"/> - <FixedPointParameter Name="q16.7" Size="32" Integral="16" Fractional="7"/> - <FixedPointParameter Name="q16.8" Size="32" Integral="16" Fractional="8"/> - <FixedPointParameter Name="q16.9" Size="32" Integral="16" Fractional="9"/> - <FixedPointParameter Name="q16.10" Size="32" Integral="16" Fractional="10"/> - <FixedPointParameter Name="q16.11" Size="32" Integral="16" Fractional="11"/> - <FixedPointParameter Name="q16.12" Size="32" Integral="16" Fractional="12"/> - <FixedPointParameter Name="q16.13" Size="32" Integral="16" Fractional="13"/> - <FixedPointParameter Name="q16.14" Size="32" Integral="16" Fractional="14"/> - <FixedPointParameter Name="q16.15" Size="32" Integral="16" Fractional="15"/> - <FixedPointParameter Name="q17.0" Size="32" Integral="17" Fractional="0"/> - <FixedPointParameter Name="q17.1" Size="32" Integral="17" Fractional="1"/> - <FixedPointParameter Name="q17.2" Size="32" Integral="17" Fractional="2"/> - <FixedPointParameter Name="q17.3" Size="32" Integral="17" Fractional="3"/> - <FixedPointParameter Name="q17.4" Size="32" Integral="17" Fractional="4"/> - <FixedPointParameter Name="q17.5" Size="32" Integral="17" Fractional="5"/> - <FixedPointParameter Name="q17.6" Size="32" Integral="17" Fractional="6"/> - <FixedPointParameter Name="q17.7" Size="32" Integral="17" Fractional="7"/> - <FixedPointParameter Name="q17.8" Size="32" Integral="17" Fractional="8"/> - <FixedPointParameter Name="q17.9" Size="32" Integral="17" Fractional="9"/> - <FixedPointParameter Name="q17.10" Size="32" Integral="17" Fractional="10"/> - <FixedPointParameter Name="q17.11" Size="32" Integral="17" Fractional="11"/> - <FixedPointParameter Name="q17.12" Size="32" Integral="17" Fractional="12"/> - <FixedPointParameter Name="q17.13" Size="32" Integral="17" Fractional="13"/> - <FixedPointParameter Name="q17.14" Size="32" Integral="17" Fractional="14"/> - <FixedPointParameter Name="q18.0" Size="32" Integral="18" Fractional="0"/> - <FixedPointParameter Name="q18.1" Size="32" Integral="18" Fractional="1"/> - <FixedPointParameter Name="q18.2" Size="32" Integral="18" Fractional="2"/> - <FixedPointParameter Name="q18.3" Size="32" Integral="18" Fractional="3"/> - <FixedPointParameter Name="q18.4" Size="32" Integral="18" Fractional="4"/> - <FixedPointParameter Name="q18.5" Size="32" Integral="18" Fractional="5"/> - <FixedPointParameter Name="q18.6" Size="32" Integral="18" Fractional="6"/> - <FixedPointParameter Name="q18.7" Size="32" Integral="18" Fractional="7"/> - <FixedPointParameter Name="q18.8" Size="32" Integral="18" Fractional="8"/> - <FixedPointParameter Name="q18.9" Size="32" Integral="18" Fractional="9"/> - <FixedPointParameter Name="q18.10" Size="32" Integral="18" Fractional="10"/> - <FixedPointParameter Name="q18.11" Size="32" Integral="18" Fractional="11"/> - <FixedPointParameter Name="q18.12" Size="32" Integral="18" Fractional="12"/> - <FixedPointParameter Name="q18.13" Size="32" Integral="18" Fractional="13"/> - <FixedPointParameter Name="q19.0" Size="32" Integral="19" Fractional="0"/> - <FixedPointParameter Name="q19.1" Size="32" Integral="19" Fractional="1"/> - <FixedPointParameter Name="q19.2" Size="32" Integral="19" Fractional="2"/> - <FixedPointParameter Name="q19.3" Size="32" Integral="19" Fractional="3"/> - <FixedPointParameter Name="q19.4" Size="32" Integral="19" Fractional="4"/> - <FixedPointParameter Name="q19.5" Size="32" Integral="19" Fractional="5"/> - <FixedPointParameter Name="q19.6" Size="32" Integral="19" Fractional="6"/> - <FixedPointParameter Name="q19.7" Size="32" Integral="19" Fractional="7"/> - <FixedPointParameter Name="q19.8" Size="32" Integral="19" Fractional="8"/> - <FixedPointParameter Name="q19.9" Size="32" Integral="19" Fractional="9"/> - <FixedPointParameter Name="q19.10" Size="32" Integral="19" Fractional="10"/> - <FixedPointParameter Name="q19.11" Size="32" Integral="19" Fractional="11"/> - <FixedPointParameter Name="q19.12" Size="32" Integral="19" Fractional="12"/> - <FixedPointParameter Name="q20.0" Size="32" Integral="20" Fractional="0"/> - <FixedPointParameter Name="q20.1" Size="32" Integral="20" Fractional="1"/> - <FixedPointParameter Name="q20.2" Size="32" Integral="20" Fractional="2"/> - <FixedPointParameter Name="q20.3" Size="32" Integral="20" Fractional="3"/> - <FixedPointParameter Name="q20.4" Size="32" Integral="20" Fractional="4"/> - <FixedPointParameter Name="q20.5" Size="32" Integral="20" Fractional="5"/> - <FixedPointParameter Name="q20.6" Size="32" Integral="20" Fractional="6"/> - <FixedPointParameter Name="q20.7" Size="32" Integral="20" Fractional="7"/> - <FixedPointParameter Name="q20.8" Size="32" Integral="20" Fractional="8"/> - <FixedPointParameter Name="q20.9" Size="32" Integral="20" Fractional="9"/> - <FixedPointParameter Name="q20.10" Size="32" Integral="20" Fractional="10"/> - <FixedPointParameter Name="q20.11" Size="32" Integral="20" Fractional="11"/> - <FixedPointParameter Name="q21.0" Size="32" Integral="21" Fractional="0"/> - <FixedPointParameter Name="q21.1" Size="32" Integral="21" Fractional="1"/> - <FixedPointParameter Name="q21.2" Size="32" Integral="21" Fractional="2"/> - <FixedPointParameter Name="q21.3" Size="32" Integral="21" Fractional="3"/> - <FixedPointParameter Name="q21.4" Size="32" Integral="21" Fractional="4"/> - <FixedPointParameter Name="q21.5" Size="32" Integral="21" Fractional="5"/> - <FixedPointParameter Name="q21.6" Size="32" Integral="21" Fractional="6"/> - <FixedPointParameter Name="q21.7" Size="32" Integral="21" Fractional="7"/> - <FixedPointParameter Name="q21.8" Size="32" Integral="21" Fractional="8"/> - <FixedPointParameter Name="q21.9" Size="32" Integral="21" Fractional="9"/> - <FixedPointParameter Name="q21.10" Size="32" Integral="21" Fractional="10"/> - <FixedPointParameter Name="q22.0" Size="32" Integral="22" Fractional="0"/> - <FixedPointParameter Name="q22.1" Size="32" Integral="22" Fractional="1"/> - <FixedPointParameter Name="q22.2" Size="32" Integral="22" Fractional="2"/> - <FixedPointParameter Name="q22.3" Size="32" Integral="22" Fractional="3"/> - <FixedPointParameter Name="q22.4" Size="32" Integral="22" Fractional="4"/> - <FixedPointParameter Name="q22.5" Size="32" Integral="22" Fractional="5"/> - <FixedPointParameter Name="q22.6" Size="32" Integral="22" Fractional="6"/> - <FixedPointParameter Name="q22.7" Size="32" Integral="22" Fractional="7"/> - <FixedPointParameter Name="q22.8" Size="32" Integral="22" Fractional="8"/> - <FixedPointParameter Name="q22.9" Size="32" Integral="22" Fractional="9"/> - <FixedPointParameter Name="q23.0" Size="32" Integral="23" Fractional="0"/> - <FixedPointParameter Name="q23.1" Size="32" Integral="23" Fractional="1"/> - <FixedPointParameter Name="q23.2" Size="32" Integral="23" Fractional="2"/> - <FixedPointParameter Name="q23.3" Size="32" Integral="23" Fractional="3"/> - <FixedPointParameter Name="q23.4" Size="32" Integral="23" Fractional="4"/> - <FixedPointParameter Name="q23.5" Size="32" Integral="23" Fractional="5"/> - <FixedPointParameter Name="q23.6" Size="32" Integral="23" Fractional="6"/> - <FixedPointParameter Name="q23.7" Size="32" Integral="23" Fractional="7"/> - <FixedPointParameter Name="q23.8" Size="32" Integral="23" Fractional="8"/> - <FixedPointParameter Name="q24.0" Size="32" Integral="24" Fractional="0"/> - <FixedPointParameter Name="q24.1" Size="32" Integral="24" Fractional="1"/> - <FixedPointParameter Name="q24.2" Size="32" Integral="24" Fractional="2"/> - <FixedPointParameter Name="q24.3" Size="32" Integral="24" Fractional="3"/> - <FixedPointParameter Name="q24.4" Size="32" Integral="24" Fractional="4"/> - <FixedPointParameter Name="q24.5" Size="32" Integral="24" Fractional="5"/> - <FixedPointParameter Name="q24.6" Size="32" Integral="24" Fractional="6"/> - <FixedPointParameter Name="q24.7" Size="32" Integral="24" Fractional="7"/> - <FixedPointParameter Name="q25.0" Size="32" Integral="25" Fractional="0"/> - <FixedPointParameter Name="q25.1" Size="32" Integral="25" Fractional="1"/> - <FixedPointParameter Name="q25.2" Size="32" Integral="25" Fractional="2"/> - <FixedPointParameter Name="q25.3" Size="32" Integral="25" Fractional="3"/> - <FixedPointParameter Name="q25.4" Size="32" Integral="25" Fractional="4"/> - <FixedPointParameter Name="q25.5" Size="32" Integral="25" Fractional="5"/> - <FixedPointParameter Name="q25.6" Size="32" Integral="25" Fractional="6"/> - <FixedPointParameter Name="q26.0" Size="32" Integral="26" Fractional="0"/> - <FixedPointParameter Name="q26.1" Size="32" Integral="26" Fractional="1"/> - <FixedPointParameter Name="q26.2" Size="32" Integral="26" Fractional="2"/> - <FixedPointParameter Name="q26.3" Size="32" Integral="26" Fractional="3"/> - <FixedPointParameter Name="q26.4" Size="32" Integral="26" Fractional="4"/> - <FixedPointParameter Name="q26.5" Size="32" Integral="26" Fractional="5"/> - <FixedPointParameter Name="q27.0" Size="32" Integral="27" Fractional="0"/> - <FixedPointParameter Name="q27.1" Size="32" Integral="27" Fractional="1"/> - <FixedPointParameter Name="q27.2" Size="32" Integral="27" Fractional="2"/> - <FixedPointParameter Name="q27.3" Size="32" Integral="27" Fractional="3"/> - <FixedPointParameter Name="q27.4" Size="32" Integral="27" Fractional="4"/> - <FixedPointParameter Name="q28.0" Size="32" Integral="28" Fractional="0"/> - <FixedPointParameter Name="q28.1" Size="32" Integral="28" Fractional="1"/> - <FixedPointParameter Name="q28.2" Size="32" Integral="28" Fractional="2"/> - <FixedPointParameter Name="q28.3" Size="32" Integral="28" Fractional="3"/> - <FixedPointParameter Name="q29.0" Size="32" Integral="29" Fractional="0"/> - <FixedPointParameter Name="q29.1" Size="32" Integral="29" Fractional="1"/> - <FixedPointParameter Name="q29.2" Size="32" Integral="29" Fractional="2"/> - <FixedPointParameter Name="q30.0" Size="32" Integral="30" Fractional="0"/> - <FixedPointParameter Name="q30.1" Size="32" Integral="30" Fractional="1"/> - <FixedPointParameter Name="q31.0" Size="32" Integral="31" Fractional="0"/> - </ParameterBlock> - - <!-- 16b --> - <ParameterBlock Name="16"> - <FixedPointParameter Name="q0.0" Size="16" Integral="0" Fractional="0"/> - <FixedPointParameter Name="q0.1" Size="16" Integral="0" Fractional="1"/> - <FixedPointParameter Name="q0.2" Size="16" Integral="0" Fractional="2"/> - <FixedPointParameter Name="q0.3" Size="16" Integral="0" Fractional="3"/> - <FixedPointParameter Name="q0.4" Size="16" Integral="0" Fractional="4"/> - <FixedPointParameter Name="q0.5" Size="16" Integral="0" Fractional="5"/> - <FixedPointParameter Name="q0.6" Size="16" Integral="0" Fractional="6"/> - <FixedPointParameter Name="q0.7" Size="16" Integral="0" Fractional="7"/> - <FixedPointParameter Name="q0.8" Size="16" Integral="0" Fractional="8"/> - <FixedPointParameter Name="q0.9" Size="16" Integral="0" Fractional="9"/> - <FixedPointParameter Name="q0.10" Size="16" Integral="0" Fractional="10"/> - <FixedPointParameter Name="q0.11" Size="16" Integral="0" Fractional="11"/> - <FixedPointParameter Name="q0.12" Size="16" Integral="0" Fractional="12"/> - <FixedPointParameter Name="q0.13" Size="16" Integral="0" Fractional="13"/> - <FixedPointParameter Name="q0.14" Size="16" Integral="0" Fractional="14"/> - <FixedPointParameter Name="q0.15" Size="16" Integral="0" Fractional="15"/> - <FixedPointParameter Name="q1.0" Size="16" Integral="1" Fractional="0"/> - <FixedPointParameter Name="q1.1" Size="16" Integral="1" Fractional="1"/> - <FixedPointParameter Name="q1.2" Size="16" Integral="1" Fractional="2"/> - <FixedPointParameter Name="q1.3" Size="16" Integral="1" Fractional="3"/> - <FixedPointParameter Name="q1.4" Size="16" Integral="1" Fractional="4"/> - <FixedPointParameter Name="q1.5" Size="16" Integral="1" Fractional="5"/> - <FixedPointParameter Name="q1.6" Size="16" Integral="1" Fractional="6"/> - <FixedPointParameter Name="q1.7" Size="16" Integral="1" Fractional="7"/> - <FixedPointParameter Name="q1.8" Size="16" Integral="1" Fractional="8"/> - <FixedPointParameter Name="q1.9" Size="16" Integral="1" Fractional="9"/> - <FixedPointParameter Name="q1.10" Size="16" Integral="1" Fractional="10"/> - <FixedPointParameter Name="q1.11" Size="16" Integral="1" Fractional="11"/> - <FixedPointParameter Name="q1.12" Size="16" Integral="1" Fractional="12"/> - <FixedPointParameter Name="q1.13" Size="16" Integral="1" Fractional="13"/> - <FixedPointParameter Name="q1.14" Size="16" Integral="1" Fractional="14"/> - <FixedPointParameter Name="q2.0" Size="16" Integral="2" Fractional="0"/> - <FixedPointParameter Name="q2.1" Size="16" Integral="2" Fractional="1"/> - <FixedPointParameter Name="q2.2" Size="16" Integral="2" Fractional="2"/> - <FixedPointParameter Name="q2.3" Size="16" Integral="2" Fractional="3"/> - <FixedPointParameter Name="q2.4" Size="16" Integral="2" Fractional="4"/> - <FixedPointParameter Name="q2.5" Size="16" Integral="2" Fractional="5"/> - <FixedPointParameter Name="q2.6" Size="16" Integral="2" Fractional="6"/> - <FixedPointParameter Name="q2.7" Size="16" Integral="2" Fractional="7"/> - <FixedPointParameter Name="q2.8" Size="16" Integral="2" Fractional="8"/> - <FixedPointParameter Name="q2.9" Size="16" Integral="2" Fractional="9"/> - <FixedPointParameter Name="q2.10" Size="16" Integral="2" Fractional="10"/> - <FixedPointParameter Name="q2.11" Size="16" Integral="2" Fractional="11"/> - <FixedPointParameter Name="q2.12" Size="16" Integral="2" Fractional="12"/> - <FixedPointParameter Name="q2.13" Size="16" Integral="2" Fractional="13"/> - <FixedPointParameter Name="q3.0" Size="16" Integral="3" Fractional="0"/> - <FixedPointParameter Name="q3.1" Size="16" Integral="3" Fractional="1"/> - <FixedPointParameter Name="q3.2" Size="16" Integral="3" Fractional="2"/> - <FixedPointParameter Name="q3.3" Size="16" Integral="3" Fractional="3"/> - <FixedPointParameter Name="q3.4" Size="16" Integral="3" Fractional="4"/> - <FixedPointParameter Name="q3.5" Size="16" Integral="3" Fractional="5"/> - <FixedPointParameter Name="q3.6" Size="16" Integral="3" Fractional="6"/> - <FixedPointParameter Name="q3.7" Size="16" Integral="3" Fractional="7"/> - <FixedPointParameter Name="q3.8" Size="16" Integral="3" Fractional="8"/> - <FixedPointParameter Name="q3.9" Size="16" Integral="3" Fractional="9"/> - <FixedPointParameter Name="q3.10" Size="16" Integral="3" Fractional="10"/> - <FixedPointParameter Name="q3.11" Size="16" Integral="3" Fractional="11"/> - <FixedPointParameter Name="q3.12" Size="16" Integral="3" Fractional="12"/> - <FixedPointParameter Name="q4.0" Size="16" Integral="4" Fractional="0"/> - <FixedPointParameter Name="q4.1" Size="16" Integral="4" Fractional="1"/> - <FixedPointParameter Name="q4.2" Size="16" Integral="4" Fractional="2"/> - <FixedPointParameter Name="q4.3" Size="16" Integral="4" Fractional="3"/> - <FixedPointParameter Name="q4.4" Size="16" Integral="4" Fractional="4"/> - <FixedPointParameter Name="q4.5" Size="16" Integral="4" Fractional="5"/> - <FixedPointParameter Name="q4.6" Size="16" Integral="4" Fractional="6"/> - <FixedPointParameter Name="q4.7" Size="16" Integral="4" Fractional="7"/> - <FixedPointParameter Name="q4.8" Size="16" Integral="4" Fractional="8"/> - <FixedPointParameter Name="q4.9" Size="16" Integral="4" Fractional="9"/> - <FixedPointParameter Name="q4.10" Size="16" Integral="4" Fractional="10"/> - <FixedPointParameter Name="q4.11" Size="16" Integral="4" Fractional="11"/> - <FixedPointParameter Name="q5.0" Size="16" Integral="5" Fractional="0"/> - <FixedPointParameter Name="q5.1" Size="16" Integral="5" Fractional="1"/> - <FixedPointParameter Name="q5.2" Size="16" Integral="5" Fractional="2"/> - <FixedPointParameter Name="q5.3" Size="16" Integral="5" Fractional="3"/> - <FixedPointParameter Name="q5.4" Size="16" Integral="5" Fractional="4"/> - <FixedPointParameter Name="q5.5" Size="16" Integral="5" Fractional="5"/> - <FixedPointParameter Name="q5.6" Size="16" Integral="5" Fractional="6"/> - <FixedPointParameter Name="q5.7" Size="16" Integral="5" Fractional="7"/> - <FixedPointParameter Name="q5.8" Size="16" Integral="5" Fractional="8"/> - <FixedPointParameter Name="q5.9" Size="16" Integral="5" Fractional="9"/> - <FixedPointParameter Name="q5.10" Size="16" Integral="5" Fractional="10"/> - <FixedPointParameter Name="q6.0" Size="16" Integral="6" Fractional="0"/> - <FixedPointParameter Name="q6.1" Size="16" Integral="6" Fractional="1"/> - <FixedPointParameter Name="q6.2" Size="16" Integral="6" Fractional="2"/> - <FixedPointParameter Name="q6.3" Size="16" Integral="6" Fractional="3"/> - <FixedPointParameter Name="q6.4" Size="16" Integral="6" Fractional="4"/> - <FixedPointParameter Name="q6.5" Size="16" Integral="6" Fractional="5"/> - <FixedPointParameter Name="q6.6" Size="16" Integral="6" Fractional="6"/> - <FixedPointParameter Name="q6.7" Size="16" Integral="6" Fractional="7"/> - <FixedPointParameter Name="q6.8" Size="16" Integral="6" Fractional="8"/> - <FixedPointParameter Name="q6.9" Size="16" Integral="6" Fractional="9"/> - <FixedPointParameter Name="q7.0" Size="16" Integral="7" Fractional="0"/> - <FixedPointParameter Name="q7.1" Size="16" Integral="7" Fractional="1"/> - <FixedPointParameter Name="q7.2" Size="16" Integral="7" Fractional="2"/> - <FixedPointParameter Name="q7.3" Size="16" Integral="7" Fractional="3"/> - <FixedPointParameter Name="q7.4" Size="16" Integral="7" Fractional="4"/> - <FixedPointParameter Name="q7.5" Size="16" Integral="7" Fractional="5"/> - <FixedPointParameter Name="q7.6" Size="16" Integral="7" Fractional="6"/> - <FixedPointParameter Name="q7.7" Size="16" Integral="7" Fractional="7"/> - <FixedPointParameter Name="q7.8" Size="16" Integral="7" Fractional="8"/> - <FixedPointParameter Name="q8.0" Size="16" Integral="8" Fractional="0"/> - <FixedPointParameter Name="q8.1" Size="16" Integral="8" Fractional="1"/> - <FixedPointParameter Name="q8.2" Size="16" Integral="8" Fractional="2"/> - <FixedPointParameter Name="q8.3" Size="16" Integral="8" Fractional="3"/> - <FixedPointParameter Name="q8.4" Size="16" Integral="8" Fractional="4"/> - <FixedPointParameter Name="q8.5" Size="16" Integral="8" Fractional="5"/> - <FixedPointParameter Name="q8.6" Size="16" Integral="8" Fractional="6"/> - <FixedPointParameter Name="q8.7" Size="16" Integral="8" Fractional="7"/> - <FixedPointParameter Name="q9.0" Size="16" Integral="9" Fractional="0"/> - <FixedPointParameter Name="q9.1" Size="16" Integral="9" Fractional="1"/> - <FixedPointParameter Name="q9.2" Size="16" Integral="9" Fractional="2"/> - <FixedPointParameter Name="q9.3" Size="16" Integral="9" Fractional="3"/> - <FixedPointParameter Name="q9.4" Size="16" Integral="9" Fractional="4"/> - <FixedPointParameter Name="q9.5" Size="16" Integral="9" Fractional="5"/> - <FixedPointParameter Name="q9.6" Size="16" Integral="9" Fractional="6"/> - <FixedPointParameter Name="q10.0" Size="16" Integral="10" Fractional="0"/> - <FixedPointParameter Name="q10.1" Size="16" Integral="10" Fractional="1"/> - <FixedPointParameter Name="q10.2" Size="16" Integral="10" Fractional="2"/> - <FixedPointParameter Name="q10.3" Size="16" Integral="10" Fractional="3"/> - <FixedPointParameter Name="q10.4" Size="16" Integral="10" Fractional="4"/> - <FixedPointParameter Name="q10.5" Size="16" Integral="10" Fractional="5"/> - <FixedPointParameter Name="q11.0" Size="16" Integral="11" Fractional="0"/> - <FixedPointParameter Name="q11.1" Size="16" Integral="11" Fractional="1"/> - <FixedPointParameter Name="q11.2" Size="16" Integral="11" Fractional="2"/> - <FixedPointParameter Name="q11.3" Size="16" Integral="11" Fractional="3"/> - <FixedPointParameter Name="q11.4" Size="16" Integral="11" Fractional="4"/> - <FixedPointParameter Name="q12.0" Size="16" Integral="12" Fractional="0"/> - <FixedPointParameter Name="q12.1" Size="16" Integral="12" Fractional="1"/> - <FixedPointParameter Name="q12.2" Size="16" Integral="12" Fractional="2"/> - <FixedPointParameter Name="q12.3" Size="16" Integral="12" Fractional="3"/> - <FixedPointParameter Name="q13.0" Size="16" Integral="13" Fractional="0"/> - <FixedPointParameter Name="q13.1" Size="16" Integral="13" Fractional="1"/> - <FixedPointParameter Name="q13.2" Size="16" Integral="13" Fractional="2"/> - <FixedPointParameter Name="q14.0" Size="16" Integral="14" Fractional="0"/> - <FixedPointParameter Name="q14.1" Size="16" Integral="14" Fractional="1"/> - <FixedPointParameter Name="q15.0" Size="16" Integral="15" Fractional="0"/> - </ParameterBlock> - - <!-- 8b --> - <ParameterBlock Name="8"> - <FixedPointParameter Name="q0.0" Size="8" Integral="0" Fractional="0"/> - <FixedPointParameter Name="q0.1" Size="8" Integral="0" Fractional="1"/> - <FixedPointParameter Name="q0.2" Size="8" Integral="0" Fractional="2"/> - <FixedPointParameter Name="q0.3" Size="8" Integral="0" Fractional="3"/> - <FixedPointParameter Name="q0.4" Size="8" Integral="0" Fractional="4"/> - <FixedPointParameter Name="q0.5" Size="8" Integral="0" Fractional="5"/> - <FixedPointParameter Name="q0.6" Size="8" Integral="0" Fractional="6"/> - <FixedPointParameter Name="q0.7" Size="8" Integral="0" Fractional="7"/> - <FixedPointParameter Name="q1.0" Size="8" Integral="1" Fractional="0"/> - <FixedPointParameter Name="q1.1" Size="8" Integral="1" Fractional="1"/> - <FixedPointParameter Name="q1.2" Size="8" Integral="1" Fractional="2"/> - <FixedPointParameter Name="q1.3" Size="8" Integral="1" Fractional="3"/> - <FixedPointParameter Name="q1.4" Size="8" Integral="1" Fractional="4"/> - <FixedPointParameter Name="q1.5" Size="8" Integral="1" Fractional="5"/> - <FixedPointParameter Name="q1.6" Size="8" Integral="1" Fractional="6"/> - <FixedPointParameter Name="q2.0" Size="8" Integral="2" Fractional="0"/> - <FixedPointParameter Name="q2.1" Size="8" Integral="2" Fractional="1"/> - <FixedPointParameter Name="q2.2" Size="8" Integral="2" Fractional="2"/> - <FixedPointParameter Name="q2.3" Size="8" Integral="2" Fractional="3"/> - <FixedPointParameter Name="q2.4" Size="8" Integral="2" Fractional="4"/> - <FixedPointParameter Name="q2.5" Size="8" Integral="2" Fractional="5"/> - <FixedPointParameter Name="q3.0" Size="8" Integral="3" Fractional="0"/> - <FixedPointParameter Name="q3.1" Size="8" Integral="3" Fractional="1"/> - <FixedPointParameter Name="q3.2" Size="8" Integral="3" Fractional="2"/> - <FixedPointParameter Name="q3.3" Size="8" Integral="3" Fractional="3"/> - <FixedPointParameter Name="q3.4" Size="8" Integral="3" Fractional="4"/> - <FixedPointParameter Name="q4.0" Size="8" Integral="4" Fractional="0"/> - <FixedPointParameter Name="q4.1" Size="8" Integral="4" Fractional="1"/> - <FixedPointParameter Name="q4.2" Size="8" Integral="4" Fractional="2"/> - <FixedPointParameter Name="q4.3" Size="8" Integral="4" Fractional="3"/> - <FixedPointParameter Name="q5.0" Size="8" Integral="5" Fractional="0"/> - <FixedPointParameter Name="q5.1" Size="8" Integral="5" Fractional="1"/> - <FixedPointParameter Name="q5.2" Size="8" Integral="5" Fractional="2"/> - <FixedPointParameter Name="q6.0" Size="8" Integral="6" Fractional="0"/> - <FixedPointParameter Name="q6.1" Size="8" Integral="6" Fractional="1"/> - <FixedPointParameter Name="q7.0" Size="8" Integral="7" Fractional="0"/> - </ParameterBlock> - - - </InstanceDefinition> -</Subsystem> diff --git a/test/test-platform/CMakeLists.txt b/test/test-platform/CMakeLists.txt deleted file mode 100644 index 533de3c..0000000 --- a/test/test-platform/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (c) 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. - -if(NETWORKING) - add_executable(test-platform - main.cpp - TestPlatform.cpp) - - target_link_libraries(test-platform - PRIVATE parameter pfw_utility remote-processor) - # Workaround because asio is still leaking to test-platform - target_link_libraries(test-platform PRIVATE asio) - - install(TARGETS test-platform RUNTIME DESTINATION bin) -endif() diff --git a/test/test-platform/README.md b/test/test-platform/README.md deleted file mode 100644 index 4e3cab8..0000000 --- a/test/test-platform/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# test-platform - -Test-platform is a little executable that can instantiate a parameter-framework -with custom criteria and full control over criteria states. It also serves -as an example of a parameter-framework client. - -It offers the possibility to : - -- Give the parameter-framework configuration xml -- Create criteria from a name, a type (exclusive or inclusive), states (the - state number or a state name list) -- Start a parameter-framework instance -- Change criteria states and apply configurations - -## Usage - -Start it with: - - test-platform [-d] </path/to/ParameterFrameworkConfiguration.xml> [port, defaults to 5001] - -(The optional `-d` option daemonizes test-platform). - -Then, you may send commands to the test-platform using remote-process; e.g: - - remote-process localhost 5001 help - remote-process localhost 5001 start - -## Known issues - -- The path to the configuration file must contain at least a `/`. Thus, if you -want to refer to a file in the current directory, you should write: - - test-platform ./ParameterFrameworkConfiguration.xml diff --git a/test/test-platform/TestPlatform.cpp b/test/test-platform/TestPlatform.cpp deleted file mode 100644 index e022131..0000000 --- a/test/test-platform/TestPlatform.cpp +++ /dev/null @@ -1,444 +0,0 @@ -/* - * 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 <stdlib.h> -#include <sstream> -#include <assert.h> -#include <errno.h> -#include <convert.hpp> -#include <sstream> -#include "TestPlatform.h" - -using std::string; - -CTestPlatform::CTestPlatform(const string &strClass, uint16_t iPortNumber) - : mParameterMgrPlatformConnector(strClass), mLogger(), mRemoteProcessorServer(iPortNumber) -{ - mParameterMgrPlatformConnector.setLogger(&mLogger); -} - -CTestPlatform::~CTestPlatform() -{ -} - -CTestPlatform::CommandReturn CTestPlatform::exit(const IRemoteCommand & /*command*/, - string & /*strResult*/) -{ - mRemoteProcessorServer.stop(); - - return CTestPlatform::CCommandHandler::EDone; -} - -bool CTestPlatform::run(std::string &strError) -{ - // Start remote processor server - if (!mRemoteProcessorServer.start(strError)) { - - strError = "TestPlatform: Unable to start remote processor server: " + strError; - return false; - } - - CCommandHandler commandHandler(this); - - // Add command parsers - commandHandler.addCommandParser("exit", &CTestPlatform::exit, 0, "", "Exit TestPlatform"); - commandHandler.addCommandParser("createExclusiveSelectionCriterionFromStateList", - &CTestPlatform::createExclusiveSelectionCriterionFromStateList, - 2, "<name> <stateList>", - "Create inclusive selection criterion from state name list"); - commandHandler.addCommandParser("createInclusiveSelectionCriterionFromStateList", - &CTestPlatform::createInclusiveSelectionCriterionFromStateList, - 2, "<name> <stateList>", - "Create exclusive selection criterion from state name list"); - - commandHandler.addCommandParser("createExclusiveSelectionCriterion", - &CTestPlatform::createExclusiveSelectionCriterion, 2, - "<name> <nbStates>", "Create inclusive selection criterion"); - commandHandler.addCommandParser("createInclusiveSelectionCriterion", - &CTestPlatform::createInclusiveSelectionCriterion, 2, - "<name> <nbStates>", "Create exclusive selection criterion"); - - commandHandler.addCommandParser("start", &CTestPlatform::startParameterMgr, 0, "", - "Start ParameterMgr"); - - commandHandler.addCommandParser("setCriterionState", &CTestPlatform::setCriterionState, 2, - "<name> <state>", - "Set the current state of a selection criterion"); - commandHandler.addCommandParser( - "applyConfigurations", &CTestPlatform::applyConfigurations, 0, "", - "Apply configurations selected by current selection criteria states"); - - commandHandler.addCommandParser( - "setFailureOnMissingSubsystem", - &CTestPlatform::setter<&CParameterMgrPlatformConnector::setFailureOnMissingSubsystem>, 1, - "true|false", "Set policy for missing subsystems, " - "either abort start or fallback on virtual subsystem."); - commandHandler.addCommandParser( - "getMissingSubsystemPolicy", - &CTestPlatform::getter<&CParameterMgrPlatformConnector::getFailureOnMissingSubsystem>, 0, - "", "Get policy for missing subsystems, " - "either abort start or fallback on virtual subsystem."); - - commandHandler.addCommandParser( - "setFailureOnFailedSettingsLoad", - &CTestPlatform::setter<&CParameterMgrPlatformConnector::setFailureOnFailedSettingsLoad>, 1, - "true|false", - "Set policy for failed settings load, either abort start or continue without domains."); - commandHandler.addCommandParser( - "getFailedSettingsLoadPolicy", - &CTestPlatform::getter<&CParameterMgrPlatformConnector::getFailureOnFailedSettingsLoad>, 0, - "", "Get policy for failed settings load, either abort start or continue without domains."); - - commandHandler.addCommandParser( - "setValidateSchemasOnStart", - &CTestPlatform::setter<&CParameterMgrPlatformConnector::setValidateSchemasOnStart>, 1, - "true|false", "Set policy for schema validation based on .xsd files (false by default)."); - commandHandler.addCommandParser( - "getValidateSchemasOnStart", - &CTestPlatform::getter<&CParameterMgrPlatformConnector::getValidateSchemasOnStart>, 0, "", - "Get policy for schema validation based on .xsd files."); - - commandHandler.addCommandParser("getSchemaUri", &CTestPlatform::getSchemaUri, 0, "", - "Get the directory where schemas can be found."); - commandHandler.addCommandParser("setSchemaUri", &CTestPlatform::setSchemaUri, 1, "<directory>", - "Set the directory where schemas can be found."); - - return mRemoteProcessorServer.process(commandHandler); -} - -//////////////// Remote command parsers -/// Selection Criterion -CTestPlatform::CommandReturn CTestPlatform::createExclusiveSelectionCriterionFromStateList( - const IRemoteCommand &remoteCommand, string &strResult) -{ - return createExclusiveSelectionCriterionFromStateList(remoteCommand.getArgument(0), - remoteCommand, strResult) - ? CTestPlatform::CCommandHandler::EDone - : CTestPlatform::CCommandHandler::EFailed; -} - -CTestPlatform::CommandReturn CTestPlatform::createInclusiveSelectionCriterionFromStateList( - const IRemoteCommand &remoteCommand, string &strResult) -{ - return createInclusiveSelectionCriterionFromStateList(remoteCommand.getArgument(0), - remoteCommand, strResult) - ? CTestPlatform::CCommandHandler::EDone - : CTestPlatform::CCommandHandler::EFailed; -} - -CTestPlatform::CommandReturn CTestPlatform::createExclusiveSelectionCriterion( - const IRemoteCommand &remoteCommand, string &strResult) -{ - return createExclusiveSelectionCriterion(remoteCommand.getArgument(0), - strtoul(remoteCommand.getArgument(1).c_str(), NULL, 0), - strResult) - ? CTestPlatform::CCommandHandler::EDone - : CTestPlatform::CCommandHandler::EFailed; -} - -CTestPlatform::CommandReturn CTestPlatform::createInclusiveSelectionCriterion( - const IRemoteCommand &remoteCommand, string &strResult) -{ - return createInclusiveSelectionCriterion(remoteCommand.getArgument(0), - strtoul(remoteCommand.getArgument(1).c_str(), NULL, 0), - strResult) - ? CTestPlatform::CCommandHandler::EDone - : CTestPlatform::CCommandHandler::EFailed; -} - -CTestPlatform::CommandReturn CTestPlatform::startParameterMgr( - const IRemoteCommand & /*remoteCommand*/, string &strResult) -{ - return mParameterMgrPlatformConnector.start(strResult) - ? CTestPlatform::CCommandHandler::EDone - : CTestPlatform::CCommandHandler::EFailed; -} - -template <CTestPlatform::setter_t setFunction> -CTestPlatform::CommandReturn CTestPlatform::setter(const IRemoteCommand &remoteCommand, - string &strResult) -{ - const string &strAbort = remoteCommand.getArgument(0); - - bool bFail; - - if (!convertTo(strAbort, bFail)) { - return CTestPlatform::CCommandHandler::EShowUsage; - } - - return (mParameterMgrPlatformConnector.*setFunction)(bFail, strResult) - ? CTestPlatform::CCommandHandler::EDone - : CTestPlatform::CCommandHandler::EFailed; -} - -template <CTestPlatform::getter_t getFunction> -CTestPlatform::CommandReturn CTestPlatform::getter(const IRemoteCommand & /*command*/, - string &strResult) -{ - strResult = (mParameterMgrPlatformConnector.*getFunction)() ? "true" : "false"; - - return CTestPlatform::CCommandHandler::ESucceeded; -} - -CTestPlatform::CommandReturn CTestPlatform::getSchemaUri(const IRemoteCommand & /*remotecommand*/, - string &result) -{ - result = mParameterMgrPlatformConnector.getSchemaUri(); - return CTestPlatform::CCommandHandler::EDone; -} - -CTestPlatform::CommandReturn CTestPlatform::setSchemaUri(const IRemoteCommand &remotecommand, - string & /*result*/) -{ - mParameterMgrPlatformConnector.setSchemaUri(remotecommand.getArgument(0)); - return CTestPlatform::CCommandHandler::EDone; -} - -CTestPlatform::CommandReturn CTestPlatform::setCriterionState(const IRemoteCommand &remoteCommand, - string &strResult) -{ - - bool bSuccess; - - uint32_t state; - - if (convertTo(remoteCommand.getArgument(1), state)) { - // Sucessfull conversion, set criterion state by numerical state - bSuccess = setCriterionState(remoteCommand.getArgument(0), state, strResult); - - } else { - // Conversion failed, set criterion state by lexical state - bSuccess = setCriterionStateByLexicalSpace(remoteCommand, strResult); - } - - return bSuccess ? CTestPlatform::CCommandHandler::EDone - : CTestPlatform::CCommandHandler::EFailed; -} - -CTestPlatform::CommandReturn CTestPlatform::applyConfigurations(const IRemoteCommand & /*command*/, - string & /*strResult*/) -{ - mParameterMgrPlatformConnector.applyConfigurations(); - - return CTestPlatform::CCommandHandler::EDone; -} - -//////////////// Remote command handlers - -bool CTestPlatform::createExclusiveSelectionCriterionFromStateList( - const string &strName, const IRemoteCommand &remoteCommand, string &strResult) -{ - ISelectionCriterionTypeInterface *pCriterionType = - mParameterMgrPlatformConnector.createSelectionCriterionType(false); - - assert(pCriterionType != NULL); - - size_t nbStates = remoteCommand.getArgumentCount() - 1; - - for (size_t state = 0; state < nbStates; state++) { - - const std::string &strValue = remoteCommand.getArgument(state + 1); - - // FIXME state type vs addValuePair params - if (!pCriterionType->addValuePair(int(state), strValue, strResult)) { - - strResult = "Unable to add value: " + strValue + ": " + strResult; - - return false; - } - } - - mParameterMgrPlatformConnector.createSelectionCriterion(strName, pCriterionType); - - return true; -} - -bool CTestPlatform::createInclusiveSelectionCriterionFromStateList( - const string &strName, const IRemoteCommand &remoteCommand, string &strResult) -{ - ISelectionCriterionTypeInterface *pCriterionType = - mParameterMgrPlatformConnector.createSelectionCriterionType(true); - - assert(pCriterionType != NULL); - - size_t nbStates = remoteCommand.getArgumentCount() - 1; - - for (size_t state = 0; state < nbStates; state++) { - - const std::string &strValue = remoteCommand.getArgument(state + 1); - - if (!pCriterionType->addValuePair(0x1 << state, strValue, strResult)) { - - strResult = "Unable to add value: " + strValue + ": " + strResult; - - return false; - } - } - - mParameterMgrPlatformConnector.createSelectionCriterion(strName, pCriterionType); - - return true; -} - -bool CTestPlatform::createExclusiveSelectionCriterion(const string &strName, size_t nbStates, - string &strResult) -{ - ISelectionCriterionTypeInterface *pCriterionType = - mParameterMgrPlatformConnector.createSelectionCriterionType(false); - - for (size_t state = 0; state < nbStates; state++) { - - std::ostringstream ostrValue; - - ostrValue << "State_"; - ostrValue << state; - - // FIXME state type vs addValuePair params - if (!pCriterionType->addValuePair(int(state), ostrValue.str(), strResult)) { - - strResult = "Unable to add value: " + ostrValue.str() + ": " + strResult; - - return false; - } - } - - mParameterMgrPlatformConnector.createSelectionCriterion(strName, pCriterionType); - - return true; -} - -bool CTestPlatform::createInclusiveSelectionCriterion(const string &strName, size_t nbStates, - string &strResult) -{ - ISelectionCriterionTypeInterface *pCriterionType = - mParameterMgrPlatformConnector.createSelectionCriterionType(true); - - for (size_t state = 0; state < nbStates; state++) { - - std::ostringstream ostrValue; - - ostrValue << "State_0x"; - ostrValue << (0x1 << state); - - if (!pCriterionType->addValuePair(0x1 << state, ostrValue.str(), strResult)) { - - strResult = "Unable to add value: " + ostrValue.str() + ": " + strResult; - - return false; - } - } - - mParameterMgrPlatformConnector.createSelectionCriterion(strName, pCriterionType); - - return true; -} - -bool CTestPlatform::setCriterionState(const string &strName, uint32_t uiState, string &strResult) -{ - ISelectionCriterionInterface *pCriterion = - mParameterMgrPlatformConnector.getSelectionCriterion(strName); - - if (!pCriterion) { - - strResult = "Unable to retrieve selection criterion: " + strName; - - return false; - } - - pCriterion->setCriterionState(uiState); - - return true; -} - -bool CTestPlatform::setCriterionStateByLexicalSpace(const IRemoteCommand &remoteCommand, - string &strResult) -{ - - // Get criterion name - std::string strCriterionName = remoteCommand.getArgument(0); - - ISelectionCriterionInterface *pCriterion = - mParameterMgrPlatformConnector.getSelectionCriterion(strCriterionName); - - if (!pCriterion) { - - strResult = "Unable to retrieve selection criterion: " + strCriterionName; - - return false; - } - - // Get criterion type - const ISelectionCriterionTypeInterface *pCriterionType = pCriterion->getCriterionType(); - - // Get substate number, the first argument (index 0) is the criterion name - size_t nbSubStates = remoteCommand.getArgumentCount() - 1; - - // Check that exclusive criterion has only one substate - if (!pCriterionType->isTypeInclusive() && nbSubStates != 1) { - - strResult = "Exclusive criterion " + strCriterionName + " can only have one state"; - - return false; - } - - /// Translate lexical state to numerical state - int iNumericalState = 0; - size_t lexicalSubStateIndex; - - // Parse lexical substates - std::string strLexicalState = ""; - - for (lexicalSubStateIndex = 1; lexicalSubStateIndex <= nbSubStates; lexicalSubStateIndex++) { - /* - * getNumericalValue method from ISelectionCriterionTypeInterface strip his parameter - * first parameter based on | sign. In case that the user uses multiple parameters - * to set InclusiveCriterion value, we aggregate all desired values to be sure - * they will be handled correctly. - */ - if (lexicalSubStateIndex != 1) { - strLexicalState += "|"; - } - strLexicalState += remoteCommand.getArgument(lexicalSubStateIndex); - } - - // Translate lexical to numerical substate - if (!pCriterionType->getNumericalValue(strLexicalState, iNumericalState)) { - - strResult = "Unable to find lexical state \"" + strLexicalState + "\" in criteria " + - strCriterionName; - - return false; - } - - // Set criterion new state - pCriterion->setCriterionState(iNumericalState); - - return true; -} diff --git a/test/test-platform/TestPlatform.h b/test/test-platform/TestPlatform.h deleted file mode 100644 index f9c27f7..0000000 --- a/test/test-platform/TestPlatform.h +++ /dev/null @@ -1,164 +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 "ParameterMgrPlatformConnector.h" -#include "RemoteCommandHandlerTemplate.h" -#include "RemoteProcessorServer.h" -#include <string> -#include <iostream> -#include <list> - -class CParameterMgrPlatformConnectorLogger; -class ISelectionCriterionInterface; - -class CTestPlatform -{ - typedef TRemoteCommandHandlerTemplate<CTestPlatform> CCommandHandler; - typedef CCommandHandler::CommandStatus CommandReturn; - -public: - CTestPlatform(const std::string &strclass, uint16_t iPortNumber); - virtual ~CTestPlatform(); - - // Init - bool run(std::string &strError); - -private: - //////////////// Remote command parsers - /// Selection Criterion - CommandReturn createExclusiveSelectionCriterionFromStateList( - const IRemoteCommand &remoteCommand, std::string &strResult); - CommandReturn createInclusiveSelectionCriterionFromStateList( - const IRemoteCommand &remoteCommand, std::string &strResult); - - CommandReturn createExclusiveSelectionCriterion(const IRemoteCommand &remoteCommand, - std::string &strResult); - CommandReturn createInclusiveSelectionCriterion(const IRemoteCommand &remoteCommand, - std::string &strResult); - - CommandReturn getSchemaUri(const IRemoteCommand &remotecommand, std::string &result); - CommandReturn setSchemaUri(const IRemoteCommand &remotecommand, std::string &result); - - /** Callback to set a criterion's value, see ISelectionCriterionInterface::setCriterionState. - * @see CCommandHandler::RemoteCommandParser for detail on each arguments and return - * - * @param[in] remoteCommand the first argument should be the name of the criterion to set. - * if the criterion is provided in lexical space, - * the following arguments should be criterion new values - * if the criterion is provided in numerical space, - * the second argument should be the criterion new value - */ - CommandReturn setCriterionState(const IRemoteCommand &remoteCommand, std::string &strResult); - - /** Callback to start the PFW, see CParameterMgrPlatformConnector::start. - * @see CCommandHandler::RemoteCommandParser for detail on each arguments and return - * - * @param[in] remoteCommand is ignored - */ - CommandReturn startParameterMgr(const IRemoteCommand &remoteCommand, std::string &strResult); - - /** Callback to apply PFW configuration, see CParameterMgrPlatformConnector::applyConfiguration. - * @see CCommandHandler::RemoteCommandParser for detail on each arguments and return - * - * @param[in] remoteCommand is ignored - * - * @return EDone (never fails) - */ - CommandReturn applyConfigurations(const IRemoteCommand &remoteCommand, std::string &strResult); - - /** Callback to exit the test-platform. - * - * @param[in] remoteCommand is ignored - * - * @return EDone (never fails) - */ - CommandReturn exit(const IRemoteCommand &remoteCommand, std::string &strResult); - - /** The type of a CParameterMgrPlatformConnector boolean setter. */ - typedef bool (CParameterMgrPlatformConnector::*setter_t)(bool, std::string &); - /** Template callback to create a _pParameterMgrPlatformConnector boolean setter callback. - * @see CCommandHandler::RemoteCommandParser for detail on each arguments and return - * - * Convert the remoteCommand first argument to a boolean and call the - * template parameter function with this value. - * - * @tparam the boolean setter method. - * @param[in] remoteCommand the first argument should be ether "on" or "off". - */ - template <setter_t setFunction> - CommandReturn setter(const IRemoteCommand &remoteCommand, std::string &strResult); - - /** The type of a CParameterMgrPlatformConnector boolean getter. */ - typedef bool (CParameterMgrPlatformConnector::*getter_t)() const; - /** Template callback to create a ParameterMgrPlatformConnector boolean getter callback. - * @see CCommandHandler::RemoteCommandParser for detail on each arguments and return - * - * Convert to boolean returned by the template parameter function converted to a - * std::string ("True", "False") and return it. - * - * @param the boolean getter method. - * @param[in] remoteCommand is ignored - * - * @return EDone (never fails) - */ - template <getter_t getFunction> - CommandReturn getter(const IRemoteCommand &remoteCommand, std::string &strResult); - - // Commands - bool createExclusiveSelectionCriterionFromStateList(const std::string &strName, - const IRemoteCommand &remoteCommand, - std::string &strResult); - bool createInclusiveSelectionCriterionFromStateList(const std::string &strName, - const IRemoteCommand &remoteCommand, - std::string &strResult); - - bool createExclusiveSelectionCriterion(const std::string &strName, size_t nbValues, - std::string &strResult); - bool createInclusiveSelectionCriterion(const std::string &strName, size_t nbValues, - std::string &strResult); - bool setCriterionState(const std::string &strName, uint32_t uiState, std::string &strResult); - bool setCriterionStateByLexicalSpace(const IRemoteCommand &remoteCommand, - std::string &strResult); - - // Connector - CParameterMgrPlatformConnector mParameterMgrPlatformConnector; - - class : public CParameterMgrPlatformConnector::ILogger - { - public: - virtual void info(const std::string &log) { std::cout << log << std::endl; } - - virtual void warning(const std::string &log) { std::cerr << log << std::endl; } - } mLogger; - - // Remote Processor Server - CRemoteProcessorServer mRemoteProcessorServer; -}; diff --git a/test/test-platform/main.cpp b/test/test-platform/main.cpp deleted file mode 100644 index 6cb5267..0000000 --- a/test/test-platform/main.cpp +++ /dev/null @@ -1,114 +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 "TestPlatform.h" -#include "convert.hpp" -#include "Utility.h" - -#include <iostream> -#include <string> -#include <vector> -#include <algorithm> - -using std::cerr; -using std::endl; -using std::string; - -static const uint16_t defaultPortNumber = 5001; - -static void showUsage() -{ - cerr << "test-platform [-h|--help] <file path> [port number, default " << defaultPortNumber - << "]" << endl; -} - -static void showInvalidUsage(const string &error) -{ - cerr << "Invalid arguments: " << error; - showUsage(); -} - -static void showHelp() -{ - showUsage(); - cerr << "<file path> must be a valid Paramter top level config file, " - << "often named ParameterFrameworkConfiguration.xml.\n" - << "Arguments:" << endl - << " -h|--help display this help and exit" << endl; -} - -int main(int argc, char *argv[]) -{ - using Options = std::list<string>; - // argv[0] is the program name, not an option - Options options(argv + 1, argv + argc); - - // Handle help option - auto helpOpts = {"-h", "--help"}; - auto match = std::find_first_of(begin(options), end(options), begin(helpOpts), end(helpOpts)); - if (match != end(options)) { - showHelp(); - return 0; - } - - if (options.empty()) { - showInvalidUsage("Expected a path to a Parameter Framework config file."); - return 1; - } - - auto filePath = options.front(); - options.pop_front(); - - // Handle optional port number argument - uint16_t portNumber = defaultPortNumber; - - if (not options.empty()) { - if (not convertTo(options.front(), portNumber)) { - showInvalidUsage("Could not convert \"" + options.front() + - "\" to a socket port number."); - return 2; - }; - options.pop_front(); - } - - // All arguments should have been consumed - if (not options.empty()) { - showInvalidUsage("Unexpected extra arguments: " + utility::asString(options)); - return 3; - } - - string strError; - if (!CTestPlatform(filePath, portNumber).run(strError)) { - - cerr << "Test-platform error:" << strError.c_str() << endl; - return -1; - } - return 0; -} diff --git a/test/test-subsystem/CMakeLists.txt b/test/test-subsystem/CMakeLists.txt deleted file mode 100644 index eeaa7de..0000000 --- a/test/test-subsystem/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -# 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) - - target_link_libraries(test-subsystem PRIVATE parameter) -endif() diff --git a/test/test-subsystem/TESTMappingKeys.h b/test/test-subsystem/TESTMappingKeys.h deleted file mode 100644 index 0134891..0000000 --- a/test/test-subsystem/TESTMappingKeys.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 - -// Mapping item types -enum TESTItemType -{ - ETESTDirectory, - ETESTLog -}; diff --git a/test/test-subsystem/TESTSubsystem.cpp b/test/test-subsystem/TESTSubsystem.cpp deleted file mode 100644 index 473d923..0000000 --- a/test/test-subsystem/TESTSubsystem.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* -* 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, core::log::Logger &logger) - : base(strName, logger) -{ - // 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 deleted file mode 100644 index 0546e94..0000000 --- a/test/test-subsystem/TESTSubsystem.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -* 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, core::log::Logger &logger); - - // 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 deleted file mode 100644 index 49a775b..0000000 --- a/test/test-subsystem/TESTSubsystemBinary.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* -* 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 <convert.hpp> -#include <string.h> -#include <string> -#include <sstream> -#include <stdlib.h> -#include <assert.h> -#include <algorithm> -#include <AlwaysAssert.hpp> -#include <Iterator.hpp> -#include "TESTSubsystemBinary.h" - -#define base CTESTSubsystemObject - -CTESTSubsystemBinary::CTESTSubsystemBinary( - const std::string &strMappingValue, CInstanceConfigurableElement *pInstanceConfigurableElement, - const CMappingContext &context, core::log::Logger &logger) - : base(strMappingValue, pInstanceConfigurableElement, context, logger) -{ -} - -std::string CTESTSubsystemBinary::toString(const void *pvValue, size_t size) const -{ - std::ostringstream strStream; - uint32_t uiValue = 0; - - assert(size <= sizeof(uiValue)); - - auto first = MAKE_ARRAY_ITERATOR(static_cast<const uint8_t *>(pvValue), size); - auto destination = MAKE_ARRAY_ITERATOR(reinterpret_cast<uint8_t *>(&uiValue), sizeof(uiValue)); - - std::copy_n(first, size, destination); - - strStream << "0x" << std::hex << uiValue; - - return strStream.str(); -} - -void CTESTSubsystemBinary::fromString(const std::string &strValue, void *pvValue, size_t size) -{ - uint32_t uiValue; - - assert(size <= sizeof(uiValue)); - - if (!convertTo(strValue, uiValue)) { - throw std::runtime_error("Unable to convert \"" + strValue + "\" to uint32"); - } - - auto first = MAKE_ARRAY_ITERATOR(reinterpret_cast<const uint8_t *>(&uiValue), size); - auto destination = MAKE_ARRAY_ITERATOR(static_cast<uint8_t *>(pvValue), size); - std::copy_n(first, size, destination); -} diff --git a/test/test-subsystem/TESTSubsystemBinary.h b/test/test-subsystem/TESTSubsystemBinary.h deleted file mode 100644 index b84c02d..0000000 --- a/test/test-subsystem/TESTSubsystemBinary.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -* 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 *configurableElement, - const CMappingContext &context, core::log::Logger &logger); - -private: - // from CTESTSubsystemObject - // Format Data - virtual std::string toString(const void *pvValue, size_t size) const; - virtual void fromString(const std::string &strValue, void *pvValue, size_t size); -}; diff --git a/test/test-subsystem/TESTSubsystemBuilder.cpp b/test/test-subsystem/TESTSubsystemBuilder.cpp deleted file mode 100644 index 6ec062e..0000000 --- a/test/test-subsystem/TESTSubsystemBuilder.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* -* 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 "Plugin.h" -#include "LoggingElementBuilderTemplate.h" -#include "TESTSubsystem.h" - -void PARAMETER_FRAMEWORK_PLUGIN_ENTRYPOINT_V1(CSubsystemLibrary *pSubsystemLibrary, - core::log::Logger &logger) -{ - pSubsystemLibrary->addElementBuilder( - "TEST", new TLoggingElementBuilderTemplate<CTESTSubsystem>(logger)); -} diff --git a/test/test-subsystem/TESTSubsystemObject.cpp b/test/test-subsystem/TESTSubsystemObject.cpp deleted file mode 100644 index a25b195..0000000 --- a/test/test-subsystem/TESTSubsystemObject.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/* -* 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 "ParameterType.h" -#include "MappingContext.h" -#include "TESTMappingKeys.h" -#include "InstanceConfigurableElement.h" -#include "TESTSubsystemObject.h" -#include <log/Context.h> -#include <sstream> -#include <vector> - -#define base CSubsystemObject - -CTESTSubsystemObject::CTESTSubsystemObject( - const std::string & /*strMappingValue*/, - CInstanceConfigurableElement *pInstanceConfigurableElement, const CMappingContext &context, - core::log::Logger &logger) - : base(pInstanceConfigurableElement, logger) -{ - // Get actual element type - const CParameterType *pParameterType = - static_cast<const CParameterType *>(pInstanceConfigurableElement->getTypeElement()); - - _scalarSize = pParameterType->getSize(); - _arraySize = pInstanceConfigurableElement->getFootPrint() / _scalarSize; - _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*/) -{ - 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) -{ - for (size_t index = 0; index < _arraySize; index++) { - - std::vector<uint8_t> aucValue(_scalarSize); - - void *pvValue = aucValue.data(); - - // Read Value in BlackBoard - blackboardRead(pvValue, _scalarSize); - - std::string strValue = toString(pvValue, _scalarSize); - - outputFile << strValue << std::endl; - - if (_bLog) { - - if (_bIsScalar) { - - info() << "TESTSUBSYSTEM: Writing '" << strValue << "' to file " << _strFilePath; - } else { - - info() << "TESTSUBSYSTEM: Writing '" << strValue << "' to file " << _strFilePath - << "[" << index << "]"; - } - } - } -} - -void CTESTSubsystemObject::receiveFromFile(std::ifstream &inputFile) -{ - for (size_t index = 0; index < _arraySize; index++) { - - std::vector<uint8_t> aucValue(_scalarSize); - - void *pvValue = aucValue.data(); - - std::string strValue; - - inputFile >> strValue; - - if (_bLog) { - - if (_bIsScalar) { - - info() << "TESTSUBSYSTEM: Reading '" << strValue << "' to file " << _strFilePath; - } else { - - info() << "TESTSUBSYSTEM: Reading '" << strValue << "' to file " << _strFilePath - << "[" << index << "]"; - } - } - - fromString(strValue, pvValue, _scalarSize); - - // Write Value in Blackboard - blackboardWrite(pvValue, _scalarSize); - } -} diff --git a/test/test-subsystem/TESTSubsystemObject.h b/test/test-subsystem/TESTSubsystemObject.h deleted file mode 100644 index a41bcba..0000000 --- a/test/test-subsystem/TESTSubsystemObject.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -* 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, core::log::Logger &logger); - -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, size_t size) const = 0; - virtual void fromString(const std::string &strValue, void *pvValue, size_t size) = 0; - -protected: - size_t _scalarSize; - size_t _arraySize; - std::string _strFilePath; - bool _bLog; - bool _bIsScalar; -}; diff --git a/test/test-subsystem/TESTSubsystemString.cpp b/test/test-subsystem/TESTSubsystemString.cpp deleted file mode 100644 index de2d478..0000000 --- a/test/test-subsystem/TESTSubsystemString.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* -* 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 <iterator> -#include <algorithm> -#include <stdexcept> -#include <Iterator.hpp> -#include "TESTSubsystemString.h" - -#define base CTESTSubsystemObject - -CTESTSubsystemString::CTESTSubsystemString( - const std::string &strMappingValue, CInstanceConfigurableElement *pInstanceConfigurableElement, - const CMappingContext &context, core::log::Logger &logger) - : base(strMappingValue, pInstanceConfigurableElement, context, logger) -{ -} - -std::string CTESTSubsystemString::toString(const void *pvValue, size_t /*size*/) const -{ - return (const char *)pvValue; -} - -void CTESTSubsystemString::fromString(const std::string &strValue, void *pvValue, size_t size) -{ - std::size_t requiredBufferSize = strValue.length() + 1; /* Adding one for null character */ - if (size < requiredBufferSize) { - throw std::logic_error("Buffer is to small: " + std::to_string(size) + " Minimum size: " + - std::to_string(requiredBufferSize)); - } - - auto destination = MAKE_ARRAY_ITERATOR(static_cast<char *>(pvValue), size); - auto last = std::copy(begin(strValue), end(strValue), destination); - - /* Adding null character */ - *last = 0; -} diff --git a/test/test-subsystem/TESTSubsystemString.h b/test/test-subsystem/TESTSubsystemString.h deleted file mode 100644 index 1713785..0000000 --- a/test/test-subsystem/TESTSubsystemString.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -* 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, core::log::Logger &logger); - -private: - // from CTESTSubsystemObject - // Format Data - virtual std::string toString(const void *pvValue, size_t size) const; - virtual void fromString(const std::string &strValue, void *pvValue, size_t size); -}; diff --git a/test/tmpfile/CMakeLists.txt b/test/tmpfile/CMakeLists.txt deleted file mode 100644 index 84818e7..0000000 --- a/test/tmpfile/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -# 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) - if (WIN32) - set(OS_SPECIFIC_TMPFILE windows/TmpFile.cpp) - else () - set(OS_SPECIFIC_TMPFILE posix/TmpFile.cpp) - endif () - - add_library(tmpfile STATIC ${OS_SPECIFIC_TMPFILE}) - target_include_directories(tmpfile PUBLIC .) -endif() diff --git a/test/tmpfile/TmpFile.hpp b/test/tmpfile/TmpFile.hpp deleted file mode 100644 index ebefa93..0000000 --- a/test/tmpfile/TmpFile.hpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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 <exception> -#include <fstream> -#include <string> -#include <array> - -#include <cerrno> -#include <cstring> - -namespace parameterFramework -{ -namespace utility -{ - -/** Create a temporary file with the given content. */ -class TmpFile -{ -public: - TmpFile(std::string content) : mPath(mktmp()) - { - std::ofstream file(mPath); - file.exceptions(std::ofstream::failbit | std::ofstream::badbit); - file << content; - // Close explicitly to detect errors (fstream destructor does not throw) - file.close(); - } - - TmpFile(TmpFile &&right) : mPath(std::move(right.mPath)) { right.mPath.clear(); } - - /** Forbid copy semantic as sharing the tmp file is not needed. - * @{ */ - TmpFile(const TmpFile &right) = delete; - TmpFile &operator=(const TmpFile &right) = delete; - /** @} */ - - TmpFile &operator=(TmpFile &&right) - { - remove(); - mPath = std::move(right.mPath); - right.mPath.clear(); - return *this; - } - - ~TmpFile() { remove(); } - - /** @return the path to the temporary file. - * "" if the file was moved from. - */ - const std::string &getPath() const { return mPath; } -private: - /** @return a valid unique file name. */ - std::string mktmp(); - - /** Throw an std::runtime_error with a message constructed from the context and std::errno. - * - * Call it after a c standard function failure. - */ - static void throwErrnoError(std::string context) - { - auto message = context + ": (" + std::to_string(errno) + ") " + std::strerror(errno); - throw std::runtime_error(message); - } - - void remove() - { - if (not mPath.empty()) { - if (std::remove(mPath.c_str()) != 0) { - throwErrnoError("Could not delete tmpfile"); - } - } - } - std::string mPath; -}; - -} // utility -} // parameterFramework diff --git a/test/tmpfile/posix/TmpFile.cpp b/test/tmpfile/posix/TmpFile.cpp deleted file mode 100644 index 36efbd6..0000000 --- a/test/tmpfile/posix/TmpFile.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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 "TmpFile.hpp" - -#include <stdlib.h> -#include <unistd.h> - -namespace parameterFramework -{ -namespace utility -{ - -std::string TmpFile::mktmp() -{ - using std::string; - - char path[] = "Tmp_ParameterFramework_XXXXXX"; - int fd = mkstemp(path); - if (fd == -1) { - throwErrnoError("Could not create tmp file with pattern \"" + string(path) + '"'); - } - if (close(fd) != 0) { - throwErrnoError("Could not close tmp file \"" + string(path) + '"'); - } - return path; -} - -} // utility -} // parameterFramework diff --git a/test/tmpfile/windows/TmpFile.cpp b/test/tmpfile/windows/TmpFile.cpp deleted file mode 100644 index 4a0fac3..0000000 --- a/test/tmpfile/windows/TmpFile.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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 "TmpFile.hpp" - -#include <memory> - -#include <Windows.h> - -using std::to_string; - -namespace parameterFramework -{ -namespace utility -{ - -/** Format an error code returned by GetLastError to a human readable string. */ -static std::string formatError(DWORD error) -{ - LPTSTR formatedError = nullptr; // Pointer to the output buffer - - FormatMessage( - FORMAT_MESSAGE_FROM_SYSTEM | // use system message tables to retrieve error text - FORMAT_MESSAGE_ALLOCATE_BUFFER | // allocate buffer on local heap for error text - FORMAT_MESSAGE_IGNORE_INSERTS, // no insertion parameters - NULL, // unused with FORMAT_MESSAGE_FROM_SYSTEM - error, // the error to format - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Use default language - (LPTSTR)&formatedError, // output a pointer to the formated string - 0, // minimum size for output buffer - NULL); // No arguments - - // Release memory allocated by FormatMessage() on exit - // Ignore LocalFree failure - auto localFree = [](char *ptr) { LocalFree(ptr); }; - std::unique_ptr<char, decltype(localFree)> guard{formatedError, localFree}; - - if (formatedError == nullptr) { - return "Could not format error " + to_string(error) + ": " + to_string(::GetLastError()); - } - return formatedError; -} - -std::string TmpFile::mktmp() -{ - char directory[] = "."; - char prefix[] = "pfw"; // GetTempFileName uses up to the first three characters - char path[MAX_PATH + 1]; - if (::GetTempFileName(directory, prefix, 0, path) == 0) { - auto error = ::GetLastError(); - - auto message = std::string() + "Could not create a tmp file in \"" + directory + - "\", with prefix \"" + prefix + "\": (" + to_string(error) + ") " + - formatError(error); - throw std::runtime_error(message); - } - - return path; -} - -} // utility -} // parameterFramework diff --git a/test/tokenizer/CMakeLists.txt b/test/tokenizer/CMakeLists.txt deleted file mode 100644 index 1ce68dd..0000000 --- a/test/tokenizer/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -# 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 unit test - add_executable(tokenizerTest Test.cpp) - - target_link_libraries(tokenizerTest PRIVATE pfw_utility catch) - - 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 deleted file mode 100644 index 37a72cb..0000000 --- a/test/tokenizer/Test.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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; - -using Expected = vector<string>; - -SCENARIO("Tokenizer tests") -{ - GIVEN ("A default tokenizer") { - - GIVEN ("A trivial string") { - Tokenizer tokenizer("a bcd ef"); - Expected expected{"a", "bcd", "ef"}; - - THEN ("split() api should work") { - CHECK(tokenizer.split() == expected); - } - } - - GIVEN ("An empty string") { - Tokenizer tokenizer(""); - Expected expected{}; - - THEN ("split() should be empty") { - CHECK(tokenizer.split() == expected); - } - } - - GIVEN ("Multiple separators in a row") { - Tokenizer tokenizer(" a \n\t bc "); - Expected expected{"a", "bc"}; - - THEN ("split() api should work") { - CHECK(tokenizer.split() == expected); - } - } - } - - GIVEN ("A slash-separated string and tokenizer") { - Tokenizer tokenizer("/a/bcd/ef g/h/", "/"); - Expected expected{"a", "bcd", "ef g", "h"}; - - THEN ("split() api should work") { - CHECK(tokenizer.split() == expected); - } - } - - GIVEN ("A tokenizer that doesn't merge consecutive separators") { - - GIVEN ("An empty string") { - Tokenizer tokenizer("", Tokenizer::defaultDelimiters, false); - Expected expected{}; - - THEN ("split() should be empty") { - CHECK(tokenizer.split() == expected); - } - } - - GIVEN ("A string consisting only of a delimiter") { - Tokenizer tokenizer(",", ",", false); - Expected expected{"", ""}; - - THEN ("split() should return two empty tokens") { - CHECK(tokenizer.split() == expected); - } - } - - GIVEN ("Multiple separators in a row") { - Tokenizer tokenizer(" a b \nc d ", Tokenizer::defaultDelimiters, false); - Expected expected{"", "a", "", "b", "", "c", "d", ""}; - - THEN ("split() api should work") { - CHECK(tokenizer.split() == expected); - } - } - } -} diff --git a/test/xml-generator/CMakeLists.txt b/test/xml-generator/CMakeLists.txt deleted file mode 100644 index 6aeee14..0000000 --- a/test/xml-generator/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -# 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) - - find_package(PythonInterp 2 REQUIRED) - - add_test(NAME xml-generator - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tools/xmlGenerator - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test.py) - - # Custom function defined in the top-level CMakeLists - set_test_env(xml-generator) -endif() diff --git a/test/xml-generator/PFConfig/configuration.xml b/test/xml-generator/PFConfig/configuration.xml deleted file mode 100644 index e459644..0000000 --- a/test/xml-generator/PFConfig/configuration.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ParameterFrameworkConfiguration SystemClassName="Test" ServerPort="5066" TuningAllowed="false"> - <SubsystemPlugins> - </SubsystemPlugins> - <StructureDescriptionFileLocation Path="structure.xml"/> -</ParameterFrameworkConfiguration> diff --git a/test/xml-generator/PFConfig/criteria.txt b/test/xml-generator/PFConfig/criteria.txt deleted file mode 100644 index 7ab3d99..0000000 --- a/test/xml-generator/PFConfig/criteria.txt +++ /dev/null @@ -1,2 +0,0 @@ -InclusiveCriterion Colors : Red Green Blue -ExclusiveCriterion Switch : On Off diff --git a/test/xml-generator/PFConfig/duplicate_criterion_value.txt b/test/xml-generator/PFConfig/duplicate_criterion_value.txt deleted file mode 100644 index af5ffe6..0000000 --- a/test/xml-generator/PFConfig/duplicate_criterion_value.txt +++ /dev/null @@ -1 +0,0 @@ -InclusiveCriterion Duplicate : Foo Foo diff --git a/test/xml-generator/PFConfig/includeStructure.xml b/test/xml-generator/PFConfig/includeStructure.xml deleted file mode 100644 index 6ab16c3..0000000 --- a/test/xml-generator/PFConfig/includeStructure.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Test xi:include feature. - FIXME: this should be done in the functional tests, not in the xmlgeneration tests. --> -<ComponentLibrary> - <ComponentType Name="Included"> - <BooleanParameter Name="bool"/> - </ComponentType> -</ComponentLibrary> diff --git a/test/xml-generator/PFConfig/structure.xml b/test/xml-generator/PFConfig/structure.xml deleted file mode 100644 index e9b621f..0000000 --- a/test/xml-generator/PFConfig/structure.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<SystemClass Name="Test" xmlns:xi="http://www.w3.org/2001/XInclude"> - <Subsystem Name="test" Type="Virtual"> - <ComponentLibrary> - <!-- Test xi:include feature. - FIXME: this should be done in the functional tests, - not in the xml generation test. --> - <xi:include href="includeStructure.xml"/> - </ComponentLibrary> - <InstanceDefinition> - - <Component Name="included" Type="Included"/> - <ParameterBlock Name="inline"> - <BooleanParameter Name="bool"/> - </ParameterBlock> - - <ParameterBlock Name="block" ArrayLength="5"> - <FixedPointParameter Name="q2.5" Size="8" Integral="2" Fractional="5"/> - <IntegerParameter Name="uint8" Signed="false" Size="8"/> - <StringParameter Name="string" MaxLength="50"/> - </ParameterBlock> - - </InstanceDefinition> - </Subsystem> -</SystemClass> diff --git a/test/xml-generator/test.py b/test/xml-generator/test.py deleted file mode 100644 index 80287f3..0000000 --- a/test/xml-generator/test.py +++ /dev/null @@ -1,131 +0,0 @@ -#! python2.7 -# 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. - -import sys -import os -import subprocess -import difflib -import unittest -import copy - -class PfConfig: - def __init__(self, toplevel, criteria, schemas): - self.toplevel = toplevel - self.criteria = criteria - self.schemas = schemas - -class TestVector: - def __init__(self, initialSettings=None, edds=[], domains=[]): - self.initialSettings = initialSettings - self.edds = edds - self.domains = domains - -class Tester(object): - def __init__(self, pfConfig, testVector): - self.command = [sys.executable, "domainGenerator.py", - "--validate", - "--verbose", - "--toplevel-config", pfConfig.toplevel, - "--criteria", pfConfig.criteria, - "--schemas-dir", pfConfig.schemas] - - if testVector.initialSettings: - self.command += ["--initial-settings", testVector.initialSettings] - if testVector.edds: - self.command += ["--add-edds"] + testVector.edds - if testVector.domains: - self.command += ["--add-domains"] + testVector.domains - - def check(self, reference=None, expectedErrors=0): - process = subprocess.Popen(self.command, stdout=subprocess.PIPE) - actual = process.stdout.read().splitlines() - - if process.wait() != expectedErrors: - raise AssertionError("Expected {} errors, found {}".format( - expectedErrors, - process.returncode)) - - if not reference: - # The caller only wants to check the number of errors - return - - # The generation has succeeded as expected - let's compare with the reference. - if reference != actual: - unified = difflib.unified_diff(reference, - actual, - fromfile="reference.xml", - tofile="-", - lineterm="") - raise AssertionError("The result and the reference don't match:" + "\n".join(unified)) - - -basedir = os.path.dirname(sys.argv[0]) - -config_dir = os.path.join(basedir, "PFConfig") -vector_dir = os.path.join(basedir, "testVector") -class TestCase(unittest.TestCase): - def setUp(self): - self.nominal_reference = open(os.path.join(vector_dir, "reference.xml")).read().splitlines() - self.nominal_pfconfig = PfConfig(os.path.join(config_dir, "configuration.xml"), - os.path.join(config_dir, "criteria.txt"), - os.path.join(basedir, "../../schemas")) - self.nominal_vector = TestVector(os.path.join(vector_dir, "initialSettings.xml"), - [os.path.join(vector_dir, "first.pfw"), - os.path.join(vector_dir, "second.pfw"), - os.path.join(vector_dir, "complex.pfw")], - [os.path.join(vector_dir, "third.xml"), - os.path.join(vector_dir, "fourth.xml")]) - - def test_nominal(self): - tester = Tester(self.nominal_pfconfig, self.nominal_vector) - tester.check(self.nominal_reference) - - def test_nonfatalError(self): - self.nominal_vector.edds.append(os.path.join(vector_dir, "duplicate.pfw")) - - tester = Tester(self.nominal_pfconfig, self.nominal_vector) - tester.check(self.nominal_reference, expectedErrors=1) - - def test_conflicting(self): - vector = TestVector(edds=[os.path.join(vector_dir, "conflicting.pfw")]) - - tester = Tester(self.nominal_pfconfig, vector) - tester.check(expectedErrors=1) - - def test_fail_criteria(self): - self.nominal_pfconfig.criteria = os.path.join(config_dir, "duplicate_criterion_value.txt") - # Empty test vector: we want to make sure that the erroneous criterion - # is the only source of error - empty_vector = TestVector() - - tester = Tester(self.nominal_pfconfig, empty_vector) - tester.check(expectedErrors=1) - -if __name__ == "__main__": - unittest.main() diff --git a/test/xml-generator/testVector/complex.pfw b/test/xml-generator/testVector/complex.pfw deleted file mode 100644 index 6339a13..0000000 --- a/test/xml-generator/testVector/complex.pfw +++ /dev/null @@ -1,40 +0,0 @@ -domain: sequenceAware sequenceAware - -domainGroup: Red sequenceAware - Colors Includes Red - confType: On - ANY - Switch Is On - # Expecting a empty tree of all (except for the last `Switch Is On` rule) - ALL - ALL - ALL - ALL - ANY - Switch Is On - confType: On - Switch Is On - - domain: Black - Colors Includes Green - confGroup: green.confGroup - # Should add a `.` in the conf name - # Ie an empty confGroup in a legal name - confGroup: - - confType: On - Switch Is On - - # confGroups with the same name should not overwrite one another - confGroup: On - Colors Includes Green - - conf: Blue.dot - Colors Includes Blue - - component: /Test/test - component: block/0 - q2.5 = 1.18750 - string = 12 ab @ <