View on GitHub

Devendra's Log

Regression test a Wireshark dissector using tshark

This post shows how you can use some basic command line utilities, and tshark, to automate regression testing of a Wireshark dissector.

Create baseline test result

for f in `ls *.pcap* | sort -f`; do echo $f; tshark -r "$f" -V; done > result.txt

This will run tshark on files in the current directory with the pcap extension, and write the output to result.txt.

To test regression, use diff

diff -b result.txt <(for f in `ls *.pcap* | sort -f`; do echo $f; tshark -r "$f" -V; done)

Any output produced by the above could be a result of

  1. A valid change - if so, update the baseline test result

  2. A bug - create a bug report with the output

This should work on macOS, Linux, and on Windows in the Git Bash shell.