Skip to content

Commit 387fb9d

Browse files
committed
tests: add unit tests for BGP ibuf_scratch/ibuf_work optimization
Add test_ibuf_work.c with tests covering the in-place parsing from ibuf_scratch and ibuf_work buffer management: - basic parsing: length extraction, marker validation, header/message detection, buffer sizes - parse_buffer: complete/partial packets, multiple messages - scratch/work interaction: split messages across reads - ibuf_work reuse: partial->complete->partial without reallocation - EAGAIN handling: symmetric flow with no new data - bgp_read: copy partial from ibuf_work to ibuf_scratch before read - fatal error cleanup - near-full buffer handling - memory tracking to verify allocation only on partial packets Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
1 parent f4e4163 commit 387fb9d

2 files changed

Lines changed: 1235 additions & 0 deletions

File tree

tests/bgpd/subdir.am

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,12 @@ tests_bgpd_test_peer_attr_CPPFLAGS = $(TESTS_CPPFLAGS)
7979
tests_bgpd_test_peer_attr_LDADD = $(BGP_TEST_LDADD)
8080
tests_bgpd_test_peer_attr_SOURCES = tests/bgpd/test_peer_attr.c
8181
EXTRA_DIST += tests/bgpd/test_peer_attr.py
82+
83+
84+
if BGPD
85+
check_PROGRAMS += tests/bgpd/test_ibuf_work
86+
endif
87+
tests_bgpd_test_ibuf_work_CFLAGS = $(TESTS_CFLAGS)
88+
tests_bgpd_test_ibuf_work_CPPFLAGS = $(TESTS_CPPFLAGS)
89+
tests_bgpd_test_ibuf_work_LDADD = $(BGP_TEST_LDADD)
90+
tests_bgpd_test_ibuf_work_SOURCES = tests/bgpd/test_ibuf_work.c

0 commit comments

Comments
 (0)