File: tests-always-run-the-SHM-suite-just-expect-failures.patch

package info (click to toggle)
libqb 2.0.8-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,044 kB
  • sloc: ansic: 22,157; sh: 4,728; makefile: 607
file content (106 lines) | stat: -rw-r--r-- 3,808 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
From: =?utf-8?q?Ferenc_W=C3=A1gner?= <wferi@debian.org>
Date: Tue, 13 Mar 2018 10:58:18 +0100
Subject: tests: always run the SHM suite, just expect failures

---
 tests/check_common.h |  9 +++++++++
 tests/check_ipc.c    | 53 ++++++++++++++++++++++++++--------------------------
 2 files changed, 35 insertions(+), 27 deletions(-)

diff --git a/tests/check_common.h b/tests/check_common.h
index 5f1f536..2347648 100644
--- a/tests/check_common.h
+++ b/tests/check_common.h
@@ -66,4 +66,13 @@
 /* add_tcase(<dest-suite>, <testcase-tmp-storage>, <function>[, <timeout>]) */
 #define add_tcase(...)	add_tcase_select(VA_ARGS_CNT(__VA_ARGS__))(__VA_ARGS__)
 
+/* expected failure (the timeout argument is mandatory here) */
+#define add_tcase_xfail(suite, tcase, func, timeout)	\
+	do { \
+		(tcase) = tcase_create(STRINGIFY(func) + sizeof("test")); \
+		tcase_add_exit_test((tcase), func, 1); \
+		tcase_set_timeout((tcase), (timeout)); \
+		suite_add_tcase((suite), (tcase)); \
+	} while (0)
+
 #endif
diff --git a/tests/check_ipc.c b/tests/check_ipc.c
index aba1709..f847bb1 100644
--- a/tests/check_ipc.c
+++ b/tests/check_ipc.c
@@ -2356,28 +2356,34 @@ make_shm_suite(void)
 	TCase *tc;
 	Suite *s = suite_create("shm");
 
-	add_tcase(s, tc, test_ipc_shm_connect_async, 7);
-
-	add_tcase(s, tc, test_ipc_txrx_shm_getauth, 7);
-	add_tcase(s, tc, test_ipc_txrx_shm_timeout, 28);
-	add_tcase(s, tc, test_ipc_server_fail_shm, 7);
-	add_tcase(s, tc, test_ipc_txrx_shm_block, 7);
-	add_tcase(s, tc, test_ipc_txrx_shm_tmo, 7);
-	add_tcase(s, tc, test_ipc_fc_shm, 7);
-	add_tcase(s, tc, test_ipc_dispatch_shm, 15);
-	add_tcase(s, tc, test_ipc_stress_test_shm, 15);
-	add_tcase(s, tc, test_ipc_bulk_events_shm, 15);
-	add_tcase(s, tc, test_ipc_exit_shm, 6);
-	add_tcase(s, tc, test_ipc_event_on_created_shm, 9);
-	add_tcase(s, tc, test_ipc_service_ref_count_shm, 9);
-	add_tcase(s, tc, test_ipc_server_perms, 7);
-	add_tcase(s, tc, test_ipc_stress_connections_shm, 3600 /* ? */);
-	add_tcase(s, tc, test_ipc_disp_shm_native_prio_dlock, 15);
+#undef  add_cond_tcase
+#ifdef DISABLE_IPC_SHM
+#define add_cond_tcase(func, timeout) add_tcase_xfail(s, tc, func, timeout)
+#else
+#define add_cond_tcase(func, timeout) add_tcase(s, tc, func, timeout)
+#endif
+	add_cond_tcase(test_ipc_shm_connect_async, 7);
+
+	add_cond_tcase(test_ipc_txrx_shm_getauth, 7);
+	add_cond_tcase(test_ipc_txrx_shm_timeout, 28);
+	add_cond_tcase(test_ipc_server_fail_shm, 7);
+	add_cond_tcase(test_ipc_txrx_shm_block, 7);
+	add_cond_tcase(test_ipc_txrx_shm_tmo, 7);
+	add_cond_tcase(test_ipc_fc_shm, 7);
+	add_cond_tcase(test_ipc_dispatch_shm, 15);
+	add_cond_tcase(test_ipc_stress_test_shm, 15);
+	add_cond_tcase(test_ipc_bulk_events_shm, 15);
+	add_cond_tcase(test_ipc_exit_shm, 6);
+	add_cond_tcase(test_ipc_event_on_created_shm, 9);
+	add_cond_tcase(test_ipc_service_ref_count_shm, 9);
+	add_cond_tcase(test_ipc_server_perms, 7);
+	add_cond_tcase(test_ipc_stress_connections_shm, 3600 /* ? */);
+	add_cond_tcase(test_ipc_disp_shm_native_prio_dlock, 15);
 #if HAVE_GLIB
-	add_tcase(s, tc, test_ipc_disp_shm_glib_prio_dlock, 15);
+	add_cond_tcase(test_ipc_disp_shm_glib_prio_dlock, 15);
 #endif
 #ifdef HAVE_FAILURE_INJECTION
-	add_tcase(s, tc, test_ipcc_truncate_when_unlink_fails_shm, 8);
+	add_cond_tcase(test_ipcc_truncate_when_unlink_fails_shm, 8);
 #endif
 
 	return s;
@@ -2424,19 +2430,12 @@ main(void)
 	int32_t number_failed;
 	SRunner *sr;
 	Suite *s;
-	int32_t do_shm_tests = QB_TRUE;
 
 	set_ipc_name("ipc_test");
-#ifdef DISABLE_IPC_SHM
-	do_shm_tests = QB_FALSE;
-#endif /* DISABLE_IPC_SHM */
 
 	s = make_soc_suite();
 	sr = srunner_create(s);
-
-	if (do_shm_tests) {
-		srunner_add_suite(sr, make_shm_suite());
-	}
+	srunner_add_suite(sr, make_shm_suite());
 
 	qb_log_init("check", LOG_USER, LOG_EMERG);
 	atexit(qb_log_fini);