|
| From: | Thomas Huth |
| Subject: | Re: [PATCH v2 7/7] Add tests for the STM32L4x5_RCC |
| Date: | Thu, 18 Jan 2024 13:23:15 +0100 |
| User-agent: | Mozilla Thunderbird |
On 18/01/2024 10.14, Arnaud Minier wrote: Maybe add a short patch description about what exactly is being tested here?
Signed-off-by: Arnaud Minier <arnaud.minier@telecom-paris.fr> Signed-off-by: Inès Varhol <ines.varhol@telecom-paris.fr> --- tests/qtest/meson.build | 3 +- tests/qtest/stm32l4x5_rcc-test.c | 210 +++++++++++++++++++++++++++++++
...
+static bool qts_wait_for_flag(QTestState *qts, uint32_t event_addr,
+ uint32_t flag, uint32_t value)
+{
+ time_t now, start = time(NULL);
+
+ while (true) {
+ if ((qtest_readl(qts, event_addr) & flag) == value) {
+ return true;
+ }
+
+ /* Wait at most 5 seconds */
+ now = time(NULL);
+ if (now - start > 5) {
In the past, we've seen timeouts on constructs like this when tests are running on very very loaded CI machines - it often happens that a process there is stopped for a couple of seconds 'til it continues running. I'd suggest to either use a higher value here (maybe 10 instead of 5), or preferably ...
+ break; + } + g_usleep(1000);
... since you're sleeping here anyway, I think you could simply drop the time() stuff completely and change the while(true) loop into something that counts a certain amount of iterations (5000 in this case to match the 5s timeout from above).
Thomas
+ } + + return false; +}
...
| [Prev in Thread] | Current Thread | [Next in Thread] |