> +/* Create random valid ethernet packets */
> +static int
> +test_mbuf_setup_burst(struct rte_mbuf **bufs, unsigned int burst_size)
> +{
> + unsigned int i;
> +
> + if (rte_pktmbuf_alloc_bulk(mp, bufs, burst_size) != 0)
> + return -1;
> +
> + for (i = 0; i < burst_size; i++) {
> + struct rte_mbuf *m = bufs[i];
> + uint16_t len;
> +
> + /* Choose random length between ether min and available space */
> + len = rte_rand_max(rte_pktmbuf_tailroom(m) - RTE_ETHER_MIN_LEN)
Nit: could technically use rte_pktmbuf_tailroom(m) - RTE_ETHER_MIN_LEN + 1.
> + + RTE_ETHER_MIN_LEN;
> + m->data_len = len;
> + m->buf_len = len;
Not sure why we are changing buf_len here.
> + }
> + return 0;
> +}
Would still be cool to verify non-standard data_off.
// snip
> +/*
> + * Test: MAC address operations
> + */
> +static int
> +test_null_mac_addr(void)
> +{
> + struct rte_ether_addr mac_addr;
> + struct rte_ether_addr new_mac = {
> + .addr_bytes = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55}
> + };
> + int ret;
> +
> + /* Get current MAC address */
> + ret = rte_eth_macaddr_get(port_id, &mac_addr);
> + TEST_ASSERT(ret == 0, "Failed to get MAC address");
> +
> + /* Set new MAC address */
> + ret = rte_eth_dev_default_mac_addr_set(port_id, &new_mac);
> + TEST_ASSERT(ret == 0, "Failed to set MAC address");
> +
Still not checking that it actually does something.
> + return TEST_SUCCESS;
> +}
I still wish the test was more behavior- and less implementation-based.
It almost feels like it works around existing bugs in the module now.
However I agree that no tests whatsoever is probably worse, therefore
Acked-by: Marat Khalili <[email protected]>