How do I write test cases for interactive commands?
Poul-Henning Kamp
phk at phk.freebsd.dk
Sun Apr 18 08:17:15 UTC 2021
--------
Enji Cooper writes:
> > Take a look at LLVM testing infrastructure and specifically the
> llvm-lit
> > tool.
>
> Does their test infrastructure leverage GoogleTest? If so, then the bulk
> majority of the work would just be integrating it into Kyua.
> Cheers,
> -Enji
Given that pretty much any software to come out of Google is usually
pretty overweight, in particular on dependencies:
In the V(arnish)Test tool we built a facility for interactive and
curses-based tests using teken, (which we got from FreeBSD):
https://github.com/vtest/VTest
The code for that sub-part lives in:
https://github.com/vtest/VTest/blob/master/src/vtc_process.c
Here is a typical test-case using it:
https://github.com/varnishcache/varnish-cache/blob/master/bin/varnishtest/tests/u00008.vtc
The verbose output from that test can be seen here:
http://phk.freebsd.dk/misc/u00008.txt
V(arnish)Test is a modular program, and if you leave out all the
HTTP related modules, and substitute 'sbuf' for 'vsb', and "TAILQ" for "VTAILQ"
it would fit nicely into FreeBSD.
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
More information about the freebsd-hackers
mailing list