Commit 387fb9d
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
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
0 commit comments