Commit | Line | Data |
---|---|---|
042e8cfe MD |
1 | /* |
2 | * test_urcu_multiflavor.c | |
3 | * | |
4 | * Userspace RCU library - test multiple RCU flavors into one program | |
5 | * | |
6 | * Copyright February 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
7 | * | |
8 | * This program is free software; you can redistribute it and/or modify | |
9 | * it under the terms of the GNU General Public License as published by | |
10 | * the Free Software Foundation; either version 2 of the License, or | |
11 | * (at your option) any later version. | |
12 | * | |
13 | * This program is distributed in the hope that it will be useful, | |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | * GNU General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License along | |
19 | * with this program; if not, write to the Free Software Foundation, Inc., | |
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
21 | */ | |
22 | ||
23 | #ifndef DYNAMIC_LINK_TEST | |
24 | #define _LGPL_SOURCE | |
25 | #endif | |
26 | ||
27 | #include <urcu/urcu-mb.h> | |
28 | #include <urcu/urcu-bp.h> | |
29 | #include <urcu/urcu-memb.h> | |
30 | #include <urcu/urcu-signal.h> | |
31 | #include <urcu/urcu-qsbr.h> | |
32 | ||
33 | #include <stdlib.h> | |
34 | #include "tap.h" | |
35 | ||
36 | static int test_mf_mb(void) | |
37 | { | |
38 | urcu_mb_register_thread(); | |
39 | urcu_mb_read_lock(); | |
40 | urcu_mb_read_unlock(); | |
41 | urcu_mb_synchronize_rcu(); | |
42 | urcu_mb_unregister_thread(); | |
43 | return 0; | |
44 | } | |
45 | ||
46 | static int test_mf_bp(void) | |
47 | { | |
48 | urcu_bp_register_thread(); | |
49 | urcu_bp_read_lock(); | |
50 | urcu_bp_read_unlock(); | |
51 | urcu_bp_synchronize_rcu(); | |
52 | urcu_bp_unregister_thread(); | |
53 | return 0; | |
54 | } | |
55 | ||
56 | static int test_mf_memb(void) | |
57 | { | |
58 | urcu_memb_register_thread(); | |
59 | urcu_memb_read_lock(); | |
60 | urcu_memb_read_unlock(); | |
61 | urcu_memb_synchronize_rcu(); | |
62 | urcu_memb_unregister_thread(); | |
63 | return 0; | |
64 | } | |
65 | ||
66 | static int test_mf_signal(void) | |
67 | { | |
68 | urcu_signal_register_thread(); | |
69 | urcu_signal_read_lock(); | |
70 | urcu_signal_read_unlock(); | |
71 | urcu_signal_synchronize_rcu(); | |
72 | urcu_signal_unregister_thread(); | |
73 | return 0; | |
74 | } | |
75 | ||
76 | static int test_mf_qsbr(void) | |
77 | { | |
78 | urcu_qsbr_register_thread(); | |
79 | urcu_qsbr_read_lock(); | |
80 | urcu_qsbr_read_unlock(); | |
81 | urcu_qsbr_synchronize_rcu(); | |
82 | urcu_qsbr_unregister_thread(); | |
83 | return 0; | |
84 | } | |
85 | ||
86 | int main(int argc, char **argv) | |
87 | { | |
88 | plan_tests(5); | |
89 | ||
90 | ok1(!test_mf_mb()); | |
91 | ok1(!test_mf_bp()); | |
92 | ok1(!test_mf_memb()); | |
93 | ok1(!test_mf_signal()); | |
94 | ok1(!test_mf_qsbr()); | |
95 | ||
96 | return exit_status(); | |
97 | } |