From f6aeb0dcba7086267b5841607a8ce60ae141e320 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Tue, 31 Mar 2020 13:13:52 +0200 Subject: ivigenerator: More default_value fixes for the QtRO backend/server Similar to already merged fixes, we cannot use the default_value filter for zoned values for member initialization and should trust the simulation code on that. Also sure all zone objects in the simulation are created before initialize() is called and that a zone object is only created once. This makes sure that initializeDefault() can initialize the zone objects and that subsequent calls to availableZones() don't create new objects and possibly leak memory. Change-Id: If9a4c166d3c53677aa11ebc4afd1455d4868b729 Reviewed-by: Robert Griebl --- src/tools/ivigenerator/templates/backend_qtro/backend.cpp.tpl | 2 +- .../ivigenerator/templates/common/backend_simulation.cpp.tpl | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/tools/ivigenerator/templates/backend_qtro/backend.cpp.tpl b/src/tools/ivigenerator/templates/backend_qtro/backend.cpp.tpl index 5a46282..cf9aebc 100644 --- a/src/tools/ivigenerator/templates/backend_qtro/backend.cpp.tpl +++ b/src/tools/ivigenerator/templates/backend_qtro/backend.cpp.tpl @@ -68,7 +68,7 @@ QT_BEGIN_NAMESPACE {% if property.type.is_model %} , m_{{property}}(new Zoned{{property|upperfirst}}ModelBackend(QStringLiteral("{{interface.qualified_name}}.{{property}}.") + m_zone, this)) {% else %} - , m_{{ property }}({{property|default_value}}) + , m_{{ property }}({{property|default_type_value}}) {% endif %} {% endfor %} { diff --git a/src/tools/ivigenerator/templates/common/backend_simulation.cpp.tpl b/src/tools/ivigenerator/templates/common/backend_simulation.cpp.tpl index 4c146e1..f8f2cd7 100644 --- a/src/tools/ivigenerator/templates/common/backend_simulation.cpp.tpl +++ b/src/tools/ivigenerator/templates/common/backend_simulation.cpp.tpl @@ -149,6 +149,12 @@ QStringList {{class}}::availableZones() const void {{class}}::initialize() { +{% if interface.tags.config.zoned %} + // To initialize the default values all zone objects need to be created. For zoned backends + // the availableZones() method is responsible for that, just make sure this is called before + // initialize to have them created before. + availableZones(); +{% endif %} QIVI_SIMULATION_TRY_CALL({{class}}, "initialize", void); {% for property in interface.properties %} {% if not interface_zoned %} @@ -173,7 +179,8 @@ void {{class}}::initialize() {% if interface_zoned %} void {{class}}::addZone(const QString &zone) { - m_zones->insert(zone, QVariant::fromValue(new {{zone_class}}(zone, this))); + if (!m_zones->contains(zone)) + m_zones->insert(zone, QVariant::fromValue(new {{zone_class}}(zone, this))); } {{zone_class}}* {{class}}::zoneAt(const QString &zone) -- cgit v1.2.3 From 2b7d9ab03bb96d3044c8b813ce68125bdf32c932 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Tue, 31 Mar 2020 15:36:39 +0200 Subject: tst_qivipendingreply: Fix flaky testFailed_qml() Instead of waiting for 100 miliseconds hardcoded we now use a signal spy and increase the wait time to 1000 miliseconds. This should give the test more time if needed. Change-Id: I0cff87cf47bd041664fddc4a602a80055ec9df71 Reviewed-by: Robert Griebl --- tests/auto/core/qivipendingreply/tst_qivipendingreply.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/core/qivipendingreply/tst_qivipendingreply.cpp b/tests/auto/core/qivipendingreply/tst_qivipendingreply.cpp index 5f0bb73..542ea00 100644 --- a/tests/auto/core/qivipendingreply/tst_qivipendingreply.cpp +++ b/tests/auto/core/qivipendingreply/tst_qivipendingreply.cpp @@ -284,8 +284,8 @@ template void tst_QIviPendingReply::qml_helper(TestObject *testObje QCOMPARE(obj->property("replySuccess").toBool(), false); QCOMPARE(obj->property("replyResultAvailable").toBool(), false); - //Wait until the reply is ready - QTest::qWait(100); + QSignalSpy spy(obj.data(), SIGNAL(callBackCalledChanged())); + spy.wait(1000); QVERIFY(obj->property("callBackCalled").toBool()); QCOMPARE(obj->property("success").toBool(), !failed); -- cgit v1.2.3 From a051faa209cad89d16f7155198083e691f2ec779 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Wed, 1 Apr 2020 11:31:26 +0200 Subject: Improve the flaky tst_qivisimulationengine autotest Change-Id: I6a7a3d2d588674a50ff74fecc49c538e68e37adc Reviewed-by: Robert Griebl --- tests/auto/core/qivisimulationengine/tst_qivisimulationengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/core/qivisimulationengine/tst_qivisimulationengine.cpp b/tests/auto/core/qivisimulationengine/tst_qivisimulationengine.cpp index 79e149a..4edffc4 100644 --- a/tests/auto/core/qivisimulationengine/tst_qivisimulationengine.cpp +++ b/tests/auto/core/qivisimulationengine/tst_qivisimulationengine.cpp @@ -661,7 +661,7 @@ void tst_QIviSimulationEngine::testAnimations() QCOMPARE(obj->property("propertyInBase"), 130); //we expect at least 2 animation steps (intermediate step and final step) - QVERIFY2(spy.count() > 2, qPrintable(QStringLiteral("Emitted signals: ") + QString::number(spy.count()))); + QVERIFY2(spy.count() >= 2, qPrintable(QStringLiteral("Emitted signals: ") + QString::number(spy.count()))); } void tst_QIviSimulationEngine::testFunctionCalls_data() -- cgit v1.2.3 From b7bc4dc7adb541c21c49305485d1dbaa83ac6812 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Wed, 1 Apr 2020 14:58:35 +0200 Subject: ivigenerator: Improve support support for zoned default_value data When creating the simulationData for structs the zoned values where ignored and always ended in qface errors. The filter function which generates the simulationData is now able to handle those zoned values as well and they are now also part of the autotests. Change-Id: Ie097b1cba2498d0d1e61fb0524548869c2c96502 Reviewed-by: Robert Griebl --- src/tools/ivigenerator/generator/filters.py | 15 ++++++- tests/auto/core/ivigenerator/org.example.echo.yaml | 47 ++++++++++++++++------ 2 files changed, 48 insertions(+), 14 deletions(-) diff --git a/src/tools/ivigenerator/generator/filters.py b/src/tools/ivigenerator/generator/filters.py index 737143c..b7ee9ff 100644 --- a/src/tools/ivigenerator/generator/filters.py +++ b/src/tools/ivigenerator/generator/filters.py @@ -437,8 +437,19 @@ def simulationData(module): and p in property.tags['config_simulator']): if property.name not in iData: iData[property.name] = {} - iData[property.name][p] = symbolToJson(property.tags['config_simulator'][p], - property.type) + if p not in iData[property.name]: + iData[property.name][p] = {} + zones = iData.get('zones', None) + res = property.tags['config_simulator'][p] + if isinstance(res, dict) and zones: + for zone in zones: + if zone in res: + iData[property.name][p][zone] = symbolToJson(res[zone], property.type) + # Also check the entry for the general zone (=) + if "=" in res: + iData[property.name][p]["="] = symbolToJson(res["="], property.type) + else: + iData[property.name][p] = symbolToJson(res, property.type) data[interface.name] = iData return json.dumps(data, indent=' ') diff --git a/tests/auto/core/ivigenerator/org.example.echo.yaml b/tests/auto/core/ivigenerator/org.example.echo.yaml index 10953f0..d1750bf 100644 --- a/tests/auto/core/ivigenerator/org.example.echo.yaml +++ b/tests/auto/core/ivigenerator/org.example.echo.yaml @@ -1,15 +1,47 @@ +org.example.echo.EchoZoned#stringValue: + config_simulator: + default: "two" + +org.example.echo.Echo#intValue: + config_simulator: + default_value: 61 + range_high: 150 + range_low: 0 + +org.example.echo.Echo#contact: + config_simulator: + zoned: true + default: [ "foo", 23, true, 1234 ] + +org.example.echo.Echo#combo: + config_simulator: + zoned: true + default: [ [ "foo", 23, true, 1234 ], WeekDay.Monday ] + +org.example.echo.Echo#intList: + config_simulator: + default: [1, 2, 3, 4] + +org.example.echo.Echo#comboList: + config_simulator: + default: [[ [ "foo", 23, true, 1234 ], WeekDay.Monday ], [ [ "bar", 21, false, "foo" ], WeekDay.Tuesday ]] + +org.example.echo.Echo#contactList: + config_simulator: + default: [[ "foo", 23, true, WeekDay.Monday ], [ "bar", 12, false, false ]] + org.example.echo.EchoZoned: config_simulator: zones: [ FrontLeft, FrontRight, Rear ] org.example.echo.EchoZoned#stringValue: config_simulator: - default: "two" + default: { FrontLeft: "two", Rear: "one", =: "general" } org.example.echo.EchoZoned#intValue: config_simulator: default: 11 - range: [10, 33] + range: { FrontLeft: [10, 33], Rear: [0, 11] } org.example.echo.EchoZoned#zonedValue: config_simulator: @@ -35,16 +67,10 @@ org.example.echo.EchoZoned#rangedValueWithDefault: range_high: 150 range_low: 0 -org.example.echo.Echo#intValue: - config_simulator: - default_value: 61 - range_high: 150 - range_low: 0 - org.example.echo.EchoZoned#contact: config_simulator: zoned: true - default: [ "foo", 23, true, 1234 ] + default: { FrontLeft: [ "foo", 23, true, 1234 ], Rear: [ "bar", 1, false, 3456 ] } org.example.echo.EchoZoned#combo: config_simulator: @@ -59,6 +85,3 @@ org.example.echo.EchoZoned#comboList: config_simulator: default: [[ [ "foo", 23, true, 1234 ], WeekDay.Monday ], [ [ "bar", 21, false, "foo" ], WeekDay.Tuesday ]] -org.example.echo.Echo#contactList: - config_simulator: - default: [[ "foo", 23, true, WeekDay.Monday ], [ "bar", 12, false, false ]] -- cgit v1.2.3 From c189b26e6ad36fde519c83a12b684916b991ee0a Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Wed, 1 Apr 2020 15:17:11 +0200 Subject: ivigenerator: Improve the errors for incorrect simulation data in annotations The error message give now an indication what symbol type the simulationData is intended for and also give more details on what is wrong. Change-Id: I26940d8248cf3f8b4caaf02552112894ad369dd5 Reviewed-by: Robert Griebl --- src/tools/ivigenerator/generator/filters.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/tools/ivigenerator/generator/filters.py b/src/tools/ivigenerator/generator/filters.py index b7ee9ff..7e7c3d5 100644 --- a/src/tools/ivigenerator/generator/filters.py +++ b/src/tools/ivigenerator/generator/filters.py @@ -167,17 +167,17 @@ def default_value_helper(symbol, res): t = symbol.type if t.is_struct: if not (isinstance(res, dict) or isinstance(res, list)): - jinja_error('default_value: value in annotation is supposed to be a dict or list') + jinja_error('default_value: value in annotation for symbol {0} is supposed to be a dict or list'.format(symbol.qualified_name)) if len(res) != len(t.reference.fields): - jinja_error('default_value: argument count in annotation and number of struct fields ' - 'does not match') + jinja_error('default_value: argument count in annotation for symbol {0} and number of struct fields ' + 'does not match: Expected {1} instead of {2}'.format(symbol.qualified_name, len(t.reference.fields), len(res))) values = [] for idx, property in enumerate(res): values.append(default_value_helper(list(t.reference.fields)[idx], property)) return '{0}({{{1}}})'.format(t.type, ', '.join(values)) if t.is_model or t.is_list: if not isinstance(res, list): - jinja_error('default_value: value in annotation is supposed to be a list') + jinja_error('default_value: value in annotation for symbol {0} is supposed to be a list'.format(symbol.qualified_name)) row_string = '' if t.nested.is_struct and t.is_list: row_string = ', '.join(('QVariant::fromValue({0})'.format(default_value_helper(t.nested, row))) for row in res) @@ -458,10 +458,11 @@ def symbolToJson(data, symbol): if symbol.type.is_struct: t = symbol.type if not (isinstance(data, dict) or isinstance(data, list)): - jinja_error('simulationData: value in annotation is supposed to be a dict or list') + jinja_error('simulationData: value in annotation for symbol {0} is supposed to be a dict or list'.format(symbol.qualified_name)) if len(data) != len(t.reference.fields): - jinja_error('simulationData: argument count in annotation and number of struct fields ' - 'does not match') + print(len(data), len(t.reference.fields)) + jinja_error('simulationData: argument count in annotation for symbol {0} and number of struct fields ' + 'does not match: Expected {1} instead of {2}'.format(symbol.qualified_name, len(t.reference.fields), len(data))) newList = list(symbolToJson(property, list(t.reference.fields)[idx]) for idx, property in enumerate(data)) return {"type": symbol.type.name, "value": newList} elif symbol.type.is_enum or symbol.type.is_flag: -- cgit v1.2.3 From f9ffd3516966345149b7d2721325fc695286118b Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 2 Apr 2020 13:26:07 +0200 Subject: Bump module version to 5.14.2 Fixes: AUTOSUITE-1542 Change-Id: I7cce6be819e58a689fd2b356a0867fd2101b02e8 Reviewed-by: Robert Griebl --- .qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qmake.conf b/.qmake.conf index 6e535a8..4f5640d 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -7,6 +7,6 @@ DEFINES += QT_NO_FOREACH QT_NO_JAVA_STYLE_ITERATORS QT_NO_LINKED_LIST QMAKEFEATURES=$$PWD/mkspecs/features -MODULE_VERSION = 5.14.0 +MODULE_VERSION = 5.14.2 !win32: CONFIG += ivi-coverage -- cgit v1.2.3 From c1eb0c8c62409a10ad1893a406aba07451b473e2 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 2 Apr 2020 16:24:18 +0200 Subject: Fix the geniviextras only build configuration Change-Id: I07fd33fe28e5ff82cf0d478d616e9002e88a26fb Reviewed-by: Bernd Weimer --- src/ivicore/configure.json | 2 +- src/ivimedia/configure.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ivicore/configure.json b/src/ivicore/configure.json index 6698d98..7bc153c 100644 --- a/src/ivicore/configure.json +++ b/src/ivicore/configure.json @@ -88,7 +88,7 @@ "report": [ { "type": "error", - "condition": "!features.ivigenerator && input.ivigenerator != 'no'", + "condition": "features.ivicore && !features.ivigenerator && input.ivigenerator != 'no'", "message": "Cannot build the IVI Generator because its dependencies are not satisfied. The IVI Generator provides tooling to generate source code out of IDL files. Make sure python3 and its 'virtualenv' packages are installed. diff --git a/src/ivimedia/configure.json b/src/ivimedia/configure.json index 33265db..46dc233 100644 --- a/src/ivimedia/configure.json +++ b/src/ivimedia/configure.json @@ -53,11 +53,12 @@ }, "tuner_simulation_backend": { "label": "Tuner Simulation Backend", + "condition": "module.multimedia", "output": [ "privateFeature" ] }, "media_qtro_backend" : { "label": "Mediaplayer Qt Remote Objects Backend", - "condition": "features.remoteobjects", + "condition": "features.remoteobjects && module.multimedia", "output": [ "privateFeature" ] }, "media_qtro_simulation_server" : { -- cgit v1.2.3