From 9d705911391c456813ce54a52f70aa2ccbc5b553 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Mon, 5 Jan 2015 18:06:43 +0100 Subject: Make the tests less flaky and don't send empty property updates. The tests have been flaky on the CI. And indeed, running the tests locally under valgrind, which heavily influences the timings, I could reproduce failures on my local machine as well. The failure was due to multiple things, but most notably boils down to intermittend property update noficiations. To reduce that, the myFactory.lastObj property is propagated up. This way, any change to that property won't be propagated to the clients and influence the test. Furthermore, the failing tests are hardened by also checking the server messages, which is crucial to correct the flow of messages. Finally, a bug was found, where an empty property change could be broadcasted to all clients, when only a specific client's object got its properties changed. This is also fixed by this patch now. Change-Id: I2c7ba53253e2841db1a290872dacb097a7b984cf Reviewed-by: Bernd Lamecker Reviewed-by: Risto Avila Reviewed-by: Simon Hausmann Reviewed-by: Milian Wolff --- tests/auto/qml/Client.qml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'tests/auto/qml/Client.qml') diff --git a/tests/auto/qml/Client.qml b/tests/auto/qml/Client.qml index c18644f..ff2824b 100644 --- a/tests/auto/qml/Client.qml +++ b/tests/auto/qml/Client.qml @@ -91,17 +91,21 @@ Item { function awaitRawMessage(from) { - if (!from || typeof from !== "string") - from = "clientMessages"; - else - from += "Messages"; + var messages; + if (!from || typeof from !== "string" || from == "client") { + from = "client"; + messages = clientMessages; + } else { + from = "server"; + messages = serverMessages; + } - for (var i = 0; i < 10 && !root[from].length; ++i) + for (var i = 0; i < 10 && !messages.length; ++i) wait(10); - var msg = root[from].shift(); + var msg = messages.shift(); if (debug) { - console.log((root.objectName ? "(" + root.objectName + ")" : ""), "Shifting Message " + from + ":" + JSON.stringify(msg)); + console.log((root.objectName ? "(" + root.objectName + ")" : ""), "shifting message " + from + "[" + messages.length + "]" + ":" + JSON.stringify(msg)); } return msg; } @@ -120,11 +124,15 @@ Item { var msg; do { msg = awaitMessage(from); - verify(msg); + if (!msg) { + console.trace(); + verify(msg); + } } while (skip && (msg.type === JSClient.QWebChannelMessageTypes.idle)); if (type !== null) { + if (!msg || msg.type != type) + console.trace(); verify(msg); - verify(msg.type); compare(msg.type, type); } return msg; -- cgit v1.2.1