summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Griebl <robert.griebl@qt.io>2024-02-27 14:58:20 +0100
committerRobert Griebl <robert.griebl@qt.io>2024-02-28 09:43:48 +0100
commitdd95e8a0023ad6d1ee3ac62087ef4ef70d47c64a (patch)
tree3dc75e061c3709a6381b6041b4cb87075306ec6b
parentb648926ff4434e1f27d10dc661946fb3d16898fa (diff)
tests: stabilize flaky tests and add context on failures
Change-Id: I2de8d216e875af83cb8a14b3ddcefdd787615634 Pick-to: 6.7 Reviewed-by: Dominik Holland <dominik.holland@qt.io>
-rw-r--r--tests/auto/qml/intents/am-config.yaml2
-rw-r--r--tests/auto/qml/intents/tst_intents.qml17
-rw-r--r--tests/auto/qml/processtitle/tst_processtitle.qml11
3 files changed, 16 insertions, 14 deletions
diff --git a/tests/auto/qml/intents/am-config.yaml b/tests/auto/qml/intents/am-config.yaml
index 1667c123..2e19297f 100644
--- a/tests/auto/qml/intents/am-config.yaml
+++ b/tests/auto/qml/intents/am-config.yaml
@@ -13,7 +13,7 @@ flags:
runtimes:
qml:
- quitTime: 1000
+ quitTime: 3000
intents:
timeouts:
diff --git a/tests/auto/qml/intents/tst_intents.qml b/tests/auto/qml/intents/tst_intents.qml
index 3f03ecbe..d24e52fc 100644
--- a/tests/auto/qml/intents/tst_intents.qml
+++ b/tests/auto/qml/intents/tst_intents.qml
@@ -232,32 +232,33 @@ TestCase {
function test_zbroadcast() { // 'z' to make it run as the last test
let am = ApplicationManager
+ const timeout = 5000 * AmTest.timeoutFactor
// stop all running applications
am.stopAllApplications(true)
- tryVerify(() => { return am.applicationRunState("intents1") === Am.NotRunning })
- tryVerify(() => { return am.applicationRunState("intents2.1") === Am.NotRunning })
+ tryVerify(() => { return am.applicationRunState("intents1") === Am.NotRunning }, timeout)
+ tryVerify(() => { return am.applicationRunState("intents2.1") === Am.NotRunning }, timeout)
broadcastReceiver.pongsReceived = []
// broadcast ping -> only intents1 should be auto-started
verify(IntentClient.broadcastIntentRequest("broadcast/ping", { }))
- tryVerify(() => { return am.applicationRunState("intents1") === Am.Running })
- tryVerify(() => { return am.applicationRunState("intents2.1") === Am.NotRunning })
+ tryVerify(() => { return am.applicationRunState("intents1") === Am.Running }, timeout)
+ tryVerify(() => { return am.applicationRunState("intents2.1") === Am.NotRunning }, timeout)
- tryVerify(() => { return broadcastReceiver.pongsReceived.join() === "intents1"})
+ tryVerify(() => { return broadcastReceiver.pongsReceived.join() === "intents1"}, timeout)
// manually start intents2.1 and ping again -> both apps should receive it
verify(am.startApplication("intents2.1"))
- tryVerify(() => { return am.applicationRunState("intents2.1") === Am.Running })
- wait(250 * AmTest.timeoutFactor) // it takes a bit for the intents IPC to get initialized
+ tryVerify(() => { return am.applicationRunState("intents2.1") === Am.Running }, timeout)
+ wait(500 * AmTest.timeoutFactor) // it takes a bit for the intents IPC to get initialized
broadcastReceiver.pongsReceived = []
verify(IntentClient.broadcastIntentRequest("broadcast/ping", { }))
- tryVerify(() => { return broadcastReceiver.pongsReceived.sort().join() === "intents1,intents2" })
+ tryVerify(() => { return broadcastReceiver.pongsReceived.sort().join() === "intents1,intents2" }, timeout)
}
}
diff --git a/tests/auto/qml/processtitle/tst_processtitle.qml b/tests/auto/qml/processtitle/tst_processtitle.qml
index 3db55885..6ab6dc23 100644
--- a/tests/auto/qml/processtitle/tst_processtitle.qml
+++ b/tests/auto/qml/processtitle/tst_processtitle.qml
@@ -57,7 +57,8 @@ TestCase {
if (cmdLine.includes("/qemu-"))
skip("This doesn't work inside qemu")
- verify(cmdLine.endsWith(executable + quickArg));
+ verify(cmdLine.endsWith(executable + quickArg),
+ "cmdLine: '" + cmdLine + "' does not end with: '" + executable + quickArg + "'");
} else {
sigIdx = 1;
quickArg = ""
@@ -79,10 +80,10 @@ TestCase {
if (cmdLine.includes("/qemu-"))
skip("This doesn't work inside qemu")
- verify(AmTest.runProgram([ "ps", "--no-headers", pid ]).stdout.trim()
- .endsWith(executable + ": " + data.resId + quickArg));
-
- verify(cmdLine.endsWith(executable + ": " + data.resId + quickArg));
+ let psOutput = AmTest.runProgram([ "ps", "--no-headers", pid ]).stdout.trim()
+ let checkStr = executable + ": " + data.resId + quickArg
+ verify(psOutput.endsWith(checkStr), "ps output: '" + psOutput + "' does not end with: '" + checkStr + "'");
+ verify(cmdLine.endsWith(checkStr), "cmd.line: '" + cmdLine + "' does not end with: '" + checkStr + "'");
let environment = AmTest.runProgram([ "cat", `/proc/${pid}/environ` ]).stdout
verify(environment.includes("AM_CONFIG=%YAML"));