mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccoll...@apache.org
Subject [1/3] incubator-mynewt-core git commit: ble host: reduce code size.
Date Tue, 05 Apr 2016 02:15:38 GMT
Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop f41a1090a -> 2fef21d6a


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2fef21d6/net/nimble/host/src/test/ble_att_svr_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_att_svr_test.c b/net/nimble/host/src/test/ble_att_svr_test.c
index f9787e4..fda86d8 100644
--- a/net/nimble/host/src/test/ble_att_svr_test.c
+++ b/net/nimble/host/src/test/ble_att_svr_test.c
@@ -297,8 +297,7 @@ ble_att_svr_test_misc_verify_tx_err_rsp(struct ble_l2cap_chan *chan,
     rc = os_mbuf_copydata(ble_hs_test_util_prev_tx, 0, sizeof buf, buf);
     TEST_ASSERT(rc == 0);
 
-    rc = ble_att_error_rsp_parse(buf, sizeof buf, &rsp);
-    TEST_ASSERT(rc == 0);
+    ble_att_error_rsp_parse(buf, sizeof buf, &rsp);
 
     TEST_ASSERT(rsp.baep_req_op == req_op);
     TEST_ASSERT(rsp.baep_handle == handle);
@@ -373,8 +372,7 @@ ble_att_svr_test_misc_rx_read_mult_req(struct ble_hs_conn *conn,
     int rc;
     int i;
 
-    rc = ble_att_read_mult_req_write(buf, sizeof buf);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_mult_req_write(buf, sizeof buf);
 
     off = BLE_ATT_READ_MULT_REQ_BASE_SZ;
     for (i = 0; i < num_handles; i++) {
@@ -477,8 +475,7 @@ ble_att_svr_test_misc_verify_tx_mtu_rsp(struct ble_l2cap_chan *chan)
     rc = os_mbuf_copydata(ble_hs_test_util_prev_tx, 0, sizeof buf, buf);
     TEST_ASSERT(rc == 0);
 
-    rc = ble_att_mtu_cmd_parse(buf, sizeof buf, &rsp);
-    TEST_ASSERT(rc == 0);
+    ble_att_mtu_cmd_parse(buf, sizeof buf, &rsp);
 
     TEST_ASSERT(rsp.bamc_mtu == chan->blc_my_mtu);
 
@@ -515,8 +512,7 @@ ble_att_svr_test_misc_verify_tx_find_info_rsp(
     TEST_ASSERT(rc == 0);
     off += sizeof buf;
 
-    rc = ble_att_find_info_rsp_parse(buf, sizeof buf, &rsp);
-    TEST_ASSERT(rc == 0);
+    ble_att_find_info_rsp_parse(buf, sizeof buf, &rsp);
 
     for (entry = entries; entry->handle != 0; entry++) {
         rc = os_mbuf_copydata(ble_hs_test_util_prev_tx, off, 2, &handle);
@@ -627,8 +623,7 @@ ble_att_svr_test_misc_verify_tx_read_group_type_rsp(
                         BLE_ATT_READ_GROUP_TYPE_RSP_BASE_SZ);
     TEST_ASSERT_FATAL(om != NULL);
 
-    rc = ble_att_read_group_type_rsp_parse(om->om_data, om->om_len, &rsp);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_group_type_rsp_parse(om->om_data, om->om_len, &rsp);
 
     off = BLE_ATT_READ_GROUP_TYPE_RSP_BASE_SZ;
     for (entry = entries; entry->start_handle != 0; entry++) {
@@ -700,8 +695,7 @@ ble_att_svr_test_misc_verify_tx_read_type_rsp(
                         BLE_ATT_READ_TYPE_RSP_BASE_SZ);
     TEST_ASSERT_FATAL(om != NULL);
 
-    rc = ble_att_read_type_rsp_parse(om->om_data, om->om_len, &rsp);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_type_rsp_parse(om->om_data, om->om_len, &rsp);
 
     off = BLE_ATT_READ_TYPE_RSP_BASE_SZ;
     for (entry = entries; entry->handle != 0; entry++) {
@@ -740,8 +734,7 @@ ble_att_svr_test_misc_verify_tx_prep_write_rsp(struct ble_l2cap_chan *chan,
                           OS_MBUF_PKTLEN(ble_hs_test_util_prev_tx), buf);
     TEST_ASSERT_FATAL(rc == 0);
 
-    rc = ble_att_prep_write_rsp_parse(buf, sizeof buf, &rsp);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_att_prep_write_rsp_parse(buf, sizeof buf, &rsp);
 
     TEST_ASSERT(rsp.bapc_handle == attr_handle);
     TEST_ASSERT(rsp.bapc_offset == offset);
@@ -756,15 +749,13 @@ static void
 ble_att_svr_test_misc_verify_tx_exec_write_rsp(struct ble_l2cap_chan *chan)
 {
     struct os_mbuf *om;
-    int rc;
 
     ble_hs_test_util_tx_all();
 
     om = os_mbuf_pullup(ble_hs_test_util_prev_tx, BLE_ATT_EXEC_WRITE_RSP_SZ);
     TEST_ASSERT_FATAL(om != NULL);
 
-    rc = ble_att_exec_write_rsp_parse(om->om_data, om->om_len);
-    TEST_ASSERT(rc == 0);
+    ble_att_exec_write_rsp_parse(om->om_data, om->om_len);
 }
 
 static void
@@ -782,8 +773,7 @@ ble_att_svr_test_misc_mtu_exchange(uint16_t my_mtu, uint16_t peer_sent,
     chan->blc_my_mtu = my_mtu;
 
     req.bamc_mtu = peer_sent;
-    rc = ble_att_mtu_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_mtu_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc == 0);
@@ -807,8 +797,7 @@ ble_att_svr_test_misc_prep_write(struct ble_hs_conn *conn,
 
     prep_req.bapc_handle = handle;
     prep_req.bapc_offset = offset;
-    rc = ble_att_prep_write_req_write(buf, sizeof buf, &prep_req);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_att_prep_write_req_write(buf, sizeof buf, &prep_req);
     memcpy(buf + BLE_ATT_PREP_WRITE_CMD_BASE_SZ, data, data_len);
     rc = ble_hs_test_util_l2cap_rx_payload_flat(
         conn, chan, buf, BLE_ATT_PREP_WRITE_CMD_BASE_SZ + data_len);
@@ -835,8 +824,7 @@ ble_att_svr_test_misc_exec_write(struct ble_hs_conn *conn,
     int rc;
 
     exec_req.baeq_flags = flags;
-    rc = ble_att_exec_write_req_write(buf, sizeof buf, &exec_req);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_att_exec_write_req_write(buf, sizeof buf, &exec_req);
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf,
                                                 BLE_ATT_EXEC_WRITE_REQ_SZ);
 
@@ -863,8 +851,7 @@ ble_att_svr_test_misc_rx_notify(struct ble_hs_conn *conn,
     int rc;
 
     req.banq_handle = attr_handle;
-    rc = ble_att_notify_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_att_notify_req_write(buf, sizeof buf, &req);
     off = BLE_ATT_NOTIFY_REQ_BASE_SZ;
 
     memcpy(buf + off, attr_val, attr_len);
@@ -931,15 +918,13 @@ static void
 ble_att_svr_test_misc_verify_tx_indicate_rsp(struct ble_l2cap_chan *chan)
 {
     struct os_mbuf *om;
-    int rc;
 
     ble_hs_test_util_tx_all();
 
     om = os_mbuf_pullup(ble_hs_test_util_prev_tx, BLE_ATT_INDICATE_RSP_SZ);
     TEST_ASSERT_FATAL(om != NULL);
 
-    rc = ble_att_indicate_rsp_parse(om->om_data, om->om_len);
-    TEST_ASSERT(rc == 0);
+    ble_att_indicate_rsp_parse(om->om_data, om->om_len);
 }
 
 static void
@@ -954,8 +939,7 @@ ble_att_svr_test_misc_rx_indicate(struct ble_hs_conn *conn,
     int rc;
 
     req.baiq_handle = attr_handle;
-    rc = ble_att_indicate_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_att_indicate_req_write(buf, sizeof buf, &req);
     off = BLE_ATT_INDICATE_REQ_BASE_SZ;
 
     memcpy(buf + off, attr_val, attr_len);
@@ -1029,8 +1013,7 @@ TEST_CASE(ble_att_svr_test_read)
 
     /*** Nonexistent attribute. */
     req.barq_handle = 0;
-    rc = ble_att_read_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc != 0);
@@ -1044,8 +1027,7 @@ TEST_CASE(ble_att_svr_test_read)
                               ble_att_svr_test_misc_attr_fn_r_1, NULL);
     TEST_ASSERT(rc == 0);
 
-    rc = ble_att_read_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc == 0);
@@ -1058,8 +1040,7 @@ TEST_CASE(ble_att_svr_test_read)
                     22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39};
     ble_att_svr_test_attr_r_1_len = 40;
 
-    rc = ble_att_read_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc == 0);
@@ -1081,8 +1062,7 @@ TEST_CASE(ble_att_svr_test_read_blob)
     /*** Nonexistent attribute. */
     req.babq_handle = 0;
     req.babq_offset = 0;
-    rc = ble_att_read_blob_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_blob_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc != 0);
@@ -1098,8 +1078,7 @@ TEST_CASE(ble_att_svr_test_read_blob)
                               ble_att_svr_test_misc_attr_fn_r_1, NULL);
     TEST_ASSERT(rc == 0);
 
-    rc = ble_att_read_blob_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_blob_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc != 0);
@@ -1110,8 +1089,7 @@ TEST_CASE(ble_att_svr_test_read_blob)
     /*** Successful partial read. */
     ble_att_svr_test_attr_r_1_len = 40;
 
-    rc = ble_att_read_blob_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_blob_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc == 0);
@@ -1121,8 +1099,7 @@ TEST_CASE(ble_att_svr_test_read_blob)
 
     /*** Read remainder of attribute. */
     req.babq_offset = BLE_ATT_MTU_DFLT - 1;
-    rc = ble_att_read_blob_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_blob_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc == 0);
@@ -1132,8 +1109,7 @@ TEST_CASE(ble_att_svr_test_read_blob)
 
     /*** Zero-length read. */
     req.babq_offset = ble_att_svr_test_attr_r_1_len;
-    rc = ble_att_read_blob_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_blob_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc == 0);
@@ -1223,8 +1199,7 @@ TEST_CASE(ble_att_svr_test_write)
 
     /*** Nonexistent attribute. */
     req.bawq_handle = 0;
-    rc = ble_att_write_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_write_req_write(buf, sizeof buf, &req);
     memcpy(buf + BLE_ATT_READ_REQ_SZ, ((uint8_t[]){0,1,2,3,4,5,6,7}), 8);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
@@ -1237,8 +1212,7 @@ TEST_CASE(ble_att_svr_test_write)
                               ble_att_svr_test_misc_attr_fn_w_1, NULL);
     TEST_ASSERT(rc == 0);
 
-    rc = ble_att_write_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_write_req_write(buf, sizeof buf, &req);
     memcpy(buf + BLE_ATT_WRITE_REQ_BASE_SZ,
            ((uint8_t[]){0,1,2,3,4,5,6,7}), 8);
 
@@ -1275,8 +1249,7 @@ TEST_CASE(ble_att_svr_test_find_info)
     req.bafq_start_handle = 0;
     req.bafq_end_handle = 0;
 
-    rc = ble_att_find_info_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_find_info_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc != 0);
@@ -1287,8 +1260,7 @@ TEST_CASE(ble_att_svr_test_find_info)
     req.bafq_start_handle = 101;
     req.bafq_end_handle = 100;
 
-    rc = ble_att_find_info_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_find_info_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc != 0);
@@ -1299,8 +1271,7 @@ TEST_CASE(ble_att_svr_test_find_info)
     req.bafq_start_handle = 200;
     req.bafq_end_handle = 300;
 
-    rc = ble_att_find_info_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_find_info_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc != 0);
@@ -1315,8 +1286,7 @@ TEST_CASE(ble_att_svr_test_find_info)
     req.bafq_start_handle = 200;
     req.bafq_end_handle = 300;
 
-    rc = ble_att_find_info_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_find_info_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc != 0);
@@ -1327,8 +1297,7 @@ TEST_CASE(ble_att_svr_test_find_info)
     req.bafq_start_handle = handle1;
     req.bafq_end_handle = handle1;
 
-    rc = ble_att_find_info_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_find_info_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc == 0);
@@ -1348,8 +1317,7 @@ TEST_CASE(ble_att_svr_test_find_info)
     req.bafq_start_handle = handle1;
     req.bafq_end_handle = handle2;
 
-    rc = ble_att_find_info_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_find_info_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc == 0);
@@ -1372,8 +1340,7 @@ TEST_CASE(ble_att_svr_test_find_info)
     req.bafq_start_handle = handle1;
     req.bafq_end_handle = handle3;
 
-    rc = ble_att_find_info_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_find_info_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc == 0);
@@ -1392,8 +1359,7 @@ TEST_CASE(ble_att_svr_test_find_info)
     req.bafq_start_handle = handle3;
     req.bafq_end_handle = handle3;
 
-    rc = ble_att_find_info_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_find_info_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc == 0);
@@ -1447,8 +1413,7 @@ TEST_CASE(ble_att_svr_test_find_type_value)
     req.bavq_end_handle = 0;
     req.bavq_attr_type = 0x0001;
 
-    rc = ble_att_find_type_value_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_find_type_value_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc != 0);
@@ -1460,8 +1425,7 @@ TEST_CASE(ble_att_svr_test_find_type_value)
     req.bavq_start_handle = 101;
     req.bavq_end_handle = 100;
 
-    rc = ble_att_find_type_value_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_find_type_value_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc != 0);
@@ -1473,8 +1437,7 @@ TEST_CASE(ble_att_svr_test_find_type_value)
     req.bavq_start_handle = 200;
     req.bavq_end_handle = 300;
 
-    rc = ble_att_find_type_value_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_find_type_value_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc != 0);
@@ -1490,8 +1453,7 @@ TEST_CASE(ble_att_svr_test_find_type_value)
     req.bavq_start_handle = 200;
     req.bavq_end_handle = 300;
 
-    rc = ble_att_find_type_value_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_find_type_value_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc != 0);
@@ -1503,8 +1465,7 @@ TEST_CASE(ble_att_svr_test_find_type_value)
     req.bavq_start_handle = handle1;
     req.bavq_end_handle = handle1;
 
-    rc = ble_att_find_type_value_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_find_type_value_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc == 0);
@@ -1524,8 +1485,7 @@ TEST_CASE(ble_att_svr_test_find_type_value)
     req.bavq_start_handle = handle1;
     req.bavq_end_handle = handle2;
 
-    rc = ble_att_find_type_value_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_find_type_value_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc == 0);
@@ -1549,8 +1509,7 @@ TEST_CASE(ble_att_svr_test_find_type_value)
     req.bavq_start_handle = 0x0001;
     req.bavq_end_handle = 0xffff;
 
-    rc = ble_att_find_type_value_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_find_type_value_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc == 0);
@@ -1572,8 +1531,7 @@ TEST_CASE(ble_att_svr_test_find_type_value)
     req.bavq_start_handle = 0x0001;
     req.bavq_end_handle = 0xffff;
 
-    rc = ble_att_find_type_value_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_find_type_value_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc == 0);
@@ -1595,8 +1553,7 @@ TEST_CASE(ble_att_svr_test_find_type_value)
     req.bavq_start_handle = 0x0001;
     req.bavq_end_handle = 0xffff;
 
-    rc = ble_att_find_type_value_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_find_type_value_req_write(buf, sizeof buf, &req);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc == 0);
@@ -1631,8 +1588,7 @@ TEST_CASE(ble_att_svr_test_read_type)
     req.batq_start_handle = 0;
     req.batq_end_handle = 0;
 
-    rc = ble_att_read_type_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_type_req_write(buf, sizeof buf, &req);
     htole16(buf + BLE_ATT_READ_TYPE_REQ_BASE_SZ,
             BLE_ATT_UUID_PRIMARY_SERVICE);
 
@@ -1646,8 +1602,7 @@ TEST_CASE(ble_att_svr_test_read_type)
     req.batq_start_handle = 101;
     req.batq_end_handle = 100;
 
-    rc = ble_att_read_type_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_type_req_write(buf, sizeof buf, &req);
     htole16(buf + BLE_ATT_READ_TYPE_REQ_BASE_SZ,
             BLE_ATT_UUID_PRIMARY_SERVICE);
 
@@ -1661,8 +1616,7 @@ TEST_CASE(ble_att_svr_test_read_type)
     req.batq_start_handle = 1;
     req.batq_end_handle = 0xffff;
 
-    rc = ble_att_read_type_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_type_req_write(buf, sizeof buf, &req);
     htole16(buf + BLE_ATT_READ_TYPE_REQ_BASE_SZ,
             BLE_ATT_UUID_PRIMARY_SERVICE);
 
@@ -1677,8 +1631,7 @@ TEST_CASE(ble_att_svr_test_read_type)
     req.batq_start_handle = 200;
     req.batq_end_handle = 300;
 
-    rc = ble_att_read_type_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_type_req_write(buf, sizeof buf, &req);
     htole16(buf + BLE_ATT_READ_TYPE_REQ_BASE_SZ,
             BLE_ATT_UUID_PRIMARY_SERVICE);
 
@@ -1692,8 +1645,7 @@ TEST_CASE(ble_att_svr_test_read_type)
     req.batq_start_handle = 1;
     req.batq_end_handle = 2;
 
-    rc = ble_att_read_type_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_type_req_write(buf, sizeof buf, &req);
     htole16(buf + BLE_ATT_READ_TYPE_REQ_BASE_SZ,
             BLE_ATT_UUID_CHARACTERISTIC);
 
@@ -1712,8 +1664,7 @@ TEST_CASE(ble_att_svr_test_read_type)
     req.batq_start_handle = 1;
     req.batq_end_handle = 10;
 
-    rc = ble_att_read_type_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_type_req_write(buf, sizeof buf, &req);
     htole16(buf + BLE_ATT_READ_TYPE_REQ_BASE_SZ,
             BLE_ATT_UUID_CHARACTERISTIC);
 
@@ -1736,8 +1687,7 @@ TEST_CASE(ble_att_svr_test_read_type)
     req.batq_start_handle = 11;
     req.batq_end_handle = 0xffff;
 
-    rc = ble_att_read_type_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_type_req_write(buf, sizeof buf, &req);
     htole16(buf + BLE_ATT_READ_TYPE_REQ_BASE_SZ,
             BLE_ATT_UUID_CHARACTERISTIC);
 
@@ -1755,8 +1705,7 @@ TEST_CASE(ble_att_svr_test_read_type)
     req.batq_start_handle = 13;
     req.batq_end_handle = 0xffff;
 
-    rc = ble_att_read_type_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_type_req_write(buf, sizeof buf, &req);
     htole16(buf + BLE_ATT_READ_TYPE_REQ_BASE_SZ,
             BLE_ATT_UUID_CHARACTERISTIC);
 
@@ -1774,8 +1723,7 @@ TEST_CASE(ble_att_svr_test_read_type)
     req.batq_start_handle = 15;
     req.batq_end_handle = 0xffff;
 
-    rc = ble_att_read_type_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_type_req_write(buf, sizeof buf, &req);
     htole16(buf + BLE_ATT_READ_TYPE_REQ_BASE_SZ,
             BLE_ATT_UUID_CHARACTERISTIC);
 
@@ -1810,8 +1758,7 @@ TEST_CASE(ble_att_svr_test_read_group_type)
     req.bagq_start_handle = 0;
     req.bagq_end_handle = 0;
 
-    rc = ble_att_read_group_type_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_group_type_req_write(buf, sizeof buf, &req);
     htole16(buf + BLE_ATT_READ_GROUP_TYPE_REQ_BASE_SZ,
             BLE_ATT_UUID_PRIMARY_SERVICE);
 
@@ -1825,8 +1772,7 @@ TEST_CASE(ble_att_svr_test_read_group_type)
     req.bagq_start_handle = 101;
     req.bagq_end_handle = 100;
 
-    rc = ble_att_read_group_type_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_group_type_req_write(buf, sizeof buf, &req);
     htole16(buf + BLE_ATT_READ_GROUP_TYPE_REQ_BASE_SZ,
             BLE_ATT_UUID_PRIMARY_SERVICE);
 
@@ -1840,8 +1786,7 @@ TEST_CASE(ble_att_svr_test_read_group_type)
     req.bagq_start_handle = 110;
     req.bagq_end_handle = 150;
 
-    rc = ble_att_read_group_type_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_group_type_req_write(buf, sizeof buf, &req);
     htole16(buf + BLE_ATT_READ_GROUP_TYPE_REQ_BASE_SZ, 0x1234);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
@@ -1854,8 +1799,7 @@ TEST_CASE(ble_att_svr_test_read_group_type)
     req.bagq_start_handle = 1;
     req.bagq_end_handle = 0xffff;
 
-    rc = ble_att_read_group_type_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_group_type_req_write(buf, sizeof buf, &req);
     htole16(buf + BLE_ATT_READ_GROUP_TYPE_REQ_BASE_SZ,
             BLE_ATT_UUID_PRIMARY_SERVICE);
 
@@ -1870,8 +1814,7 @@ TEST_CASE(ble_att_svr_test_read_group_type)
     req.bagq_start_handle = 200;
     req.bagq_end_handle = 300;
 
-    rc = ble_att_read_group_type_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_group_type_req_write(buf, sizeof buf, &req);
     htole16(buf + BLE_ATT_READ_GROUP_TYPE_REQ_BASE_SZ,
             BLE_ATT_UUID_PRIMARY_SERVICE);
 
@@ -1885,8 +1828,7 @@ TEST_CASE(ble_att_svr_test_read_group_type)
     req.bagq_start_handle = 1;
     req.bagq_end_handle = 5;
 
-    rc = ble_att_read_group_type_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_group_type_req_write(buf, sizeof buf, &req);
     htole16(buf + BLE_ATT_READ_GROUP_TYPE_REQ_BASE_SZ,
             BLE_ATT_UUID_PRIMARY_SERVICE);
 
@@ -1905,8 +1847,7 @@ TEST_CASE(ble_att_svr_test_read_group_type)
     req.bagq_start_handle = 1;
     req.bagq_end_handle = 10;
 
-    rc = ble_att_read_group_type_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_group_type_req_write(buf, sizeof buf, &req);
     htole16(buf + BLE_ATT_READ_GROUP_TYPE_REQ_BASE_SZ,
             BLE_ATT_UUID_PRIMARY_SERVICE);
 
@@ -1929,8 +1870,7 @@ TEST_CASE(ble_att_svr_test_read_group_type)
     req.bagq_start_handle = 1;
     req.bagq_end_handle = 100;
 
-    rc = ble_att_read_group_type_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_group_type_req_write(buf, sizeof buf, &req);
     htole16(buf + BLE_ATT_READ_GROUP_TYPE_REQ_BASE_SZ,
             BLE_ATT_UUID_PRIMARY_SERVICE);
 
@@ -1953,8 +1893,7 @@ TEST_CASE(ble_att_svr_test_read_group_type)
     req.bagq_start_handle = 11;
     req.bagq_end_handle = 100;
 
-    rc = ble_att_read_group_type_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_group_type_req_write(buf, sizeof buf, &req);
     htole16(buf + BLE_ATT_READ_GROUP_TYPE_REQ_BASE_SZ,
             BLE_ATT_UUID_PRIMARY_SERVICE);
 
@@ -2152,6 +2091,7 @@ TEST_SUITE(ble_att_svr_suite)
 int
 ble_att_svr_test_all(void)
 {
+    tu_config.tc_system_assert = 1;
     ble_att_svr_suite();
 
     return tu_any_failed;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2fef21d6/net/nimble/host/src/test/ble_gatt_disc_c_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_gatt_disc_c_test.c b/net/nimble/host/src/test/ble_gatt_disc_c_test.c
index 3f24586..d2d9acb 100644
--- a/net/nimble/host/src/test/ble_gatt_disc_c_test.c
+++ b/net/nimble/host/src/test/ble_gatt_disc_c_test.c
@@ -72,8 +72,7 @@ ble_gatt_disc_c_test_misc_rx_rsp_once(
                          BLE_GATT_CHR_DECL_SZ_128;
     }
 
-    rc = ble_att_read_type_rsp_write(buf, BLE_ATT_READ_TYPE_RSP_BASE_SZ, &rsp);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_att_read_type_rsp_write(buf, BLE_ATT_READ_TYPE_RSP_BASE_SZ, &rsp);
 
     off = BLE_ATT_READ_TYPE_RSP_BASE_SZ;
     for (i = 0; ; i++) {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2fef21d6/net/nimble/host/src/test/ble_gatt_disc_d_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_gatt_disc_d_test.c b/net/nimble/host/src/test/ble_gatt_disc_d_test.c
index 3a40864..a3c76a5 100644
--- a/net/nimble/host/src/test/ble_gatt_disc_d_test.c
+++ b/net/nimble/host/src/test/ble_gatt_disc_d_test.c
@@ -71,8 +71,7 @@ ble_gatt_disc_d_test_misc_rx_rsp_once(
         rsp.bafp_format = BLE_ATT_FIND_INFO_RSP_FORMAT_128BIT;
     }
 
-    rc = ble_att_find_info_rsp_write(buf, BLE_ATT_FIND_INFO_RSP_BASE_SZ, &rsp);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_att_find_info_rsp_write(buf, BLE_ATT_FIND_INFO_RSP_BASE_SZ, &rsp);
 
     off = BLE_ATT_FIND_INFO_RSP_BASE_SZ;
     for (i = 0; ; i++) {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2fef21d6/net/nimble/host/src/test/ble_gatt_disc_s_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_gatt_disc_s_test.c b/net/nimble/host/src/test/ble_gatt_disc_s_test.c
index d8e66c5..533340a 100644
--- a/net/nimble/host/src/test/ble_gatt_disc_s_test.c
+++ b/net/nimble/host/src/test/ble_gatt_disc_s_test.c
@@ -71,9 +71,8 @@ ble_gatt_disc_s_test_misc_rx_all_rsp_once(
     ble_hs_test_util_tx_all();
 
     rsp.bagp_length = ble_gatt_disc_s_test_misc_svc_length(services);
-    rc = ble_att_read_group_type_rsp_write(
-        buf, BLE_ATT_READ_GROUP_TYPE_RSP_BASE_SZ, &rsp);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_att_read_group_type_rsp_write(buf, BLE_ATT_READ_GROUP_TYPE_RSP_BASE_SZ,
+                                      &rsp);
 
     off = BLE_ATT_READ_GROUP_TYPE_RSP_BASE_SZ;
     for (i = 0; ; i++) {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2fef21d6/net/nimble/host/src/test/ble_gatt_find_s_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_gatt_find_s_test.c b/net/nimble/host/src/test/ble_gatt_find_s_test.c
index d68135d..24b2dcc 100644
--- a/net/nimble/host/src/test/ble_gatt_find_s_test.c
+++ b/net/nimble/host/src/test/ble_gatt_find_s_test.c
@@ -114,9 +114,7 @@ ble_gatt_find_s_test_misc_rx_read_type(
         return 0;
     }
 
-    rc = ble_att_read_type_rsp_write(buf + 0, BLE_ATT_READ_TYPE_RSP_BASE_SZ,
-                                     &rsp);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_att_read_type_rsp_write(buf + 0, BLE_ATT_READ_TYPE_RSP_BASE_SZ, &rsp);
 
     chan = ble_hs_conn_chan_find(conn, BLE_L2CAP_CID_ATT);
     TEST_ASSERT_FATAL(chan != NULL);
@@ -151,7 +149,6 @@ ble_gatt_find_s_test_misc_verify_tx_read_type(uint16_t start_handle,
     struct ble_att_read_type_req req;
     struct os_mbuf *om;
     uint16_t uuid16;
-    int rc;
 
     ble_hs_test_util_tx_all();
 
@@ -161,8 +158,7 @@ ble_gatt_find_s_test_misc_verify_tx_read_type(uint16_t start_handle,
                         OS_MBUF_PKTLEN(ble_hs_test_util_prev_tx));
     TEST_ASSERT_FATAL(om != NULL);
 
-    rc = ble_att_read_type_req_parse(om->om_data, om->om_len, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_type_req_parse(om->om_data, om->om_len, &req);
 
     TEST_ASSERT(req.batq_start_handle == start_handle);
     TEST_ASSERT(req.batq_end_handle == end_handle);
@@ -176,7 +172,6 @@ ble_gatt_find_s_test_misc_verify_tx_read(uint16_t handle)
 {
     struct ble_att_read_req req;
     struct os_mbuf *om;
-    int rc;
 
     ble_hs_test_util_tx_all();
 
@@ -186,8 +181,7 @@ ble_gatt_find_s_test_misc_verify_tx_read(uint16_t handle)
                         OS_MBUF_PKTLEN(ble_hs_test_util_prev_tx));
     TEST_ASSERT_FATAL(om != NULL);
 
-    rc = ble_att_read_req_parse(om->om_data, om->om_len, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_read_req_parse(om->om_data, om->om_len, &req);
 
     TEST_ASSERT(req.barq_handle == handle);
     TEST_ASSERT(om->om_len == BLE_ATT_READ_REQ_SZ);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2fef21d6/net/nimble/host/src/test/ble_gatt_read_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_gatt_read_test.c b/net/nimble/host/src/test/ble_gatt_read_test.c
index 44dcd84..47392fb 100644
--- a/net/nimble/host/src/test/ble_gatt_read_test.c
+++ b/net/nimble/host/src/test/ble_gatt_read_test.c
@@ -254,8 +254,7 @@ ble_gatt_read_test_misc_uuid_rx_rsp_good(struct ble_hs_conn *conn,
     ble_hs_test_util_tx_all();
 
     rsp.batp_length = 2 + attrs[0].value_len;
-    rc = ble_att_read_type_rsp_write(buf, sizeof buf, &rsp);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_att_read_type_rsp_write(buf, sizeof buf, &rsp);
 
     prev_len = 0;
     off = BLE_ATT_READ_TYPE_RSP_BASE_SZ;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2fef21d6/net/nimble/host/src/test/ble_gatt_write_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_gatt_write_test.c b/net/nimble/host/src/test/ble_gatt_write_test.c
index 4444053..3c17114 100644
--- a/net/nimble/host/src/test/ble_gatt_write_test.c
+++ b/net/nimble/host/src/test/ble_gatt_write_test.c
@@ -105,8 +105,7 @@ ble_gatt_write_test_rx_prep_rsp(struct ble_hs_conn *conn, uint16_t attr_handle,
 
     rsp.bapc_handle = attr_handle;
     rsp.bapc_offset = offset;
-    rc = ble_att_prep_write_rsp_write(buf, sizeof buf, &rsp);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_att_prep_write_rsp_write(buf, sizeof buf, &rsp);
 
     memcpy(buf + BLE_ATT_PREP_WRITE_CMD_BASE_SZ, attr_data, attr_data_len);
 
@@ -364,7 +363,6 @@ TEST_CASE(ble_gatt_write_test_rsp)
 {
     struct ble_hs_conn *conn;
     int attr_len;
-    int rc;
 
     ble_gatt_write_test_init();
 
@@ -372,9 +370,8 @@ TEST_CASE(ble_gatt_write_test_rsp)
                                         NULL, NULL);
 
     attr_len = 4;
-    rc = ble_gattc_write(2, 100, ble_gatt_write_test_attr_value,
-                         attr_len, ble_gatt_write_test_cb_good, &attr_len);
-    TEST_ASSERT(rc == 0);
+    ble_gattc_write(2, 100, ble_gatt_write_test_attr_value, attr_len,
+                    ble_gatt_write_test_cb_good, &attr_len);
 
     /* Send the pending ATT Write Command. */
     ble_hs_test_util_tx_all();

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2fef21d6/net/nimble/host/src/test/ble_gatts_notify_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_gatts_notify_test.c b/net/nimble/host/src/test/ble_gatts_notify_test.c
index f2d9bd1..26fc55c 100644
--- a/net/nimble/host/src/test/ble_gatts_notify_test.c
+++ b/net/nimble/host/src/test/ble_gatts_notify_test.c
@@ -100,8 +100,7 @@ ble_gatts_notify_test_misc_enable_notify(struct ble_hs_conn *conn,
     int rc;
 
     req.bawq_handle = chr_def_handle + 2;
-    rc = ble_att_write_req_write(buf, sizeof buf, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_write_req_write(buf, sizeof buf, &req);
 
     htole16(buf + BLE_ATT_WRITE_REQ_BASE_SZ, flags);
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
@@ -166,8 +165,7 @@ ble_gatts_notify_test_misc_rx_indicate_rsp(struct ble_hs_conn *conn,
     uint8_t buf[BLE_ATT_INDICATE_RSP_SZ];
     int rc;
 
-    rc = ble_att_indicate_rsp_write(buf, sizeof buf);
-    TEST_ASSERT(rc == 0);
+    ble_att_indicate_rsp_write(buf, sizeof buf);
 
     rc = ble_hs_test_util_l2cap_rx_payload_flat(conn, chan, buf, sizeof buf);
     TEST_ASSERT(rc == 0);
@@ -190,8 +188,7 @@ ble_gatts_notify_test_misc_verify_tx_n(struct ble_l2cap_chan *chan,
     rc = os_mbuf_copydata(ble_hs_test_util_prev_tx, 0, req_len, buf);
     TEST_ASSERT_FATAL(rc == 0);
 
-    rc = ble_att_notify_req_parse(buf, req_len, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_notify_req_parse(buf, req_len, &req);
 
     for (i = 0; i < attr_len; i++) {
         TEST_ASSERT(buf[BLE_ATT_NOTIFY_REQ_BASE_SZ + i] == attr_data[i]);
@@ -214,8 +211,7 @@ ble_gatts_notify_test_misc_verify_tx_i(struct ble_l2cap_chan *chan,
     rc = os_mbuf_copydata(ble_hs_test_util_prev_tx, 0, req_len, buf);
     TEST_ASSERT_FATAL(rc == 0);
 
-    rc = ble_att_indicate_req_parse(buf, req_len, &req);
-    TEST_ASSERT(rc == 0);
+    ble_att_indicate_req_parse(buf, req_len, &req);
 
     for (i = 0; i < attr_len; i++) {
         TEST_ASSERT(buf[BLE_ATT_INDICATE_REQ_BASE_SZ + i] == attr_data[i]);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2fef21d6/net/nimble/host/src/test/ble_hs_test_util.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_hs_test_util.c b/net/nimble/host/src/test/ble_hs_test_util.c
index 63307b1..d2f179c 100644
--- a/net/nimble/host/src/test/ble_hs_test_util.c
+++ b/net/nimble/host/src/test/ble_hs_test_util.c
@@ -19,7 +19,6 @@
 
 #include <string.h>
 #include <errno.h>
-#include <assert.h>
 #include "stats/stats.h"
 #include "testutil/testutil.h"
 #include "nimble/ble.h"
@@ -165,6 +164,20 @@ ble_hs_test_util_rx_le_ack(uint16_t ocf, uint8_t status)
 }
 
 int
+ble_hs_test_util_l2cap_rx_first_frag(struct ble_hs_conn *conn, uint16_t cid,
+                                     struct hci_data_hdr *hci_hdr,
+                                     struct os_mbuf *om)
+{
+    int rc;
+
+    om = ble_l2cap_prepend_hdr(om, cid, OS_MBUF_PKTLEN(om));
+    TEST_ASSERT_FATAL(om != NULL);
+
+    rc = ble_hs_test_util_l2cap_rx(conn, hci_hdr, om);
+    return rc;
+}
+
+int
 ble_hs_test_util_l2cap_rx(struct ble_hs_conn *conn,
                           struct hci_data_hdr *hci_hdr,
                           struct os_mbuf *om)
@@ -175,8 +188,8 @@ ble_hs_test_util_l2cap_rx(struct ble_hs_conn *conn,
 
     rc = ble_l2cap_rx(conn, hci_hdr, om, &rx_cb, &rx_buf);
     if (rc == 0) {
-        assert(rx_cb != NULL);
-        assert(rx_buf != NULL);
+        TEST_ASSERT_FATAL(rx_cb != NULL);
+        TEST_ASSERT_FATAL(rx_buf != NULL);
         rc = rx_cb(conn->bhc_handle, &rx_buf);
         os_mbuf_free_chain(rx_buf);
     } else if (rc == BLE_HS_EAGAIN) {
@@ -199,20 +212,16 @@ ble_hs_test_util_l2cap_rx_payload_flat(struct ble_hs_conn *conn,
     om = ble_hs_misc_pkthdr();
     TEST_ASSERT_FATAL(om != NULL);
 
-    om->om_data += BLE_L2CAP_HDR_SZ;
-
     rc = os_mbuf_append(om, data, len);
     TEST_ASSERT_FATAL(rc == 0);
 
-    om = ble_l2cap_prepend_hdr(om, chan->blc_cid, OS_MBUF_PKTLEN(om));
-    TEST_ASSERT_FATAL(om != NULL);
-
     hci_hdr.hdh_handle_pb_bc =
         host_hci_handle_pb_bc_join(conn->bhc_handle,
                                    BLE_HCI_PB_FIRST_FLUSH, 0);
     hci_hdr.hdh_len = OS_MBUF_PKTHDR(om)->omp_len;
 
-    rc = ble_hs_test_util_l2cap_rx(conn, &hci_hdr, om);
+    rc = ble_hs_test_util_l2cap_rx_first_frag(conn, chan->blc_cid, &hci_hdr,
+                                              om);
     return rc;
 }
 
@@ -229,8 +238,7 @@ ble_hs_test_util_rx_att_err_rsp(struct ble_hs_conn *conn, uint8_t req_op,
     rsp.baep_handle = err_handle;
     rsp.baep_error_code = error_code;
 
-    rc = ble_att_error_rsp_write(buf, sizeof buf, &rsp);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_att_error_rsp_write(buf, sizeof buf, &rsp);
 
     chan = ble_hs_conn_chan_find(conn, BLE_L2CAP_CID_ATT);
     TEST_ASSERT_FATAL(chan != NULL);
@@ -276,7 +284,7 @@ ble_hs_test_util_rx_num_completed_pkts_event(
     for (entry = entries; entry->handle_id != 0; entry++) {
         num_entries++;
     }
-    assert(num_entries <= UINT8_MAX);
+    TEST_ASSERT_FATAL(num_entries <= UINT8_MAX);
 
     buf[0] = BLE_HCI_EVCODE_NUM_COMP_PKTS;
     buf[2] = num_entries;
@@ -428,16 +436,16 @@ ble_hs_test_util_init(void)
                          BLE_HS_TEST_UTIL_MEMBLOCK_SIZE,
                          ble_hs_test_util_mbuf_mpool_data, 
                          "ble_hs_test_util_mbuf_data");
-    assert(rc == 0);
+    TEST_ASSERT_FATAL(rc == 0);
 
     rc = os_mbuf_pool_init(&ble_hs_test_util_mbuf_pool,
                            &ble_hs_test_util_mbuf_mpool,
                            BLE_HS_TEST_UTIL_MEMBLOCK_SIZE,
                            BLE_HS_TEST_UTIL_NUM_MBUFS);
-    assert(rc == 0);
+    TEST_ASSERT_FATAL(rc == 0);
 
     rc = os_msys_register(&ble_hs_test_util_mbuf_pool);
-    assert(rc == 0);
+    TEST_ASSERT_FATAL(rc == 0);
 
     /* Don't limit a connection's ability to transmit; simplify tests. */
     ble_hs_cfg.max_outstanding_pkts_per_conn = 0;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2fef21d6/net/nimble/host/src/test/ble_hs_test_util.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_hs_test_util.h b/net/nimble/host/src/test/ble_hs_test_util.h
index 8a97ab8..d1d696e 100644
--- a/net/nimble/host/src/test/ble_hs_test_util.h
+++ b/net/nimble/host/src/test/ble_hs_test_util.h
@@ -48,6 +48,10 @@ void ble_hs_test_util_rx_ack(uint16_t opcode, uint8_t status);
 void ble_hs_test_util_rx_ack_param(uint16_t opcode, uint8_t status,
                                    void *param, int param_len);
 void ble_hs_test_util_rx_le_ack(uint16_t ocf, uint8_t status);
+int ble_hs_test_util_l2cap_rx_first_frag(struct ble_hs_conn *conn,
+                                         uint16_t cid,
+                                         struct hci_data_hdr *hci_hdr,
+                                         struct os_mbuf *om);
 int ble_hs_test_util_l2cap_rx(struct ble_hs_conn *conn,
                               struct hci_data_hdr *hci_hdr,
                               struct os_mbuf *om);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2fef21d6/net/nimble/host/src/test/ble_l2cap_sm_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_l2cap_sm_test.c b/net/nimble/host/src/test/ble_l2cap_sm_test.c
index 113b697..f29675c 100644
--- a/net/nimble/host/src/test/ble_l2cap_sm_test.c
+++ b/net/nimble/host/src/test/ble_l2cap_sm_test.c
@@ -90,17 +90,14 @@ ble_l2cap_sm_test_util_rx_pair_cmd(struct ble_hs_conn *conn, uint8_t op,
 
     payload_len = BLE_L2CAP_SM_HDR_SZ + BLE_L2CAP_SM_PAIR_CMD_SZ;
 
-    om = ble_l2cap_prepend_hdr(om, BLE_L2CAP_CID_SM, payload_len);
-    TEST_ASSERT_FATAL(om != NULL);
-
     v = os_mbuf_extend(om, payload_len);
     TEST_ASSERT_FATAL(v != NULL);
 
-    rc = ble_l2cap_sm_pair_cmd_write(v, payload_len,
-                                     op == BLE_L2CAP_SM_OP_PAIR_REQ, cmd);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_l2cap_sm_pair_cmd_write(v, payload_len, op == BLE_L2CAP_SM_OP_PAIR_REQ,
+                                cmd);
 
-    rc = ble_hs_test_util_l2cap_rx(conn, &hci_hdr, om);
+    rc = ble_hs_test_util_l2cap_rx_first_frag(conn, BLE_L2CAP_CID_SM, &hci_hdr,
+                                              om);
     TEST_ASSERT_FATAL(rc == 0);
 }
 
@@ -137,16 +134,13 @@ ble_l2cap_sm_test_util_rx_confirm(struct ble_hs_conn *conn,
 
     payload_len = BLE_L2CAP_SM_HDR_SZ + BLE_L2CAP_SM_PAIR_CONFIRM_SZ;
 
-    om = ble_l2cap_prepend_hdr(om, BLE_L2CAP_CID_SM, payload_len);
-    TEST_ASSERT_FATAL(om != NULL);
-
     v = os_mbuf_extend(om, payload_len);
     TEST_ASSERT_FATAL(v != NULL);
 
-    rc = ble_l2cap_sm_pair_confirm_write(v, payload_len, cmd);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_l2cap_sm_pair_confirm_write(v, payload_len, cmd);
 
-    rc = ble_hs_test_util_l2cap_rx(conn, &hci_hdr, om);
+    rc = ble_hs_test_util_l2cap_rx_first_frag(conn, BLE_L2CAP_CID_SM, &hci_hdr,
+                                              om);
     TEST_ASSERT_FATAL(rc == 0);
 }
 
@@ -169,16 +163,13 @@ ble_l2cap_sm_test_util_rx_random(struct ble_hs_conn *conn,
 
     payload_len = BLE_L2CAP_SM_HDR_SZ + BLE_L2CAP_SM_PAIR_RANDOM_SZ;
 
-    om = ble_l2cap_prepend_hdr(om, BLE_L2CAP_CID_SM, payload_len);
-    TEST_ASSERT_FATAL(om != NULL);
-
     v = os_mbuf_extend(om, payload_len);
     TEST_ASSERT_FATAL(v != NULL);
 
-    rc = ble_l2cap_sm_pair_random_write(v, payload_len, cmd);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_l2cap_sm_pair_random_write(v, payload_len, cmd);
 
-    rc = ble_hs_test_util_l2cap_rx(conn, &hci_hdr, om);
+    rc = ble_hs_test_util_l2cap_rx_first_frag(conn, BLE_L2CAP_CID_SM, &hci_hdr,
+                                              om);
     TEST_ASSERT_FATAL(rc == 0);
 }
 
@@ -201,14 +192,12 @@ ble_l2cap_sm_test_util_verify_tx_pair_cmd(
     struct ble_l2cap_sm_pair_cmd *exp_cmd)
 {
     struct ble_l2cap_sm_pair_cmd cmd;
-    int rc;
 
     ble_l2cap_sm_test_util_verify_tx_hdr(op, BLE_L2CAP_SM_PAIR_CMD_SZ);
 
-    rc = ble_l2cap_sm_pair_cmd_parse(ble_hs_test_util_prev_tx->om_data,
-                                     ble_hs_test_util_prev_tx->om_len,
-                                     &cmd);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_l2cap_sm_pair_cmd_parse(ble_hs_test_util_prev_tx->om_data,
+                                ble_hs_test_util_prev_tx->om_len,
+                                &cmd);
 
     TEST_ASSERT(cmd.io_cap == exp_cmd->io_cap);
     TEST_ASSERT(cmd.oob_data_flag == exp_cmd->oob_data_flag);
@@ -239,15 +228,13 @@ ble_l2cap_sm_test_util_verify_tx_pair_confirm(
     struct ble_l2cap_sm_pair_confirm *exp_cmd)
 {
     struct ble_l2cap_sm_pair_confirm cmd;
-    int rc;
 
     ble_l2cap_sm_test_util_verify_tx_hdr(BLE_L2CAP_SM_OP_PAIR_CONFIRM,
                                          BLE_L2CAP_SM_PAIR_CONFIRM_SZ);
 
-    rc = ble_l2cap_sm_pair_confirm_parse(ble_hs_test_util_prev_tx->om_data,
-                                         ble_hs_test_util_prev_tx->om_len,
-                                         &cmd);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_l2cap_sm_pair_confirm_parse(ble_hs_test_util_prev_tx->om_data,
+                                    ble_hs_test_util_prev_tx->om_len,
+                                    &cmd);
 
     TEST_ASSERT(memcmp(cmd.value, exp_cmd->value, 16) == 0);
 }
@@ -257,15 +244,13 @@ ble_l2cap_sm_test_util_verify_tx_pair_random(
     struct ble_l2cap_sm_pair_random *exp_cmd)
 {
     struct ble_l2cap_sm_pair_random cmd;
-    int rc;
 
     ble_l2cap_sm_test_util_verify_tx_hdr(BLE_L2CAP_SM_OP_PAIR_RANDOM,
                                          BLE_L2CAP_SM_PAIR_RANDOM_SZ);
 
-    rc = ble_l2cap_sm_pair_random_parse(ble_hs_test_util_prev_tx->om_data,
-                                         ble_hs_test_util_prev_tx->om_len,
-                                         &cmd);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_l2cap_sm_pair_random_parse(ble_hs_test_util_prev_tx->om_data,
+                                   ble_hs_test_util_prev_tx->om_len,
+                                   &cmd);
 
     TEST_ASSERT(memcmp(cmd.value, exp_cmd->value, 16) == 0);
 }
@@ -275,15 +260,13 @@ ble_l2cap_sm_test_util_verify_tx_pair_fail(
     struct ble_l2cap_sm_pair_fail *exp_cmd)
 {
     struct ble_l2cap_sm_pair_fail cmd;
-    int rc;
 
     ble_l2cap_sm_test_util_verify_tx_hdr(BLE_L2CAP_SM_OP_PAIR_FAIL,
                                          BLE_L2CAP_SM_PAIR_FAIL_SZ);
 
-    rc = ble_l2cap_sm_pair_fail_parse(ble_hs_test_util_prev_tx->om_data,
-                                      ble_hs_test_util_prev_tx->om_len,
-                                      &cmd);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_l2cap_sm_pair_fail_parse(ble_hs_test_util_prev_tx->om_data,
+                                 ble_hs_test_util_prev_tx->om_len,
+                                 &cmd);
 
     TEST_ASSERT(cmd.reason == exp_cmd->reason);
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2fef21d6/net/nimble/host/src/test/ble_l2cap_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/test/ble_l2cap_test.c b/net/nimble/host/src/test/ble_l2cap_test.c
index 106b757..6ace301 100644
--- a/net/nimble/host/src/test/ble_l2cap_test.c
+++ b/net/nimble/host/src/test/ble_l2cap_test.c
@@ -54,7 +54,6 @@ ble_l2cap_test_util_rx_update_req(struct ble_hs_conn *conn, uint8_t id,
                                   struct ble_l2cap_sig_update_params *params)
 {
     struct ble_l2cap_sig_update_req req;
-    struct ble_l2cap_sig_hdr sig_hdr;
     struct hci_data_hdr hci_hdr;
     struct os_mbuf *om;
     void *v;
@@ -64,30 +63,18 @@ ble_l2cap_test_util_rx_update_req(struct ble_hs_conn *conn, uint8_t id,
         2, BLE_HCI_PB_FIRST_FLUSH,
         BLE_L2CAP_HDR_SZ + BLE_L2CAP_SIG_HDR_SZ + BLE_L2CAP_SIG_UPDATE_REQ_SZ);
 
-    om = ble_hs_misc_pkthdr();
-    TEST_ASSERT_FATAL(om != NULL);
-
-    om = ble_l2cap_prepend_hdr(om, BLE_L2CAP_CID_SIG,
-                               BLE_L2CAP_SIG_HDR_SZ +
-                                   BLE_L2CAP_SIG_UPDATE_REQ_SZ);
-    TEST_ASSERT_FATAL(om != NULL);
+    rc = ble_l2cap_sig_init_cmd(BLE_L2CAP_SIG_OP_UPDATE_REQ, id,
+                                BLE_L2CAP_SIG_UPDATE_REQ_SZ, &om, &v);
+    TEST_ASSERT_FATAL(rc == 0);
 
-    sig_hdr.op = BLE_L2CAP_SIG_OP_UPDATE_REQ;
-    sig_hdr.identifier = id;
-    sig_hdr.length = BLE_L2CAP_SIG_UPDATE_REQ_SZ;
     req.itvl_min = params->itvl_min;
     req.itvl_max = params->itvl_max;
     req.slave_latency = params->slave_latency;
     req.timeout_multiplier = params->timeout_multiplier;
+    ble_l2cap_sig_update_req_write(v, BLE_L2CAP_SIG_UPDATE_REQ_SZ, &req);
 
-    v = os_mbuf_extend(om, BLE_L2CAP_SIG_HDR_SZ + BLE_L2CAP_SIG_UPDATE_REQ_SZ);
-    TEST_ASSERT_FATAL(v != NULL);
-
-    rc = ble_l2cap_sig_update_req_write(
-        v, BLE_L2CAP_SIG_HDR_SZ + BLE_L2CAP_SIG_UPDATE_REQ_SZ, &sig_hdr, &req);
-    TEST_ASSERT_FATAL(rc == 0);
-
-    rc = ble_hs_test_util_l2cap_rx(conn, &hci_hdr, om);
+    rc = ble_hs_test_util_l2cap_rx_first_frag(conn, BLE_L2CAP_CID_SIG,
+                                              &hci_hdr, om);
     TEST_ASSERT_FATAL(rc == 0);
 }
 
@@ -96,7 +83,6 @@ ble_l2cap_test_util_rx_update_rsp(struct ble_hs_conn *conn,
                                   uint8_t id, uint16_t result)
 {
     struct ble_l2cap_sig_update_rsp rsp;
-    struct ble_l2cap_sig_hdr sig_hdr;
     struct hci_data_hdr hci_hdr;
     struct os_mbuf *om;
     void *v;
@@ -106,27 +92,15 @@ ble_l2cap_test_util_rx_update_rsp(struct ble_hs_conn *conn,
         2, BLE_HCI_PB_FIRST_FLUSH,
         BLE_L2CAP_HDR_SZ + BLE_L2CAP_SIG_HDR_SZ + BLE_L2CAP_SIG_UPDATE_RSP_SZ);
 
-    om = ble_hs_misc_pkthdr();
-    TEST_ASSERT_FATAL(om != NULL);
-
-    om = ble_l2cap_prepend_hdr(om, BLE_L2CAP_CID_SIG,
-                               BLE_L2CAP_SIG_HDR_SZ +
-                                   BLE_L2CAP_SIG_UPDATE_RSP_SZ);
-    TEST_ASSERT_FATAL(om != NULL);
+    rc = ble_l2cap_sig_init_cmd(BLE_L2CAP_SIG_OP_UPDATE_RSP, id,
+                                BLE_L2CAP_SIG_UPDATE_RSP_SZ, &om, &v);
+    TEST_ASSERT_FATAL(rc == 0);
 
-    sig_hdr.op = BLE_L2CAP_SIG_OP_UPDATE_RSP;
-    sig_hdr.identifier = id;
-    sig_hdr.length = BLE_L2CAP_SIG_UPDATE_RSP_SZ;
     rsp.result = result;
+    ble_l2cap_sig_update_rsp_write(v, BLE_L2CAP_SIG_UPDATE_RSP_SZ, &rsp);
 
-    v = os_mbuf_extend(om, BLE_L2CAP_SIG_HDR_SZ + BLE_L2CAP_SIG_UPDATE_RSP_SZ);
-    TEST_ASSERT_FATAL(v != NULL);
-
-    rc = ble_l2cap_sig_update_rsp_write(
-        v, BLE_L2CAP_SIG_HDR_SZ + BLE_L2CAP_SIG_UPDATE_RSP_SZ, &sig_hdr, &rsp);
-    TEST_ASSERT_FATAL(rc == 0);
-
-    rc = ble_hs_test_util_l2cap_rx(conn, &hci_hdr, om);
+    rc = ble_hs_test_util_l2cap_rx_first_frag(conn, BLE_L2CAP_CID_SIG,
+                                              &hci_hdr, om);
     return rc;
 }
 
@@ -139,21 +113,19 @@ ble_l2cap_test_util_verify_tx_update_req(
 {
     struct ble_l2cap_sig_update_req req;
     struct ble_l2cap_sig_hdr hdr;
-    int rc;
 
     TEST_ASSERT_FATAL(ble_hs_test_util_prev_tx != NULL);
     TEST_ASSERT(OS_MBUF_PKTLEN(ble_hs_test_util_prev_tx) ==
                 BLE_L2CAP_SIG_HDR_SZ + BLE_L2CAP_SIG_UPDATE_REQ_SZ);
-    rc = ble_l2cap_sig_hdr_parse(ble_hs_test_util_prev_tx->om_data,
-                                 ble_hs_test_util_prev_tx->om_len, &hdr);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_l2cap_sig_hdr_parse(ble_hs_test_util_prev_tx->om_data,
+                            ble_hs_test_util_prev_tx->om_len, &hdr);
 
     ble_hs_test_util_prev_tx->om_data += BLE_L2CAP_SIG_HDR_SZ;
     ble_hs_test_util_prev_tx->om_len -= BLE_L2CAP_SIG_HDR_SZ;
 
-    rc = ble_l2cap_sig_update_req_parse(ble_hs_test_util_prev_tx->om_data,
-                                        ble_hs_test_util_prev_tx->om_len,
-                                        &req);
+    ble_l2cap_sig_update_req_parse(ble_hs_test_util_prev_tx->om_data,
+                                   ble_hs_test_util_prev_tx->om_len,
+                                   &req);
     TEST_ASSERT(hdr.op == BLE_L2CAP_SIG_OP_UPDATE_REQ);
     TEST_ASSERT(hdr.length == BLE_L2CAP_SIG_UPDATE_REQ_SZ);
     TEST_ASSERT(req.itvl_min == params->itvl_min);
@@ -169,21 +141,19 @@ ble_l2cap_test_util_verify_tx_update_rsp(uint8_t exp_id, uint16_t exp_result)
 {
     struct ble_l2cap_sig_update_rsp rsp;
     struct ble_l2cap_sig_hdr hdr;
-    int rc;
 
     TEST_ASSERT_FATAL(ble_hs_test_util_prev_tx != NULL);
     TEST_ASSERT(OS_MBUF_PKTLEN(ble_hs_test_util_prev_tx) ==
                 BLE_L2CAP_SIG_HDR_SZ + BLE_L2CAP_SIG_UPDATE_RSP_SZ);
-    rc = ble_l2cap_sig_hdr_parse(ble_hs_test_util_prev_tx->om_data,
-                                 ble_hs_test_util_prev_tx->om_len, &hdr);
-    TEST_ASSERT_FATAL(rc == 0);
+    ble_l2cap_sig_hdr_parse(ble_hs_test_util_prev_tx->om_data,
+                            ble_hs_test_util_prev_tx->om_len, &hdr);
 
     ble_hs_test_util_prev_tx->om_data += BLE_L2CAP_SIG_HDR_SZ;
     ble_hs_test_util_prev_tx->om_len -= BLE_L2CAP_SIG_HDR_SZ;
 
-    rc = ble_l2cap_sig_update_rsp_parse(ble_hs_test_util_prev_tx->om_data,
-                                        ble_hs_test_util_prev_tx->om_len,
-                                        &rsp);
+    ble_l2cap_sig_update_rsp_parse(ble_hs_test_util_prev_tx->om_data,
+                                   ble_hs_test_util_prev_tx->om_len,
+                                   &rsp);
     TEST_ASSERT(hdr.op == BLE_L2CAP_SIG_OP_UPDATE_RSP);
     TEST_ASSERT(hdr.identifier == exp_id);
     TEST_ASSERT(hdr.length == BLE_L2CAP_SIG_UPDATE_RSP_SZ);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2fef21d6/net/nimble/include/nimble/ble.h
----------------------------------------------------------------------
diff --git a/net/nimble/include/nimble/ble.h b/net/nimble/include/nimble/ble.h
index 0660c5b..27026fd 100644
--- a/net/nimble/include/nimble/ble.h
+++ b/net/nimble/include/nimble/ble.h
@@ -20,6 +20,7 @@
 #ifndef H_BLE_
 #define H_BLE_
 
+#include <inttypes.h>
 /* XXX: some or all of these should not be here */
 #include "os/os.h"
 


Mime
View raw message