]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: ncbuf: write unit tests
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 4 May 2022 14:51:19 +0000 (16:51 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 12 May 2022 16:29:55 +0000 (18:29 +0200)
commiteeeeed44eac852a6e4a7744c1f92dbd584ca4f45
tree8dbe56f777e74b7cfb8d34f1e5553d3e2401dc32
parentdf25acf47fc0858656b285a42f5e2f37145dab2f
MINOR: ncbuf: write unit tests

Implement a series of unit test to validate ncbuf. This is written with
a main function which can be compiled independently using the following
command-line :
 $ gcc -DSTANDALONE -lasan -I./include -o ncbuf src/ncbuf.c

The first part tests is used to test ncb_add()/ncb_advance(). After each
call a loop is done on the buffer blocks which should ensure that the
gap infos are correct.

The second part generates random offsets and insert them until the
buffer is full. The buffer is then resetted and all random offsets are
re-inserted in the reverse order : the buffer should be full once again.

The generated binary takes arguments to change the tests execution.
 "usage: ncbuf [-r] [-s bufsize] [-h bufhead] [-p <delay_msec>]"
src/ncbuf.c