tcpdump mailing list archives

Re: exit status codes semantics in tests


From: Guy Harris <gharris () sonic net>
Date: Fri, 16 Oct 2026 14:41:07 -0700

On Oct 16, 2026, at 2:05 PM, Denis Ovsienko <denis () ovsienko info> wrote:

On Fri, 16 Oct 2026 10:36:49 -0700
Guy Harris <gharris () sonic net> wrote:

        ...

If TESTrun has received EX_USAGE from a test program, it means a bug in
TESTrun because every command line is an internal product of TESTrun.

I.e, EX_USAGE should not be used for any cases where a command-line argument is *intentionallY* made incorrect in 
TESTrun because the program is being used to test to make sure that a particular argument fails - whether it's an 
invalid filter expression for the particular link-layer type (or for *any* link-layer type), or to make sure that an 
invalid string name for a link-layer type returns -1 from pcap_datalink_name_to_val(), or....

Time stamps in filter apply tests have been discussed once or twice
before, this could use a command-line option.  Other packet meta-data
could use the same or other options.  To make complete sense, this
would need meaningful savefiles and meaningful test definitions to
exercise specific code paths.

filtertest is a program for testing filters, not to test capture-file reading code; giving it the responsibility for 
the latter would make it even *more* convoluted. I'm working on a *separate* program for that.

Unless there are filter expressions that check the packet arrival time, there's no need for the filter tests to care 
about it.

For packet data it is not clear what code path it would test.

The code paths that reads pcap and that read pcapng files and produce a struct pcap_pkthdr and a lump of packet data.

Yes, filter expressions can and in the TESTrun case do come from a
temporary file.  What matters is that sometimes the result of a test
must be conveyed as "could not run the test at all", not "test passed"
or "test failed".

With EIO, ETIMEDOUT, and possibly other read errors being "could not run the test at all".
_______________________________________________
tcpdump-workers mailing list -- tcpdump-workers () lists tcpdump org
To unsubscribe send an email to tcpdump-workers-leave () lists tcpdump org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Current thread: