diff options
author | Ross Burton <ross.burton@intel.com> | 2019-06-12 13:42:04 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-06-12 21:08:52 +0100 |
commit | e00d88475d0ed7b161f5f58dd13bc9a72e3efdf9 (patch) | |
tree | 1a4d2165797e72297df143791b3527db8f8e12ef /meta/recipes-connectivity/bluez5 | |
parent | 2fca533f60d451c6f50bd9a531bf34120ec88427 (diff) | |
download | poky-e00d88475d0ed7b161f5f58dd13bc9a72e3efdf9.tar.gz |
bluez: fix test case failures with GCC 9
[ YOCTO #13366 ]
(From OE-Core rev: ca737408bb7e9dd24f3a18e60fad290c6e539b7b)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity/bluez5')
-rw-r--r-- | meta/recipes-connectivity/bluez5/bluez5.inc | 1 | ||||
-rw-r--r-- | meta/recipes-connectivity/bluez5/bluez5/gcc9-fixes.patch | 301 |
2 files changed, 302 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/bluez5/bluez5.inc b/meta/recipes-connectivity/bluez5/bluez5.inc index a4c2f3a816..8f321638ce 100644 --- a/meta/recipes-connectivity/bluez5/bluez5.inc +++ b/meta/recipes-connectivity/bluez5/bluez5.inc | |||
@@ -56,6 +56,7 @@ SRC_URI = "\ | |||
56 | file://0001-test-gatt-Fix-hung-issue.patch \ | 56 | file://0001-test-gatt-Fix-hung-issue.patch \ |
57 | file://0001-Makefile.am-Fix-a-race-issue-for-tools.patch \ | 57 | file://0001-Makefile.am-Fix-a-race-issue-for-tools.patch \ |
58 | file://CVE-2018-10910.patch \ | 58 | file://CVE-2018-10910.patch \ |
59 | file://gcc9-fixes.patch \ | ||
59 | " | 60 | " |
60 | S = "${WORKDIR}/bluez-${PV}" | 61 | S = "${WORKDIR}/bluez-${PV}" |
61 | 62 | ||
diff --git a/meta/recipes-connectivity/bluez5/bluez5/gcc9-fixes.patch b/meta/recipes-connectivity/bluez5/bluez5/gcc9-fixes.patch new file mode 100644 index 0000000000..ca678e601e --- /dev/null +++ b/meta/recipes-connectivity/bluez5/bluez5/gcc9-fixes.patch | |||
@@ -0,0 +1,301 @@ | |||
1 | Backported commit from upstream master branch (post 5.50 release), which | ||
2 | resolves assertion failures in several unit tests. | ||
3 | |||
4 | https://git.kernel.org/pub/scm/bluetooth/bluez.git/patch/?id=0be5246170 | ||
5 | |||
6 | Upstream-Status: Backport | ||
7 | Signed-off-by: Ross Burton <ross.burton@intel.com> | ||
8 | |||
9 | diff --git a/unit/test-avctp.c b/unit/test-avctp.c | ||
10 | index 3bc3569..24de663 100644 | ||
11 | --- a/unit/test-avctp.c | ||
12 | +++ b/unit/test-avctp.c | ||
13 | @@ -43,7 +43,7 @@ | ||
14 | |||
15 | struct test_pdu { | ||
16 | bool valid; | ||
17 | - const uint8_t *data; | ||
18 | + uint8_t *data; | ||
19 | size_t size; | ||
20 | }; | ||
21 | |||
22 | @@ -66,7 +66,7 @@ struct context { | ||
23 | #define raw_pdu(args...) \ | ||
24 | { \ | ||
25 | .valid = true, \ | ||
26 | - .data = data(args), \ | ||
27 | + .data = g_memdup(data(args), sizeof(data(args))), \ | ||
28 | .size = sizeof(data(args)), \ | ||
29 | } | ||
30 | |||
31 | @@ -91,6 +91,11 @@ static void test_debug(const char *str, void *user_data) | ||
32 | static void test_free(gconstpointer user_data) | ||
33 | { | ||
34 | const struct test_data *data = user_data; | ||
35 | + struct test_pdu *pdu; | ||
36 | + int i; | ||
37 | + | ||
38 | + for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++) | ||
39 | + g_free(pdu->data); | ||
40 | |||
41 | g_free(data->test_name); | ||
42 | g_free(data->pdu_list); | ||
43 | diff --git a/unit/test-avdtp.c b/unit/test-avdtp.c | ||
44 | index dd8aed7..e2c951a 100644 | ||
45 | --- a/unit/test-avdtp.c | ||
46 | +++ b/unit/test-avdtp.c | ||
47 | @@ -47,7 +47,7 @@ | ||
48 | struct test_pdu { | ||
49 | bool valid; | ||
50 | bool fragmented; | ||
51 | - const uint8_t *data; | ||
52 | + uint8_t *data; | ||
53 | size_t size; | ||
54 | }; | ||
55 | |||
56 | @@ -61,7 +61,7 @@ struct test_data { | ||
57 | #define raw_pdu(args...) \ | ||
58 | { \ | ||
59 | .valid = true, \ | ||
60 | - .data = data(args), \ | ||
61 | + .data = g_memdup(data(args), sizeof(data(args))), \ | ||
62 | .size = sizeof(data(args)), \ | ||
63 | } | ||
64 | |||
65 | @@ -69,7 +69,7 @@ struct test_data { | ||
66 | { \ | ||
67 | .valid = true, \ | ||
68 | .fragmented = true, \ | ||
69 | - .data = data(args), \ | ||
70 | + .data = g_memdup(data(args), sizeof(data(args))), \ | ||
71 | .size = sizeof(data(args)), \ | ||
72 | } | ||
73 | |||
74 | @@ -81,7 +81,7 @@ struct test_data { | ||
75 | static struct test_data data; \ | ||
76 | data.test_name = g_strdup(name); \ | ||
77 | data.pdu_list = g_memdup(pdus, sizeof(pdus)); \ | ||
78 | - tester_add(name, &data, NULL, function, NULL); \ | ||
79 | + tester_add(name, &data, NULL, function, NULL); \ | ||
80 | } while (0) | ||
81 | |||
82 | struct context { | ||
83 | @@ -109,6 +109,11 @@ static void test_debug(const char *str, void *user_data) | ||
84 | static void test_free(gconstpointer user_data) | ||
85 | { | ||
86 | const struct test_data *data = user_data; | ||
87 | + struct test_pdu *pdu; | ||
88 | + int i; | ||
89 | + | ||
90 | + for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++) | ||
91 | + g_free(pdu->data); | ||
92 | |||
93 | g_free(data->test_name); | ||
94 | g_free(data->pdu_list); | ||
95 | diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c | ||
96 | index 01307e6..f1aa353 100644 | ||
97 | --- a/unit/test-avrcp.c | ||
98 | +++ b/unit/test-avrcp.c | ||
99 | @@ -49,7 +49,7 @@ struct test_pdu { | ||
100 | bool fragmented; | ||
101 | bool continuing; | ||
102 | bool browse; | ||
103 | - const uint8_t *data; | ||
104 | + uint8_t *data; | ||
105 | size_t size; | ||
106 | }; | ||
107 | |||
108 | @@ -74,7 +74,7 @@ struct context { | ||
109 | #define raw_pdu(args...) \ | ||
110 | { \ | ||
111 | .valid = true, \ | ||
112 | - .data = data(args), \ | ||
113 | + .data = g_memdup(data(args), sizeof(data(args))), \ | ||
114 | .size = sizeof(data(args)), \ | ||
115 | } | ||
116 | |||
117 | @@ -82,7 +82,7 @@ struct context { | ||
118 | { \ | ||
119 | .valid = true, \ | ||
120 | .browse = true, \ | ||
121 | - .data = data(args), \ | ||
122 | + .data = g_memdup(data(args), sizeof(data(args))), \ | ||
123 | .size = sizeof(data(args)), \ | ||
124 | } | ||
125 | |||
126 | @@ -90,7 +90,7 @@ struct context { | ||
127 | { \ | ||
128 | .valid = true, \ | ||
129 | .fragmented = true, \ | ||
130 | - .data = data(args), \ | ||
131 | + .data = g_memdup(data(args), sizeof(data(args))), \ | ||
132 | .size = sizeof(data(args)), \ | ||
133 | } | ||
134 | |||
135 | @@ -98,7 +98,7 @@ struct context { | ||
136 | { \ | ||
137 | .valid = true, \ | ||
138 | .continuing = true, \ | ||
139 | - .data = data(args), \ | ||
140 | + .data = g_memdup(data(args), sizeof(data(args))), \ | ||
141 | .size = sizeof(data(args)), \ | ||
142 | } | ||
143 | |||
144 | @@ -123,6 +123,11 @@ static void test_debug(const char *str, void *user_data) | ||
145 | static void test_free(gconstpointer user_data) | ||
146 | { | ||
147 | const struct test_data *data = user_data; | ||
148 | + struct test_pdu *pdu; | ||
149 | + int i; | ||
150 | + | ||
151 | + for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++) | ||
152 | + g_free(pdu->data); | ||
153 | |||
154 | g_free(data->test_name); | ||
155 | g_free(data->pdu_list); | ||
156 | diff --git a/unit/test-gatt.c b/unit/test-gatt.c | ||
157 | index c7e28f8..d49f7a0 100644 | ||
158 | --- a/unit/test-gatt.c | ||
159 | +++ b/unit/test-gatt.c | ||
160 | @@ -48,7 +48,7 @@ | ||
161 | |||
162 | struct test_pdu { | ||
163 | bool valid; | ||
164 | - const uint8_t *data; | ||
165 | + uint8_t *data; | ||
166 | size_t size; | ||
167 | }; | ||
168 | |||
169 | @@ -86,7 +86,7 @@ struct context { | ||
170 | #define raw_pdu(args...) \ | ||
171 | { \ | ||
172 | .valid = true, \ | ||
173 | - .data = data(args), \ | ||
174 | + .data = g_memdup(data(args), sizeof(data(args))), \ | ||
175 | .size = sizeof(data(args)), \ | ||
176 | } | ||
177 | |||
178 | @@ -306,6 +306,11 @@ static bt_uuid_t uuid_char_128 = { | ||
179 | static void test_free(gconstpointer user_data) | ||
180 | { | ||
181 | const struct test_data *data = user_data; | ||
182 | + struct test_pdu *pdu; | ||
183 | + int i; | ||
184 | + | ||
185 | + for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++) | ||
186 | + g_free(pdu->data); | ||
187 | |||
188 | g_free(data->test_name); | ||
189 | g_free(data->pdu_list); | ||
190 | @@ -1911,6 +1916,8 @@ static void test_server(gconstpointer data) | ||
191 | g_assert_cmpint(len, ==, pdu.size); | ||
192 | |||
193 | util_hexdump('<', pdu.data, len, test_debug, "GATT: "); | ||
194 | + | ||
195 | + g_free(pdu.data); | ||
196 | } | ||
197 | |||
198 | static void test_search_primary(gconstpointer data) | ||
199 | diff --git a/unit/test-hfp.c b/unit/test-hfp.c | ||
200 | index f2b9622..890eee6 100644 | ||
201 | --- a/unit/test-hfp.c | ||
202 | +++ b/unit/test-hfp.c | ||
203 | @@ -43,7 +43,7 @@ struct context { | ||
204 | |||
205 | struct test_pdu { | ||
206 | bool valid; | ||
207 | - const uint8_t *data; | ||
208 | + uint8_t *data; | ||
209 | size_t size; | ||
210 | enum hfp_gw_cmd_type type; | ||
211 | bool fragmented; | ||
212 | @@ -63,7 +63,7 @@ struct test_data { | ||
213 | #define raw_pdu(args...) \ | ||
214 | { \ | ||
215 | .valid = true, \ | ||
216 | - .data = data(args), \ | ||
217 | + .data = g_memdup(data(args), sizeof(data(args))), \ | ||
218 | .size = sizeof(data(args)), \ | ||
219 | } | ||
220 | |||
221 | @@ -75,7 +75,7 @@ struct test_data { | ||
222 | #define type_pdu(cmd_type, args...) \ | ||
223 | { \ | ||
224 | .valid = true, \ | ||
225 | - .data = data(args), \ | ||
226 | + .data = g_memdup(data(args), sizeof(data(args))), \ | ||
227 | .size = sizeof(data(args)), \ | ||
228 | .type = cmd_type, \ | ||
229 | } | ||
230 | @@ -83,7 +83,7 @@ struct test_data { | ||
231 | #define frg_pdu(args...) \ | ||
232 | { \ | ||
233 | .valid = true, \ | ||
234 | - .data = data(args), \ | ||
235 | + .data = g_memdup(data(args), sizeof(data(args))), \ | ||
236 | .size = sizeof(data(args)), \ | ||
237 | .fragmented = true, \ | ||
238 | } | ||
239 | @@ -119,6 +119,11 @@ struct test_data { | ||
240 | static void test_free(gconstpointer user_data) | ||
241 | { | ||
242 | const struct test_data *data = user_data; | ||
243 | + struct test_pdu *pdu; | ||
244 | + int i; | ||
245 | + | ||
246 | + for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++) | ||
247 | + g_free(pdu->data); | ||
248 | |||
249 | g_free(data->test_name); | ||
250 | g_free(data->pdu_list); | ||
251 | diff --git a/unit/test-hog.c b/unit/test-hog.c | ||
252 | index d117968..25bdb42 100644 | ||
253 | --- a/unit/test-hog.c | ||
254 | +++ b/unit/test-hog.c | ||
255 | @@ -68,11 +68,11 @@ struct context { | ||
256 | |||
257 | #define data(args...) ((const unsigned char[]) { args }) | ||
258 | |||
259 | -#define raw_pdu(args...) \ | ||
260 | -{ \ | ||
261 | - .valid = true, \ | ||
262 | - .data = data(args), \ | ||
263 | - .size = sizeof(data(args)),\ | ||
264 | +#define raw_pdu(args...) \ | ||
265 | +{ \ | ||
266 | + .valid = true, \ | ||
267 | + .data = g_memdup(data(args), sizeof(data(args))), \ | ||
268 | + .size = sizeof(data(args)), \ | ||
269 | } | ||
270 | |||
271 | #define false_pdu() \ | ||
272 | diff --git a/unit/test-sdp.c b/unit/test-sdp.c | ||
273 | index ac921a9..c71ee1f 100644 | ||
274 | --- a/unit/test-sdp.c | ||
275 | +++ b/unit/test-sdp.c | ||
276 | @@ -59,14 +59,14 @@ struct test_data { | ||
277 | #define raw_pdu(args...) \ | ||
278 | { \ | ||
279 | .valid = true, \ | ||
280 | - .raw_data = raw_data(args), \ | ||
281 | + .raw_data = g_memdup(raw_data(args), sizeof(raw_data(args))), \ | ||
282 | .raw_size = sizeof(raw_data(args)), \ | ||
283 | } | ||
284 | |||
285 | #define raw_pdu_cont(cont, args...) \ | ||
286 | { \ | ||
287 | .valid = true, \ | ||
288 | - .raw_data = raw_data(args), \ | ||
289 | + .raw_data = g_memdup(raw_data(args), sizeof(raw_data(args))), \ | ||
290 | .raw_size = sizeof(raw_data(args)), \ | ||
291 | .cont_len = cont, \ | ||
292 | } | ||
293 | @@ -103,7 +103,7 @@ struct test_data_de { | ||
294 | #define define_test_de_attr(name, input, exp) \ | ||
295 | do { \ | ||
296 | static struct test_data_de data; \ | ||
297 | - data.input_data = input; \ | ||
298 | + data.input_data = g_memdup(input, sizeof(input)); \ | ||
299 | data.input_size = sizeof(input); \ | ||
300 | data.expected = exp; \ | ||
301 | tester_add("/sdp/DE/ATTR/" name, &data, NULL, \ | ||