pidgin/pidgin

4be9a7876d35
Parents 445f5cc52e1a
Children afe8c89a8e90
Fix the unit tests that were broke by the g_log transition

* xmlnode we verify that the error message went to stderr
* everything else we add the entire prefs tree for the preference we're trying to load

Testing Done:
Ran the unit tests and verified that they passed again.

Reviewed at https://reviews.imfreedom.org/r/1082/
--- a/libpurple/tests/test_ui.c Tue Oct 19 03:12:31 2021 -0500
+++ b/libpurple/tests/test_ui.c Wed Oct 20 02:36:06 2021 -0500
@@ -134,6 +134,11 @@
/* Load the preferences. */
purple_prefs_load();
+ purple_prefs_add_none("/purple");
+ purple_prefs_add_none("/purple/test_ui");
+ purple_prefs_add_none("/purple/test_ui/plugins");
+ purple_prefs_add_path_list("/purple/test_ui/plugins/saved", NULL);
+
/* Load the desired plugins. The client should save the list of loaded plugins in
* the preferences using purple_plugins_save_loaded() */
purple_plugins_load_saved("/purple/test_ui/plugins/saved");
--- a/libpurple/tests/test_xmlnode.c Tue Oct 19 03:12:31 2021 -0500
+++ b/libpurple/tests/test_xmlnode.c Wed Oct 20 02:36:06 2021 -0500
@@ -31,13 +31,14 @@
*/
static void
test_xmlnode_billion_laughs_attack(void) {
- const char *malicious_xml_doc = "<!DOCTYPE root [ <!ENTITY ha \"Ha !\"><!ENTITY ha2 \"&ha; &ha;\"><!ENTITY ha3 \"&ha2; &ha2;\"> ]><root>&ha3;</root>";
+ if(g_test_subprocess()) {
+ const char *malicious_xml_doc = "<!DOCTYPE root [ <!ENTITY ha \"Ha !\"><!ENTITY ha2 \"&ha; &ha;\"><!ENTITY ha3 \"&ha2; &ha2;\"> ]><root>&ha3;</root>";
- /* Uncomment this line if you want to see the error message given by
- the parser for the above XML document */
- /* purple_debug_set_enabled(TRUE); */
+ g_assert_null(purple_xmlnode_from_str(malicious_xml_doc, -1));
+ }
- g_assert_null(purple_xmlnode_from_str(malicious_xml_doc, -1));
+ g_test_trap_subprocess(NULL, 0, 0);
+ g_test_trap_assert_stderr("*CRITICAL*Entity 'ha3' not defined*");
}
#define check_doc_structure(x) { \