Fri, 27 Apr 2007 18:16:43 +0000
Use fatal asserts unconditionally in the test code. Perhaps this could be better integrated in some way, but this works.
|
15105
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
1 | #include <glib.h> |
| 15102 | 2 | #include <stdlib.h> |
| 3 | ||
|
15105
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
4 | #include "../core.h" |
|
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
5 | #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
|
6 | #include "../util.h" |
|
15105
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
7 | |
|
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
8 | #include "tests.h" |
|
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 | /****************************************************************************** |
|
15867
27d45557637d
libpurplify the 'make check' tests so they work again
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15435
diff
changeset
|
11 | * libpurple goodies |
|
15105
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
12 | *****************************************************************************/ |
|
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
13 | static guint |
| 15884 | 14 | purple_check_input_add(gint fd, PurpleInputCondition condition, |
| 15 | PurpleInputFunction function, gpointer data) | |
|
15105
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
16 | { |
|
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
17 | /* 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
|
18 | return 0; |
|
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
19 | } |
|
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
20 | |
| 15884 | 21 | static PurpleEventLoopUiOps eventloop_ui_ops = { |
|
15105
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
22 | g_timeout_add, |
|
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
23 | (guint (*)(guint))g_source_remove, |
| 15884 | 24 | purple_check_input_add, |
|
15105
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
25 | (guint (*)(guint))g_source_remove, |
|
15950
0f01bb61c5d3
Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15906
diff
changeset
|
26 | NULL |
|
15105
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
27 | }; |
|
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
28 | |
|
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
29 | static void |
| 15884 | 30 | purple_check_init(void) { |
|
15105
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
31 | gchar *home_dir; |
|
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
32 | |
| 15884 | 33 | purple_eventloop_set_ui_ops(&eventloop_ui_ops); |
|
15105
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
34 | |
|
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
35 | /* build our fake home directory */ |
|
15867
27d45557637d
libpurplify the 'make check' tests so they work again
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15435
diff
changeset
|
36 | home_dir = g_build_path(BUILDDIR, "libpurple", "tests", "home", NULL); |
| 15884 | 37 | purple_util_set_user_dir(home_dir); |
|
15105
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
38 | g_free(home_dir); |
|
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
39 | |
| 15884 | 40 | purple_core_init("check"); |
|
15105
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
41 | } |
|
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
42 | |
|
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
43 | /****************************************************************************** |
|
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
44 | * Check meat and potatoes |
|
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
45 | *****************************************************************************/ |
| 15104 | 46 | Suite* |
| 47 | master_suite(void) | |
| 15102 | 48 | { |
| 15104 | 49 | Suite *s = suite_create("Master Suite"); |
| 15102 | 50 | |
| 51 | return s; | |
| 52 | } | |
| 53 | ||
| 54 | int main(void) | |
| 55 | { | |
| 56 | 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
|
57 | 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
|
58 | |
|
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
|
59 | /* 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
|
60 | * 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
|
61 | * 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
|
62 | 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
|
63 | |
|
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
|
64 | sr = srunner_create (master_suite()); |
| 15104 | 65 | |
| 15154 | 66 | srunner_add_suite(sr, cipher_suite()); |
| 67 | srunner_add_suite(sr, jabber_jutil_suite()); | |
| 15104 | 68 | srunner_add_suite(sr, util_suite()); |
|
15105
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
69 | |
|
15867
27d45557637d
libpurplify the 'make check' tests so they work again
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15435
diff
changeset
|
70 | /* make this a libpurple "ui" */ |
| 15884 | 71 | purple_check_init(); |
| 15104 | 72 | |
| 15102 | 73 | srunner_run_all (sr, CK_NORMAL); |
| 74 | number_failed = srunner_ntests_failed (sr); | |
| 75 | srunner_free (sr); | |
|
15105
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
76 | |
| 15884 | 77 | purple_core_quit(); |
|
15105
d90c07dc4d2b
[gaim-migrate @ 17827]
Gary Kramlich <grim@reaperworld.com>
parents:
15104
diff
changeset
|
78 | |
| 15102 | 79 | return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; |
| 80 | } |