diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/platform/tests/test-common.c | 6 | ||||
-rw-r--r-- | src/core/platform/tests/test-platform-general.c | 6 | ||||
-rw-r--r-- | src/core/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 2 | ||||
-rw-r--r-- | src/core/settings/plugins/keyfile/tests/test-keyfile-settings.c | 5 | ||||
-rw-r--r-- | src/libnm-client-impl/tests/test-libnm.c | 12 | ||||
-rw-r--r-- | src/libnm-client-test/nm-test-utils-impl.c | 2 | ||||
-rw-r--r-- | src/libnm-core-impl/tests/test-setting.c | 4 | ||||
-rw-r--r-- | src/libnm-glib-aux/nm-shared-utils.c | 2 | ||||
-rw-r--r-- | src/libnm-glib-aux/nm-test-utils.h | 14 | ||||
-rw-r--r-- | src/libnm-platform/tests/test-nm-platform.c | 2 | ||||
-rw-r--r-- | src/nm-dispatcher/tests/test-dispatcher-envp.c | 7 |
11 files changed, 54 insertions, 8 deletions
diff --git a/src/core/platform/tests/test-common.c b/src/core/platform/tests/test-common.c index 9053d35173..864c97dd10 100644 --- a/src/core/platform/tests/test-common.c +++ b/src/core/platform/tests/test-common.c @@ -241,6 +241,7 @@ _nmtstp_platform_ip_addresses_assert(const char *filename, if ((IS_IPv4 ? force_exact_4 : force_exact_6) && nm_g_ptr_array_len(plat_addrs) > 0) { char sbuf[sizeof(_nm_utils_to_string_buffer)]; + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER g_error("%s:%d: %u IPv%c addresses found on ifindex %d that should not be there (one " "is %s)", filename, @@ -252,6 +253,7 @@ _nmtstp_platform_ip_addresses_assert(const char *filename, NMP_OBJECT_TO_STRING_PUBLIC, sbuf, sizeof(sbuf))); + NM_PRAGMA_WARNING_REENABLE } } } @@ -580,6 +582,7 @@ _nmtstp_assert_ip4_route_exists(const char *file, if (c != c_exists && c_exists != -1) { char sbuf[NM_UTILS_INET_ADDRSTRLEN]; + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER g_error("[%s:%u] %s(): The ip4 route %s/%d metric %u tos %u shall exist %u times, but " "platform has it %u times", file, @@ -591,6 +594,7 @@ _nmtstp_assert_ip4_route_exists(const char *file, tos, c_exists, c); + NM_PRAGMA_WARNING_REENABLE } return r; @@ -673,6 +677,7 @@ _nmtstp_assert_ip6_route_exists(const char *file, char s_src[NM_UTILS_INET_ADDRSTRLEN]; char s_network[NM_UTILS_INET_ADDRSTRLEN]; + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER g_error("[%s:%u] %s(): The ip6 route %s/%d metric %u src %s/%d shall exist %u times, but " "platform has it %u times", file, @@ -685,6 +690,7 @@ _nmtstp_assert_ip6_route_exists(const char *file, src_plen, c_exists, c); + NM_PRAGMA_WARNING_REENABLE } return r; diff --git a/src/core/platform/tests/test-platform-general.c b/src/core/platform/tests/test-platform-general.c index 9629326aa3..6d156d2a87 100644 --- a/src/core/platform/tests/test-platform-general.c +++ b/src/core/platform/tests/test-platform-general.c @@ -731,15 +731,17 @@ test_platform_ip_address_pretty_sort_cmp(gconstpointer test_data) &bin_len); if (bin_len != ELM_SIZE * N_ADDRESSES || memcmp(addresses, bin_arr, bin_len) != 0) { - char *addresses_str = nm_utils_bin2hexstr(addresses, ELM_SIZE * N_ADDRESSES, -1); + gs_free char *addresses_str = NULL; + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER g_error(">>> test_platform_ip_address_pretty_sort_cmp() will fail:\n" ">>> addresses[%zu]: %s\n" ">>> expected [%zu]: %s\n", ELM_SIZE * N_ADDRESSES, - addresses_str, + (addresses_str = nm_utils_bin2hexstr(addresses, ELM_SIZE * N_ADDRESSES, -1)), bin_len, EXPECTED_BUFFER[TEST_DATA_I]); + NM_PRAGMA_WARNING_REENABLE } g_assert_cmpmem(addresses, ELM_SIZE * N_ADDRESSES, bin_arr, bin_len); diff --git a/src/core/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/core/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c index 7960ea2a9c..83e48b81b8 100644 --- a/src/core/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/src/core/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -221,6 +221,7 @@ _assert_expected_content(NMConnection *connection, const char *filename, const c success = g_file_set_contents(expected, content_written, len_written, &error); nmtst_assert_success(success, error); } else { + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER g_error( "The content of \"%s\" (%zu) differs from \"%s\" (%zu). Set " "NMTST_IFCFG_RH_UPDATE_EXPECTED=yes (or NM_TEST_REGENERATE=1) to update the files " @@ -231,6 +232,7 @@ _assert_expected_content(NMConnection *connection, const char *filename, const c len_expectd, content_written, content_expectd); + NM_PRAGMA_WARNING_REENABLE } } } diff --git a/src/core/settings/plugins/keyfile/tests/test-keyfile-settings.c b/src/core/settings/plugins/keyfile/tests/test-keyfile-settings.c index b4c30df7d2..11a8e4169c 100644 --- a/src/core/settings/plugins/keyfile/tests/test-keyfile-settings.c +++ b/src/core/settings/plugins/keyfile/tests/test-keyfile-settings.c @@ -2635,8 +2635,11 @@ _escape_filename(gboolean with_extension, const char *filename, gboolean would_b g_assert(esc && esc[0]); g_assert(!strchr(esc, '/')); - if (nm_keyfile_utils_ignore_filename(esc, with_extension)) + if (nm_keyfile_utils_ignore_filename(esc, with_extension)) { + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER g_error("Escaping filename \"%s\" yielded \"%s\", but this is ignored", filename, esc); + NM_PRAGMA_WARNING_REENABLE + } } static void diff --git a/src/libnm-client-impl/tests/test-libnm.c b/src/libnm-client-impl/tests/test-libnm.c index 0f600a4a01..d3265e9fb4 100644 --- a/src/libnm-client-impl/tests/test-libnm.c +++ b/src/libnm-client-impl/tests/test-libnm.c @@ -2327,13 +2327,14 @@ _do_read_vpn_details_impl1(const char *file, if (nm_streq(_expected[_i].key, _k)) \ break; \ } \ - if (_i >= _expected_len) \ + if (_i >= _expected_len) { \ g_error("%s:%d: hash '%s' contains unexpected data key '%s' with value '%s'", \ file, \ line, \ G_STRINGIFY(hash), \ _k, \ _v); \ + } \ } \ \ for (_i = 0; _i < _expected_len; _i++) { \ @@ -2342,7 +2343,7 @@ _do_read_vpn_details_impl1(const char *file, g_assert(_d->key); \ g_assert(_d->val); \ _v = g_hash_table_lookup(_hash, _d->key); \ - if (!nm_streq0(_v, _d->val)) \ + if (!nm_streq0(_v, _d->val)) { \ g_error("%s:%d: hash '%s' contains data key '%s' with value %s%s%s but we " \ "expected '%s'", \ file, \ @@ -2351,14 +2352,17 @@ _do_read_vpn_details_impl1(const char *file, _d->key, \ NM_PRINT_FMT_QUOTE_STRING(_v), \ _d->val); \ + } \ } \ \ g_assert_cmpint(g_hash_table_size(_hash), ==, _expected_len); \ } \ G_STMT_END + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER _assert_hash(data, expected_data, expected_data_len); _assert_hash(secrets, expected_secrets, expected_secrets_len); + NM_PRAGMA_WARNING_REENABLE #undef _assert_hash return TRUE; @@ -3049,10 +3053,12 @@ check_dbus_properties: break; p_expected_type++; if (p_expected_type >= &expected_types[G_N_ELEMENTS(expected_types)]) { + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER g_error("D-Bus type \"%s\" is not implemented (in property %s.%s)", (const char *) mpr->dbus_type, mif->dbus_iface_name, mpr->dbus_property_name); + NM_PRAGMA_WARNING_REENABLE } } @@ -3151,6 +3157,7 @@ check_dbus_properties: break; } if (p_expected_type_2 >= &expected_types[G_N_ELEMENTS(expected_types)]) { + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER g_error("D-Bus property \"%s.%s\" (type \"%s\") maps to property \"%s\", " "but that has an unexpected property type %s (expected %s)", mif->dbus_iface_name, @@ -3159,6 +3166,7 @@ check_dbus_properties: pspec->name, g_type_name(pspec->value_type), g_type_name(p_expected_type->default_gtype)); + NM_PRAGMA_WARNING_REENABLE } } diff --git a/src/libnm-client-test/nm-test-utils-impl.c b/src/libnm-client-test/nm-test-utils-impl.c index ef98d9c221..ad642d2530 100644 --- a/src/libnm-client-test/nm-test-utils-impl.c +++ b/src/libnm-client-test/nm-test-utils-impl.c @@ -159,7 +159,9 @@ nmtstc_service_init(void) * via pygobject. */ return NULL; } + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER g_error("test service %s exited with error code %d", NMTSTC_NM_SERVICE, data.exit_code); + NM_PRAGMA_WARNING_REENABLE } } diff --git a/src/libnm-core-impl/tests/test-setting.c b/src/libnm-core-impl/tests/test-setting.c index 490196a69b..788f218d2f 100644 --- a/src/libnm-core-impl/tests/test-setting.c +++ b/src/libnm-core-impl/tests/test-setting.c @@ -4774,10 +4774,12 @@ check_done:; g_assert(NM_IS_SETTING_VPN(setting)); g_assert_cmpstr(sip->name, ==, NM_SETTING_VPN_SECRETS); } else { + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER g_error("secret %s.%s is of unexpected property type %s", nm_setting_get_name(setting), sip->name, g_type_name(sip->param_spec->value_type)); + NM_PRAGMA_WARNING_REENABLE } } } @@ -4900,12 +4902,14 @@ check_done:; /* the property-types with same content should all be shared. Here we have two that * are the same content, but different instances. Bug. */ + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER g_error("The identical property type for D-Bus type \"%s\" is used by: %s and %s. " "If a NMSettInfoPropertType is identical, it should be shared by creating " "a common instance of the property type", (const char *) pt->dbus_type, _PROP_IDX_OWNER(h_property_types, pt), _PROP_IDX_OWNER(h_property_types, pt_2)); + NM_PRAGMA_WARNING_REENABLE } } } diff --git a/src/libnm-glib-aux/nm-shared-utils.c b/src/libnm-glib-aux/nm-shared-utils.c index 6e6fed12c2..262be5feea 100644 --- a/src/libnm-glib-aux/nm-shared-utils.c +++ b/src/libnm-glib-aux/nm-shared-utils.c @@ -1130,6 +1130,7 @@ nm_utils_parse_inaddr_bin_full(int addr_family, #if NM_MORE_ASSERTS > 10 if (addr_family == AF_INET) { + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER gs_free_error GError *error = NULL; in_addr_t a; @@ -1145,6 +1146,7 @@ nm_utils_parse_inaddr_bin_full(int addr_family, error->message); } nm_assert(addrbin.addr4 == a); + NM_PRAGMA_WARNING_REENABLE } #endif diff --git a/src/libnm-glib-aux/nm-test-utils.h b/src/libnm-glib-aux/nm-test-utils.h index caf43d5f48..2dfe9e323e 100644 --- a/src/libnm-glib-aux/nm-test-utils.h +++ b/src/libnm-glib-aux/nm-test-utils.h @@ -1714,8 +1714,11 @@ __nmtst_spawn_sync(const char *working_directory, standard_err, &exit_status, &error); - if (!success) + if (!success) { + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER g_error("nmtst_spawn_sync(%s): %s", ((char **) argv->pdata)[0], error->message); + NM_PRAGMA_WARNING_REENABLE + } g_assert(!error); g_assert(!standard_out || *standard_out); @@ -1844,7 +1847,8 @@ _nmtst_assert_resolve_relative_path_equals(const char *f1, /* Fixme: later we might need to coalesce repeated '/', "./", and "../". * For now, it's good enough. */ - if (g_strcmp0(p1, p2) != 0) + if (g_strcmp0(p1, p2) != 0) { + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER g_error("%s:%d : filenames don't match \"%s\" vs. \"%s\" // \"%s\" - \"%s\"", file, line, @@ -1852,6 +1856,8 @@ _nmtst_assert_resolve_relative_path_equals(const char *f1, f2, p1, p2); + NM_PRAGMA_WARNING_REENABLE + } } #define nmtst_assert_resolve_relative_path_equals(f1, f2) \ _nmtst_assert_resolve_relative_path_equals(f1, f2, __FILE__, __LINE__); @@ -2404,9 +2410,11 @@ _nmtst_assert_connection_has_settings(NMConnection *connection, settings = nm_connection_get_settings(connection, &len); for (i = 0; i < len; i++) { if (!g_hash_table_remove(names, nm_setting_get_name(settings[i])) && has_at_most) { + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER g_error( "nmtst_assert_connection_has_settings(): has setting \"%s\" which is not expected", nm_setting_get_name(settings[i])); + NM_PRAGMA_WARNING_REENABLE } } if (g_hash_table_size(names) > 0 && has_at_least) { @@ -2419,11 +2427,13 @@ _nmtst_assert_connection_has_settings(NMConnection *connection, settings_names[i] = nm_setting_get_name(settings[i]); has_str = g_strjoinv(" ", (char **) settings_names); + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER g_error("nmtst_assert_connection_has_settings(): the setting lacks %u expected settings " "(expected: [%s] vs. has: [%s])", g_hash_table_size(names), expected_str, has_str); + NM_PRAGMA_WARNING_REENABLE } } #define nmtst_assert_connection_has_settings(connection, ...) \ diff --git a/src/libnm-platform/tests/test-nm-platform.c b/src/libnm-platform/tests/test-nm-platform.c index d4de0dd5ea..9ac69bdeda 100644 --- a/src/libnm-platform/tests/test-nm-platform.c +++ b/src/libnm-platform/tests/test-nm-platform.c @@ -131,11 +131,13 @@ test_nmp_link_mode_all_advertised_modes_bits(void) for (i = 0; i < (int) G_N_ELEMENTS(_nmp_link_mode_all_advertised_modes); i++) { if (flags[i] != _nmp_link_mode_all_advertised_modes[i]) { + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER g_error("_nmp_link_mode_all_advertised_modes[%d] should be 0x%0x but is 0x%0x " "(according to the bits in _nmp_link_mode_all_advertised_modes_bits)", i, flags[i], _nmp_link_mode_all_advertised_modes[i]); + NM_PRAGMA_WARNING_REENABLE } } } diff --git a/src/nm-dispatcher/tests/test-dispatcher-envp.c b/src/nm-dispatcher/tests/test-dispatcher-envp.c index f53bb1c137..51d31544ec 100644 --- a/src/nm-dispatcher/tests/test-dispatcher-envp.c +++ b/src/nm-dispatcher/tests/test-dispatcher-envp.c @@ -530,8 +530,11 @@ test_generic(const char *file, const char *override_vpn_ip_iface) g_assert((!denv && error_message) || (denv && !error_message)); - if (error_message) + if (error_message) { + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER g_error("FAILED: %s", error_message); + NM_PRAGMA_WARNING_REENABLE + } if (g_strv_length(denv) != g_hash_table_size(expected_env)) { _print_env(NM_CAST_STRV_CC(denv), expected_env); @@ -552,8 +555,10 @@ test_generic(const char *file, const char *override_vpn_ip_iface) foo = g_hash_table_lookup(expected_env, i_value); if (!foo) { + NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER _print_env(NM_CAST_STRV_CC(denv), expected_env); g_error("Failed to find %s in environment", i_value); + NM_PRAGMA_WARNING_REENABLE } } |