[riot-notifications] [RIOT-OS/RIOT] tests: add nimble_l2cap test and benchmark applications (#11235)

Martine Lenders notifications at github.com
Tue Mar 26 20:12:21 CET 2019


miri64 requested changes on this pull request.

Code-wise it looks good (can't say much about the functionality though, but obviously it works). Some nit-picks about Makefiles and style though.

> +    do {
+        res = ble_l2cap_send(_coc, txd);
+    } while (res == BLE_HS_EBUSY);
+
+    if (res != 0) {
+        printf("# err: failed to send (%i)\n", res);
+        assert(0);
+    }
+}
+
+static int _cmd_inctest(int argc, char **argv)
+{
+    size_t step = 10;
+    size_t limit = APP_MTU;
+
+    if ((argc == 2) && strncmp(argv[1], "help", 4) == 0) {

parens missing

> +/* synchronization state */
+static thread_t *_main;
+static volatile uint32_t _last_rx_seq;
+
+/* BLE connection state */
+static uint16_t _handle = 0;
+static struct ble_l2cap_chan *_coc = NULL;
+
+/* buffer allocation */
+static os_membuf_t _coc_mem[OS_MEMPOOL_SIZE(MBUFCNT, MBUFSIZE)];
+static struct os_mempool _coc_mempool;
+static struct os_mbuf_pool _coc_mbuf_pool;
+static uint32_t _rxbuf[APP_MTU / 4];
+static uint32_t _txbuf[APP_MTU / 4];
+
+

Extra newline

> +                   (unsigned)_last_rx_seq);
+            assert(0);
+        }
+    }
+    time = (xtimer_now_usec() - time);
+    puts("# TEST COMPLETE");
+    printf("-> runtime: %ums\n", (unsigned)(time / 1000));
+    return 0;
+}
+
+static int _cmd_floodtest(int argc, char **argv)
+{
+    size_t pktsize = PKTSIZE_DEFAULT;
+    unsigned limit = FLOOD_DEFAULT;
+
+    if ((argc == 2) && strncmp(argv[1], "help", 4) == 0) {

parens missing

> +# Configure default and allowed boards
+BOARD ?= nrf52dk
+BOARD_WHITELIST := nrf52dk nrf52840dk
+
+# load the default test environment
+include ../Makefile.tests_common
+
+# RIOT modules used in for this test
+USEMODULE += xtimer
+USEMODULE += shell
+USEMODULE += shell_commands
+USEMODULE += ps
+USEMODULE += bluetil_ad
+
+# Get the shared NimBLE and test configuration from the backend server
+include $(CURDIR)/../nimble_l2cap_server/nimble.inc.mk

Better use `$(RIOTBASE)` here. I had problems with this construct in #11256.

> @@ -0,0 +1,21 @@
+# Configure default and allowed boards
+BOARD ?= nrf52dk
+BOARD_WHITELIST := nrf52dk nrf52840dk
+
+# load the default test environment
+include ../Makefile.tests_common
+
+# RIOT modules used in for this test
+USEMODULE += xtimer
+USEMODULE += bluetil_ad
+
+# Get the shared NimBLE and test configuration from the backend server
+include $(CURDIR)/../nimble_l2cap_server/nimble.inc.mk

Dito

> +/* BLE connection state */
+static uint16_t _handle = 0;
+static struct ble_l2cap_chan *_coc = NULL;
+
+/* buffer allocation */
+static os_membuf_t _coc_mem[OS_MEMPOOL_SIZE(MBUFCNT, MBUFSIZE)];
+static struct os_mempool _coc_mempool;
+static struct os_mbuf_pool _coc_mbuf_pool;
+static uint32_t _rxbuf[APP_MTU / 4];
+
+/* safe AD fields */
+static uint8_t _ad_buf[BLE_HS_ADV_MAX_SZ];
+static bluetil_ad_t _ad;
+static struct ble_gap_adv_params _adv_params = { 0 };
+
+

Extra new-line

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11235#pullrequestreview-219104085
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190326/ca44402e/attachment-0001.html>


More information about the notifications mailing list