-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate test checker executable #106
Conversation
Thanks for adding the error handler! |
The generated test checker now rejects test files that contain data beyond a valid object: in other words, if the validator succeeds but does not read all input, then the test checker now considers the test failing, and returns status code 1. Validator failure returns status code 2, and 3 for any other kind of errors. |
PRO: short file creation time CON: the witness files are produced in the current directory, not honoring --odir
The |
There seems to be a off-by-one of some sorts s.t. the first negative witness is actually a positive one. @lemmy ➜ /workspaces/RFC-3D/foo2 (mku-tshark) $ for f in witness*; do echo $f && hexdump $f; done
witness.0.POS.VxlanValidateVxlanHeader.dat
0000000 0808 0808 0808
0000006
witness.1.POS.VxlanValidateVxlanHeader.dat
0000000 0f0f 0f00 0f0f
0000006
witness.2.POS.VxlanValidateVxlanHeader.dat
0000000 0018 0000 0000
0000006
witness.3.NEG.VxlanValidateVxlanHeader.dat <- payload same as 0.Pos
0000000 0808 0808 0808
0000006
witness.4.NEG.VxlanValidateVxlanHeader.dat
0000000 0000
0000001
witness.5.NEG.VxlanValidateVxlanHeader.dat
0000000 0001
0000001 |
This PR introduces 3D option
--test_checker
, which, when followed by a parser name of the formModulename.parsername
, generates a test executable,test.exe
, so that./test.exe filename.dat arg1 arg2...
opens the filefilename.dat
and runs the validator forModulename.parsername
, with argumentsarg1
,arg2
..., on the binary data contained in that file, and returns 0 if the data in the file passes validation, 1 if it fails validation, 2 for any other error (wrong number of arguments, file is missing, cannot mmap, etc.)The file passed to
test.exe
is assumed to contain all of the input data to be passed to the validator, in binary form. If the user wants to start from somefilename.hex
that contains hex data instead (e.g. .pcap), it is the responsibility of the user to first run something likexxd -r -p filename.hex filename.dat
to convert that hex file to a binary file before passing the latter totest.exe
This should fix #105