From d4ac41dcb596fed7c9a03968590ad4936b837417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Gaffie?= Date: Thu, 6 Apr 2017 11:51:07 +0200 Subject: [PATCH 1/2] Fix dumpElement for ArrayParameters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use correct blackboard index while calling dumpElement (logValue for ArrayParameter class) to fix the eratic behavior of dumpElement for ArrayParameters. Change-Id: I255af6969283f91cdd2efd810c7d453f3765a16d Tracked-On: Signed-off-by: François Gaffie --- parameter/ArrayParameter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parameter/ArrayParameter.cpp b/parameter/ArrayParameter.cpp index 83ffe0462..91ea44879 100644 --- a/parameter/ArrayParameter.cpp +++ b/parameter/ArrayParameter.cpp @@ -171,7 +171,7 @@ bool CArrayParameter::access(std::vector &astrValues, bool bSet, string CArrayParameter::logValue(CParameterAccessContext &context) const { // Dump values - return getValues(0, context); + return getValues(getOffset() - context.getBaseOffset(), context); } // Used for simulation and virtual subsystems From f3683158a6070ed18660b53ff1f68cf50e23efa9 Mon Sep 17 00:00:00 2001 From: Sebastien Guiriec Date: Thu, 6 Apr 2017 16:50:02 +0200 Subject: [PATCH 2/2] Fuction test: Add dumpElement functional test. Accroding to recent testing the dumpElement function is not good for Array. This patch is adding one functional test in Legacy mode in order to cover the issue. Signed-off-by: Sebastien Guiriec --- .../PfwTestCase/Types/tINT16_ARRAY.py | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/functional-tests-legacy/PfwTestCase/Types/tINT16_ARRAY.py b/test/functional-tests-legacy/PfwTestCase/Types/tINT16_ARRAY.py index d280c07f7..74dbf6c4a 100644 --- a/test/functional-tests-legacy/PfwTestCase/Types/tINT16_ARRAY.py +++ b/test/functional-tests-legacy/PfwTestCase/Types/tINT16_ARRAY.py @@ -157,6 +157,42 @@ def test_Min_Value(self): 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_dump_Values(self): + """ + Testing INT16_ARRAY dump value + --------------------------------- + Test case description : + ~~~~~~~~~~~~~~~~~~~~~~~ + - Set every INT16_ARRAY elements to values : 1 0 -50 0 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_dump_Values.__doc__) + index = 2 + 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("dumpElement", str(self.param_name), "") + #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("- IntegerParameter: INT16_ARRAY = 1 0 -50 0 0"), log.F("BLACKBOARD : Incorrect value for %s, expected: %s, found: %s" + % (self.param_name, str("- IntegerParameter: INT16_ARRAY = 1 0 -50 0 0"), out)) def test_Min_Value_Overflow(self): """