Skip to content

Commit e71bd4f

Browse files
committed
tests: bluetooth: audio: ascs: fix build issues
Fix build issues, - error: format %x expects argument of type unsigned int, but argument 7 has type ssize_t {aka long int} [-Werror=format=] zassert_false(ret < 0, "attr->read returned unexpected (err 0x%02x)" , BT_GATT_ERR(ret)); Signed-off-by: Biwen Li <[email protected]>
1 parent c956149 commit e71bd4f

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

tests/bluetooth/audio/ascs/src/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ ZTEST_F(ascs_test_suite, test_sink_ase_read_state_idle)
164164
zexpect_not_null(fixture->ase_snk.attr);
165165

166166
ret = ase->read(conn, ase, &hdr, sizeof(hdr), 0);
167-
zassert_false(ret < 0, "attr->read returned unexpected (err 0x%02x)", BT_GATT_ERR(ret));
167+
zassert_false(ret < 0, "attr->read returned unexpected (err 0x%02x)",
168+
(uint8_t)BT_GATT_ERR(ret));
168169
zassert_equal(0x00, hdr.ase_state, "unexpected ASE_State 0x%02x", hdr.ase_state);
169170
}
170171

tests/bluetooth/audio/ascs/src/test_ase_control_params.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ ZTEST_F(test_ase_control_params, test_sink_ase_control_operation_zero_length_wri
111111

112112
ret = fixture->ase_cp->write(&fixture->conn, fixture->ase_cp, (void *)buf, 0, 0, 0);
113113
zassert_true(ret < 0, "ase_cp_attr->write returned unexpected (err 0x%02x)",
114-
BT_GATT_ERR(ret));
114+
(uint8_t)BT_GATT_ERR(ret));
115115
}
116116

117117
static void test_expect_unsupported_opcode(struct test_ase_control_params_fixture *fixture,

tests/bluetooth/audio/ascs/src/test_ase_state_transition_invalid.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,8 @@ static void expect_ase_state_releasing(struct bt_conn *conn, const struct bt_gat
375375
zexpect_not_null(ase);
376376

377377
ret = ase->read(conn, ase, &hdr, sizeof(hdr), 0);
378-
zassert_false(ret < 0, "attr->read returned unexpected (err 0x%02x)", BT_GATT_ERR(ret));
378+
zassert_false(ret < 0, "attr->read returned unexpected (err 0x%02x)",
379+
(uint8_t)BT_GATT_ERR(ret));
379380
zassert_equal(BT_BAP_EP_STATE_RELEASING, hdr.ase_state,
380381
"unexpected ASE_State 0x%02x", hdr.ase_state);
381382
}

tests/bluetooth/audio/ascs/src/test_common.c

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ uint8_t test_ase_id_get(const struct bt_gatt_attr *ase)
130130
ssize_t ret;
131131

132132
ret = ase->read(NULL, ase, &hdr, sizeof(hdr), 0);
133-
zassert_false(ret < 0, "ase->read returned unexpected (err 0x%02x)", BT_GATT_ERR(ret));
133+
zassert_false(ret < 0, "ase->read returned unexpected (err 0x%02x)",
134+
(uint8_t)BT_GATT_ERR(ret));
134135

135136
return hdr.ase_id;
136137
}
@@ -177,7 +178,8 @@ void test_ase_control_client_config_codec(struct bt_conn *conn, uint8_t ase_id,
177178
mock_bap_unicast_server_cb_config_fake.custom_fake = unicast_server_cb_config_custom_fake;
178179

179180
ret = attr->write(conn, attr, (void *)buf, sizeof(buf), 0, 0);
180-
zassert_false(ret < 0, "cp_attr->write returned unexpected (err 0x%02x)", BT_GATT_ERR(ret));
181+
zassert_false(ret < 0, "cp_attr->write returned unexpected (err 0x%02x)",
182+
(uint8_t)BT_GATT_ERR(ret));
181183

182184
stream_allocated = NULL;
183185

@@ -204,7 +206,8 @@ void test_ase_control_client_config_qos(struct bt_conn *conn, uint8_t ase_id)
204206
ssize_t ret;
205207

206208
ret = attr->write(conn, attr, (void *)buf, sizeof(buf), 0, 0);
207-
zassert_false(ret < 0, "attr->write returned unexpected (err 0x%02x)", BT_GATT_ERR(ret));
209+
zassert_false(ret < 0, "attr->write returned unexpected (err 0x%02x)",
210+
(uint8_t)BT_GATT_ERR(ret));
208211

209212
test_drain_syswq(); /* Ensure that state transitions are completed */
210213
}
@@ -221,7 +224,8 @@ void test_ase_control_client_enable(struct bt_conn *conn, uint8_t ase_id)
221224
ssize_t ret;
222225

223226
ret = attr->write(conn, attr, (void *)buf, sizeof(buf), 0, 0);
224-
zassert_false(ret < 0, "attr->write returned unexpected (err 0x%02x)", BT_GATT_ERR(ret));
227+
zassert_false(ret < 0, "attr->write returned unexpected (err 0x%02x)",
228+
(uint8_t)BT_GATT_ERR(ret));
225229

226230
test_drain_syswq(); /* Ensure that state transitions are completed */
227231
}
@@ -237,7 +241,8 @@ void test_ase_control_client_disable(struct bt_conn *conn, uint8_t ase_id)
237241
ssize_t ret;
238242

239243
ret = attr->write(conn, attr, (void *)buf, sizeof(buf), 0, 0);
240-
zassert_false(ret < 0, "attr->write returned unexpected (err 0x%02x)", BT_GATT_ERR(ret));
244+
zassert_false(ret < 0, "attr->write returned unexpected (err 0x%02x)",
245+
(uint8_t)BT_GATT_ERR(ret));
241246

242247
test_drain_syswq(); /* Ensure that state transitions are completed */
243248
}
@@ -253,7 +258,8 @@ void test_ase_control_client_release(struct bt_conn *conn, uint8_t ase_id)
253258
ssize_t ret;
254259

255260
ret = attr->write(conn, attr, (void *)buf, sizeof(buf), 0, 0);
256-
zassert_false(ret < 0, "attr->write returned unexpected (err 0x%02x)", BT_GATT_ERR(ret));
261+
zassert_false(ret < 0, "attr->write returned unexpected (err 0x%02x)",
262+
(uint8_t)BT_GATT_ERR(ret));
257263

258264
test_drain_syswq(); /* Ensure that state transitions are completed */
259265
}
@@ -271,7 +277,8 @@ void test_ase_control_client_update_metadata(struct bt_conn *conn, uint8_t ase_i
271277
ssize_t ret;
272278

273279
ret = attr->write(conn, attr, (void *)buf, sizeof(buf), 0, 0);
274-
zassert_false(ret < 0, "attr->write returned unexpected (err 0x%02x)", BT_GATT_ERR(ret));
280+
zassert_false(ret < 0, "attr->write returned unexpected (err 0x%02x)",
281+
(uint8_t)BT_GATT_ERR(ret));
275282

276283
test_drain_syswq(); /* Ensure that state transitions are completed */
277284
}
@@ -287,7 +294,8 @@ void test_ase_control_client_receiver_start_ready(struct bt_conn *conn, uint8_t
287294
ssize_t ret;
288295

289296
ret = attr->write(conn, attr, (void *)buf, sizeof(buf), 0, 0);
290-
zassert_false(ret < 0, "attr->write returned unexpected (err 0x%02x)", BT_GATT_ERR(ret));
297+
zassert_false(ret < 0, "attr->write returned unexpected (err 0x%02x)",
298+
(uint8_t)BT_GATT_ERR(ret));
291299

292300
test_drain_syswq(); /* Ensure that state transitions are completed */
293301
}
@@ -303,7 +311,8 @@ void test_ase_control_client_receiver_stop_ready(struct bt_conn *conn, uint8_t a
303311
ssize_t ret;
304312

305313
ret = attr->write(conn, attr, (void *)buf, sizeof(buf), 0, 0);
306-
zassert_false(ret < 0, "attr->write returned unexpected (err 0x%02x)", BT_GATT_ERR(ret));
314+
zassert_false(ret < 0, "attr->write returned unexpected (err 0x%02x)",
315+
(uint8_t)BT_GATT_ERR(ret));
307316

308317
test_drain_syswq(); /* Ensure that state transitions are completed */
309318
}

0 commit comments

Comments
 (0)