annotate libpurple/tests/tests.h @ 31518:b39b6d0008c5

upnp: Asynch-ronize the callbacks from UPnP to calling code. Refs #12387 I have no idea if this will resolve the crashes, but with the help of the packet capture, I /think/ these are correct. Short summary: it's possible for the callback to fire (and ar be freed) before the top-level function (purple_upnp_cancel_port_mapping) returns, even though cancel_port_mapping returns the now-invalid ar (which may lead to a subsequent use-after-free). At least one call path through the code that I think leads to this (backed up by one of the debug logs I looked at): purple_upnp_cancel_port_mapping(...) do_port_mapping_cb (has_control_mapping == TRUE, ar->add == FALSE) purple_upnp_generate_action_message_and_send(..., done_port_mapping_cb, ar) /* We fail to parse the URL (see some debug logs) */ done_port_mapping_cb ar->cb(FALSE, cbdata) return; return; return; return ar; ...and something which calls: do_port_mapping_cb(has_control_mapping == TRUE, ar->add == TRUE) ar->cb(FALSE, cbdata) g_free(ar) return;
author Paul Aurich <paul@darkrain42.org>
date Tue, 28 Dec 2010 05:37:20 +0000
parents 6362579b3d2e
children e743507b3767
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 #ifndef TESTS_H
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 # define TESTS_H
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3
21804
fb73a6ed8197 A couple compile fixes to the tests from Elliott Sales de Andrade. Fixes #4313.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15889
diff changeset
4 #include "../purple.h"
fb73a6ed8197 A couple compile fixes to the tests from Elliott Sales de Andrade. Fixes #4313.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15889
diff changeset
5
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 #include <check.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 /* define the test suites here */
15806
a0a5e323a6ac libpurplify the 'make check' tests so they work again
Stu Tomlinson <stu@nosnilmot.com>
parents: 15374
diff changeset
9 /* remember to add the suite to the runner in check_libpurple.c */
15889
6577b292e7b4 Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
Stu Tomlinson <stu@nosnilmot.com>
parents: 15806
diff changeset
10 Suite * master_suite(void);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 Suite * cipher_suite(void);
30683
6362579b3d2e jabber: Start adding some caps tests
Paul Aurich <paul@darkrain42.org>
parents: 29085
diff changeset
12 Suite * jabber_caps_suite(void);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 Suite * jabber_jutil_suite(void);
29085
338eeaf371e2 jabber: Add the Hi() function (PBKDF2).
Paul Aurich <paul@darkrain42.org>
parents: 28561
diff changeset
14 Suite * jabber_scram_suite(void);
28560
2da9e4266742 Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents: 28084
diff changeset
15 Suite * qq_suite(void);
28084
42359a734696 Add a super simple test for yahoo_codes_to_html(). I'm planning on
Mark Doliner <mark@kingant.net>
parents: 21804
diff changeset
16 Suite * yahoo_util_suite(void);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 Suite * util_suite(void);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 /* helper macros */
28560
2da9e4266742 Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents: 28084
diff changeset
20 #define assert_int_equal(expected, actual) { \
28561
72b9fb05bf26 Keep our tenses the same
Mark Doliner <mark@kingant.net>
parents: 28560
diff changeset
21 fail_if(expected != actual, "Expected '%d' but got '%d'", expected, actual); \
28560
2da9e4266742 Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents: 28084
diff changeset
22 }
2da9e4266742 Add a test for qq's qq_encrypt function. Refs #10191. The string of
Mark Doliner <mark@kingant.net>
parents: 28084
diff changeset
23
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 #define assert_string_equal(expected, actual) { \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 const gchar *a = actual; \
28561
72b9fb05bf26 Keep our tenses the same
Mark Doliner <mark@kingant.net>
parents: 28560
diff changeset
26 fail_unless(strcmp(expected, a) == 0, "Expected '%s' but got '%s'", expected, a); \
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #define assert_string_equal_free(expected, actual) { \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 gchar *b = actual; \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 assert_string_equal(expected, b); \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 g_free(b); \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 #endif /* ifndef TESTS_H */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37