From a1fbd2fd2c413798765b65e9efac4b34884ee84d Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 12 Dec 2017 14:05:20 +0000 Subject: [PATCH 7/8] tests: Assert that dbus-daemon filters unknown header fields Signed-off-by: Simon McVittie --- test/dbus-daemon.c | 6 +++++- test/header-fields.c | 5 +---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/dbus-daemon.c b/test/dbus-daemon.c index 8cada03e..f8bb9fb9 100644 --- a/test/dbus-daemon.c +++ b/test/dbus-daemon.c @@ -1590,6 +1590,7 @@ check_features (DBusMessageIter *var_iter) { DBusMessageIter arr_iter; gboolean have_systemd_activation = FALSE; + gboolean have_header_filtering = FALSE; g_assert_cmpint (dbus_message_iter_get_arg_type (var_iter), ==, DBUS_TYPE_ARRAY); @@ -1607,12 +1608,15 @@ check_features (DBusMessageIter *var_iter) g_test_message ("Feature: %s", feature); - if (g_strcmp0 (feature, "SystemdActivation") == 0) + if (g_strcmp0 (feature, "HeaderFiltering") == 0) + have_header_filtering = TRUE; + else if (g_strcmp0 (feature, "SystemdActivation") == 0) have_systemd_activation = TRUE; dbus_message_iter_next (&arr_iter); } + g_assert_true (have_header_filtering); /* We pass --systemd-activation to the daemon for this unit test on Unix * (it can only work in practice on Linux, but there's nothing * inherently Linux-specific about the protocol). */ diff --git a/test/header-fields.c b/test/header-fields.c index af08354f..62f9bb88 100644 --- a/test/header-fields.c +++ b/test/header-fields.c @@ -593,10 +593,7 @@ test_weird_header_field (void *user_data, ==, DBUS_TYPE_BYTE); _dbus_type_reader_read_basic (&sub, &field_code); - if (field_code == NOT_A_HEADER_FIELD) - { - g_test_message ("TODO: header field was passed through"); - } + g_assert_cmpuint (field_code, !=, NOT_A_HEADER_FIELD); _dbus_type_reader_next (&array); } -- 2.15.1