mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 18:18:03 +02:00
tests: expose current state in local context of NMTST_WAIT()
Inside the loop-handler, it can be interesting to know the current iteration,
and how much time is left.
(cherry picked from commit 86dc1f1394)
This commit is contained in:
parent
844ef9fbdb
commit
945f51d623
1 changed files with 7 additions and 1 deletions
|
|
@ -145,10 +145,16 @@
|
||||||
const gint64 nmtst_wait_start_us = g_get_monotonic_time (); \
|
const gint64 nmtst_wait_start_us = g_get_monotonic_time (); \
|
||||||
const gint64 nmtst_wait_duration_us = (max_wait_ms) * 1000L; \
|
const gint64 nmtst_wait_duration_us = (max_wait_ms) * 1000L; \
|
||||||
const gint64 nmtst_wait_end_us = nmtst_wait_start_us + nmtst_wait_duration_us; \
|
const gint64 nmtst_wait_end_us = nmtst_wait_start_us + nmtst_wait_duration_us; \
|
||||||
|
gint64 _nmtst_wait_remaining_us = nmtst_wait_duration_us; \
|
||||||
|
int _nmtst_wait_iteration = 0; \
|
||||||
\
|
\
|
||||||
while (TRUE) { \
|
while (TRUE) { \
|
||||||
|
_nm_unused const gint64 nmtst_wait_remaining_us = _nmtst_wait_remaining_us; \
|
||||||
|
_nm_unused int nmtst_wait_iteration = _nmtst_wait_iteration++; \
|
||||||
|
\
|
||||||
{ wait }; \
|
{ wait }; \
|
||||||
if (g_get_monotonic_time () > nmtst_wait_end_us) { \
|
_nmtst_wait_remaining_us = (nmtst_wait_end_us - g_get_monotonic_time ()); \
|
||||||
|
if (_nmtst_wait_remaining_us <= 0) { \
|
||||||
_not_expired = FALSE; \
|
_not_expired = FALSE; \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue