diff options
author | Thomas Haller <thaller@redhat.com> | 2015-03-13 14:32:55 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-03-20 13:19:20 +0100 |
commit | a5ea98005f1cd5815b91c47da6dade9f290c9a85 (patch) | |
tree | e9730bc928093c16677c0b60f6aedb7a4a82e4bc | |
parent | 3790d8db2e642c76188f740bfccf1f939c95115f (diff) | |
download | NetworkManager-a5ea98005f1cd5815b91c47da6dade9f290c9a85.tar.gz |
test: print connections as keyfile on failure of nmtst_assert_connection_equals()
If the assertion nmtst_assert_connection_equals() is about to fail,
dump out the offending connections as keyfile.
-rw-r--r-- | include/nm-test-utils.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/nm-test-utils.h b/include/nm-test-utils.h index 8ef156a588..ddea03745d 100644 --- a/include/nm-test-utils.h +++ b/include/nm-test-utils.h @@ -887,6 +887,24 @@ nmtst_assert_connection_equals (NMConnection *a, gboolean normalize_a, NMConnect __NMTST_LOG (g_message, ">>> differences in setting '%s.%s'", name, pname); } } + +#ifdef __NM_KEYFILE_INTERNAL_H__ + { + gs_unref_keyfile GKeyFile *kf_a = NULL, *kf_b = NULL; + gs_free char *str_a = NULL, *str_b = NULL; + + kf_a = nm_keyfile_write (a, NULL, NULL, NULL); + kf_b = nm_keyfile_write (b, NULL, NULL, NULL); + + if (kf_a) + str_a = g_key_file_to_data (kf_a, NULL, NULL); + if (kf_b) + str_b = g_key_file_to_data (kf_b, NULL, NULL); + + __NMTST_LOG (g_message, ">>> Connection A as kf (*WARNING: keyfile representation might not show the difference*):\n%s", str_a); + __NMTST_LOG (g_message, ">>> Connection B as kf (*WARNING: keyfile representation might not show the difference*):\n%s", str_b); + } +#endif } g_assert (compare); g_assert (!out_settings); |