-
Notifications
You must be signed in to change notification settings - Fork 36
Tests fail (length of long) / compiler warning #59
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
Conversation
a length of exactly 256 should be encoded as: 0x82 0x01 0x00 without this change, I was seeing the encoded length of a get response (that happened to be exactly 256 bytes long) encoded as: 0x81 0x00 that was causing snmpbulkwalk to fail, since it was reading the encoded length as 0.
|
Per the comment in the code, this one specific unit test does fail, and not just sometimes: Both on the automated test machine used on GH, and on a machine I have here, it ends up failing on the 7th pass through that loop...succeeding 6 times before that 7th pass. Consistently. Results output: I was going to merely assume that the 8 bytes of "corruption" landed in the middle of one of the OIDs, whilst still leaving the packet parsable...but you know what they say about those who assume ;) The latter contains the hex dump from 7th pass. Both are "manually" parsed. The diff of these ends up landing in the final 8 bytes used by test OID ".1.3.6.1.4.1.52420.9999999": I suggest disabling this one test for now, and revisiting it later. |
…it test cases has an issue, resulting in false negatives. This then prevents the automated workflow from succeeding. ***Temporarily*** disable the one unit test: "Should fail to parse a corrupt buffer" This test needs to be modified to ensure that it always results in the intended test outcome, perhaps by not relying on random data.
* Fix some invalid decoded lengths from various * length values >= 256 need 3 bytes to encode their length a length of exactly 256 should be encoded as: 0x82 0x01 0x00 without this change, I was seeing the encoded length of a get response (that happened to be exactly 256 bytes long) encoded as: 0x81 0x00 that was causing snmpbulkwalk to fail, since it was reading the encoded length as 0. * use sizeof * fix a compiler warning treated as an error: "operation on ‘tempVal’ may be undefined" * As documented in the comments of PR 59 ( #59 ), one of the unit test cases has an issue, resulting in false negatives. This then prevents the automated workflow from succeeding. ***Temporarily*** disable the one unit test: "Should fail to parse a corrupt buffer" This test needs to be modified to ensure that it always results in the intended test outcome, perhaps by not relying on random data. --------- Co-authored-by: Aidan Cyr <aidan@aidancyr.dev>
|
Clean up: closing the PRs previously blocked by unit tests |
Unit tests were failing:
Use sizeof(randomLong)
Note, though, that after fixing this, the unit test can still fail - warned as much in the code: "This may SOMETIMES fail if the random gets lucky and makes something valid"
At least on my machine, this seems to happen more than sometimes...this particular test might need revisiting.
Also address a compiler warning: