libpurple/tests/check_libpurple.c

Wed, 05 Oct 2016 15:10:29 -0500

author
Mike Ruprecht <cmaiku@gmail.com>
date
Wed, 05 Oct 2016 15:10:29 -0500
branch
release-2.x.y
changeset 38089
da90fe7312d3
parent 35985
c305fb08c0d1
child 40846
d4d72fde60c2
permissions
-rw-r--r--

yahoo: Remove protocol plugin from tree

Yahoo has completely reimplemented their protocol, so this version
is no longer operable as of August 5th, 2016:
https://yahoo.tumblr.com/post/145715934739/q2-2016-progress-report-on-our-product

A new prpl has been written to support the new protocol. It can be
found here: https://github.com/EionRobb/funyahoo-plusplus

This also removes support for Yahoo! Japan. According to
http://messenger.yahoo.co.jp/ the service ended March 26th, 2014.

15105
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
1 #include <glib.h>
15102
3d4824183ce0 [gaim-migrate @ 17823]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
2 #include <stdlib.h>
3d4824183ce0 [gaim-migrate @ 17823]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
3
21919
9be7eb0e891c A couple compile fixes to the tests from Elliott Sales de Andrade. Fixes #4313.
Daniel Atallah <datallah@pidgin.im>
parents: 18425
diff changeset
4 #include "tests.h"
9be7eb0e891c A couple compile fixes to the tests from Elliott Sales de Andrade. Fixes #4313.
Daniel Atallah <datallah@pidgin.im>
parents: 18425
diff changeset
5
15105
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
6 #include "../core.h"
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
7 #include "../eventloop.h"
15950
0f01bb61c5d3 Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15906
diff changeset
8 #include "../util.h"
15105
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
9
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
10
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
11 /******************************************************************************
15867
27d45557637d libpurplify the 'make check' tests so they work again
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15435
diff changeset
12 * libpurple goodies
15105
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
13 *****************************************************************************/
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
14 static guint
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15867
diff changeset
15 purple_check_input_add(gint fd, PurpleInputCondition condition,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15867
diff changeset
16 PurpleInputFunction function, gpointer data)
15105
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
17 {
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
18 /* this is a no-op for now, feel free to implement it */
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
19 return 0;
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
20 }
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
21
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15867
diff changeset
22 static PurpleEventLoopUiOps eventloop_ui_ops = {
15105
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
23 g_timeout_add,
18425
22c031a361b0 Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@pidgin.im>
parents: 16594
diff changeset
24 g_source_remove,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15867
diff changeset
25 purple_check_input_add,
18425
22c031a361b0 Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@pidgin.im>
parents: 16594
diff changeset
26 g_source_remove,
22c031a361b0 Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@pidgin.im>
parents: 16594
diff changeset
27 NULL, /* input_get_error */
22c031a361b0 Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@pidgin.im>
parents: 16594
diff changeset
28 #if GLIB_CHECK_VERSION(2,14,0)
22c031a361b0 Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@pidgin.im>
parents: 16594
diff changeset
29 g_timeout_add_seconds,
22c031a361b0 Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@pidgin.im>
parents: 16594
diff changeset
30 #else
22c031a361b0 Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@pidgin.im>
parents: 16594
diff changeset
31 NULL,
22c031a361b0 Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@pidgin.im>
parents: 16594
diff changeset
32 #endif
22c031a361b0 Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@pidgin.im>
parents: 16594
diff changeset
33 NULL,
22c031a361b0 Fix warnings and add a call to g_timeout_add_seconds() just because.
Richard Laager <rlaager@pidgin.im>
parents: 16594
diff changeset
34 NULL,
15950
0f01bb61c5d3 Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15906
diff changeset
35 NULL
15105
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
36 };
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
37
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
38 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15867
diff changeset
39 purple_check_init(void) {
35985
c305fb08c0d1 Backport more warning fixes for libpurple tests from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31891
diff changeset
40 #if !GLIB_CHECK_VERSION(2, 36, 0)
c305fb08c0d1 Backport more warning fixes for libpurple tests from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31891
diff changeset
41 /* GLib type system is automaticaly initialized since 2.36. */
23137
545624e35b8f Initialize the type system in purple_check_init to prevent 'make check'
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21919
diff changeset
42 g_type_init();
35985
c305fb08c0d1 Backport more warning fixes for libpurple tests from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 31891
diff changeset
43 #endif
23137
545624e35b8f Initialize the type system in purple_check_init to prevent 'make check'
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21919
diff changeset
44
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15867
diff changeset
45 purple_eventloop_set_ui_ops(&eventloop_ui_ops);
15105
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
46
30231
1e3c291ae168 Use /dev/null for the purple directory for the tests.
Paul Aurich <darkrain42@pidgin.im>
parents: 29126
diff changeset
47 #if 0
15105
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
48 /* build our fake home directory */
30231
1e3c291ae168 Use /dev/null for the purple directory for the tests.
Paul Aurich <darkrain42@pidgin.im>
parents: 29126
diff changeset
49 {
1e3c291ae168 Use /dev/null for the purple directory for the tests.
Paul Aurich <darkrain42@pidgin.im>
parents: 29126
diff changeset
50 gchar *home_dir;
1e3c291ae168 Use /dev/null for the purple directory for the tests.
Paul Aurich <darkrain42@pidgin.im>
parents: 29126
diff changeset
51
1e3c291ae168 Use /dev/null for the purple directory for the tests.
Paul Aurich <darkrain42@pidgin.im>
parents: 29126
diff changeset
52 home_dir = g_build_path(G_DIR_SEPARATOR_S, BUILDDIR, "libpurple", "tests", "home", NULL);
1e3c291ae168 Use /dev/null for the purple directory for the tests.
Paul Aurich <darkrain42@pidgin.im>
parents: 29126
diff changeset
53 purple_util_set_user_dir(home_dir);
1e3c291ae168 Use /dev/null for the purple directory for the tests.
Paul Aurich <darkrain42@pidgin.im>
parents: 29126
diff changeset
54 g_free(home_dir);
1e3c291ae168 Use /dev/null for the purple directory for the tests.
Paul Aurich <darkrain42@pidgin.im>
parents: 29126
diff changeset
55 }
1e3c291ae168 Use /dev/null for the purple directory for the tests.
Paul Aurich <darkrain42@pidgin.im>
parents: 29126
diff changeset
56 #else
1e3c291ae168 Use /dev/null for the purple directory for the tests.
Paul Aurich <darkrain42@pidgin.im>
parents: 29126
diff changeset
57 purple_util_set_user_dir("/dev/null");
1e3c291ae168 Use /dev/null for the purple directory for the tests.
Paul Aurich <darkrain42@pidgin.im>
parents: 29126
diff changeset
58 #endif
15105
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
59
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15867
diff changeset
60 purple_core_init("check");
15105
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
61 }
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
62
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
63 /******************************************************************************
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
64 * Check meat and potatoes
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
65 *****************************************************************************/
15104
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents: 15102
diff changeset
66 Suite*
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents: 15102
diff changeset
67 master_suite(void)
15102
3d4824183ce0 [gaim-migrate @ 17823]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
68 {
15104
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents: 15102
diff changeset
69 Suite *s = suite_create("Master Suite");
15102
3d4824183ce0 [gaim-migrate @ 17823]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
70
3d4824183ce0 [gaim-migrate @ 17823]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
71 return s;
3d4824183ce0 [gaim-migrate @ 17823]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
72 }
3d4824183ce0 [gaim-migrate @ 17823]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
73
3d4824183ce0 [gaim-migrate @ 17823]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
74 int main(void)
3d4824183ce0 [gaim-migrate @ 17823]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
75 {
3d4824183ce0 [gaim-migrate @ 17823]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
76 int number_failed;
16594
d7ba74322ca4 Use fatal asserts unconditionally in the test code. Perhaps this could be better integrated in some way, but this works.
Richard Laager <rlaager@pidgin.im>
parents: 15950
diff changeset
77 SRunner *sr;
d7ba74322ca4 Use fatal asserts unconditionally in the test code. Perhaps this could be better integrated in some way, but this works.
Richard Laager <rlaager@pidgin.im>
parents: 15950
diff changeset
78
29126
5d92b5f0864d Allow toggling debugging in the test suite with the environment variable
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29123
diff changeset
79 if (g_getenv("PURPLE_CHECK_DEBUG"))
5d92b5f0864d Allow toggling debugging in the test suite with the environment variable
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29123
diff changeset
80 purple_debug_set_enabled(TRUE);
5d92b5f0864d Allow toggling debugging in the test suite with the environment variable
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29123
diff changeset
81
16594
d7ba74322ca4 Use fatal asserts unconditionally in the test code. Perhaps this could be better integrated in some way, but this works.
Richard Laager <rlaager@pidgin.im>
parents: 15950
diff changeset
82 /* Make g_return_... functions fatal, ALWAYS.
d7ba74322ca4 Use fatal asserts unconditionally in the test code. Perhaps this could be better integrated in some way, but this works.
Richard Laager <rlaager@pidgin.im>
parents: 15950
diff changeset
83 * As this is the test code, this is NOT controlled
d7ba74322ca4 Use fatal asserts unconditionally in the test code. Perhaps this could be better integrated in some way, but this works.
Richard Laager <rlaager@pidgin.im>
parents: 15950
diff changeset
84 * by PURPLE_FATAL_ASSERTS. */
d7ba74322ca4 Use fatal asserts unconditionally in the test code. Perhaps this could be better integrated in some way, but this works.
Richard Laager <rlaager@pidgin.im>
parents: 15950
diff changeset
85 g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL);
d7ba74322ca4 Use fatal asserts unconditionally in the test code. Perhaps this could be better integrated in some way, but this works.
Richard Laager <rlaager@pidgin.im>
parents: 15950
diff changeset
86
d7ba74322ca4 Use fatal asserts unconditionally in the test code. Perhaps this could be better integrated in some way, but this works.
Richard Laager <rlaager@pidgin.im>
parents: 15950
diff changeset
87 sr = srunner_create (master_suite());
15104
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents: 15102
diff changeset
88
15154
40b03e555de9 [gaim-migrate @ 17878]
Nathan Walp <nwalp@pidgin.im>
parents: 15105
diff changeset
89 srunner_add_suite(sr, cipher_suite());
30507
10c522a4c93a jabber: Start adding some caps tests
Paul Aurich <darkrain42@pidgin.im>
parents: 30231
diff changeset
90 srunner_add_suite(sr, jabber_caps_suite());
31394
dd9b4ed08d0a jabber: Test harness for DIGEST-MD5 parsing function.
Paul Aurich <darkrain42@pidgin.im>
parents: 30507
diff changeset
91 srunner_add_suite(sr, jabber_digest_md5_suite());
15154
40b03e555de9 [gaim-migrate @ 17878]
Nathan Walp <nwalp@pidgin.im>
parents: 15105
diff changeset
92 srunner_add_suite(sr, jabber_jutil_suite());
28862
8a37b7df0850 jabber: Add the Hi() function (PBKDF2).
Paul Aurich <darkrain42@pidgin.im>
parents: 28490
diff changeset
93 srunner_add_suite(sr, jabber_scram_suite());
31416
a1f75d2eb19c Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <markdoliner@pidgin.im>
parents: 31394
diff changeset
94 srunner_add_suite(sr, oscar_util_suite());
15104
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents: 15102
diff changeset
95 srunner_add_suite(sr, util_suite());
31891
186f61a85ac2 Add a silly little check to make sure our xml parser isn't vulnerable to the
Mark Doliner <markdoliner@pidgin.im>
parents: 31684
diff changeset
96 srunner_add_suite(sr, xmlnode_suite());
15105
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
97
15867
27d45557637d libpurplify the 'make check' tests so they work again
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15435
diff changeset
98 /* make this a libpurple "ui" */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15867
diff changeset
99 purple_check_init();
15104
d71bd6517e5e [gaim-migrate @ 17825]
Nathan Walp <nwalp@pidgin.im>
parents: 15102
diff changeset
100
15102
3d4824183ce0 [gaim-migrate @ 17823]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
101 srunner_run_all (sr, CK_NORMAL);
3d4824183ce0 [gaim-migrate @ 17823]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
102 number_failed = srunner_ntests_failed (sr);
3d4824183ce0 [gaim-migrate @ 17823]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
103 srunner_free (sr);
15105
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
104
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15867
diff changeset
105 purple_core_quit();
15105
d90c07dc4d2b [gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents: 15104
diff changeset
106
15102
3d4824183ce0 [gaim-migrate @ 17823]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
107 return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
3d4824183ce0 [gaim-migrate @ 17823]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
108 }

mercurial