On Thu, Aug 01, 2024 at 12:04:42PM -0700, Stephen Hemminger wrote: > Some tests for new packet dissector. > > Signed-off-by: Stephen Hemminger <step...@networkplumber.org> > --- > app/test/meson.build | 1 + > app/test/test_dissect.c | 245 ++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 246 insertions(+) > create mode 100644 app/test/test_dissect.c > > diff --git a/app/test/meson.build b/app/test/meson.build > index e29258e6ec..9cd2051320 100644 > --- a/app/test/meson.build > +++ b/app/test/meson.build > @@ -62,6 +62,7 @@ source_file_deps = { > 'test_debug.c': [], > 'test_devargs.c': ['kvargs'], > 'test_dispatcher.c': ['dispatcher'], > + 'test_dissect.c': ['net'], > 'test_distributor.c': ['distributor'], > 'test_distributor_perf.c': ['distributor'], > 'test_dmadev.c': ['dmadev', 'bus_vdev'], > diff --git a/app/test/test_dissect.c b/app/test/test_dissect.c > new file mode 100644 > index 0000000000..2c79acf766 > --- /dev/null > +++ b/app/test/test_dissect.c
<snip> > +static int > +test_simple(void) > +{ > + struct rte_mbuf mb; > + uint8_t buf[RTE_MBUF_DEFAULT_BUF_SIZE]; > + uint32_t data_len = PACKET_LEN; > + uint16_t src_port = rte_rand(); > + const uint16_t dst_port = rte_cpu_to_be_16(9); /* Discard port */ > + char obuf[LINE_MAX]; > + > + /* make a dummy packet */ > + mbuf_prep(&mb, buf, sizeof(buf)); > + add_header(&mb, data_len, src_port, dst_port); > + fill_data(&mb, data_len - mb.data_off); > + > + rte_dissect_mbuf(obuf, sizeof(obuf), &mb, 0); > + > + return TEST_SUCCESS; > +} What are these test cases actually verifying - can any of them actually fail? I don't see the output being checked anywhere. /Bruce