diff options
author | Simon McVittie <smcv@collabora.com> | 2017-11-14 16:06:05 +0000 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2017-11-15 12:12:23 +0000 |
commit | 39ef65d07d2475c43ae6d46e251cc62010d4c27f (patch) | |
tree | b4b9f449acfd150c1604c16f75211177aedc3bdb /bus/dispatch.c | |
parent | 13b640544dae99cfa851f3bbe9338ca58844aea8 (diff) |
bus: Silence most log messages when testing OOM handling
In parts of the OOM testing, our logging produces multiple megabytes
of output. Let's not do that.
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103601
Diffstat (limited to 'bus/dispatch.c')
-rw-r--r-- | bus/dispatch.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/bus/dispatch.c b/bus/dispatch.c index 812c5796a..94df7d451 100644 --- a/bus/dispatch.c +++ b/bus/dispatch.c @@ -4371,20 +4371,28 @@ typedef struct } Check1Data; static dbus_bool_t -check_oom_check1_func (void *data) +check_oom_check1_func (void *data, + dbus_bool_t have_memory) { + dbus_bool_t ret = TRUE; Check1Data *d = data; + if (!have_memory) + bus_context_quiet_log_begin (d->context); + if (! (* d->func) (d->context)) - return FALSE; + ret = FALSE; + + if (!have_memory) + bus_context_quiet_log_end (d->context); - if (!check_no_leftovers (d->context)) + if (ret && !check_no_leftovers (d->context)) { _dbus_warn ("Messages were left over, should be covered by test suite"); - return FALSE; + ret = FALSE; } - return TRUE; + return ret; } static void @@ -4754,20 +4762,28 @@ typedef struct } Check2Data; static dbus_bool_t -check_oom_check2_func (void *data) +check_oom_check2_func (void *data, + dbus_bool_t have_memory) { + dbus_bool_t ret = TRUE; Check2Data *d = data; + if (!have_memory) + bus_context_quiet_log_begin (d->context); + if (! (* d->func) (d->context, d->connection)) - return FALSE; + ret = FALSE; + + if (!have_memory) + bus_context_quiet_log_end (d->context); - if (!check_no_leftovers (d->context)) + if (ret && !check_no_leftovers (d->context)) { _dbus_warn ("Messages were left over, should be covered by test suite"); - return FALSE; + ret = FALSE; } - return TRUE; + return ret; } static void |