-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
Reformat the output of BIGNUMS where test cases fail. #3465
Conversation
That example isn't the best. The caret highlighting is per character (i.e. digit) not per byte (pair of digits). |
I'm wondering of the highlight at the beginning is really necessary when the two number have different sizes. How about this?
|
…oth bignums have digits.
Okay, that's an improvement. |
test/test_test.c
Outdated
int r; | ||
BIGNUM *a = NULL, *b = NULL, *c = NULL, *d = NULL; | ||
const char as[] = "1234567890123456789012345678901234567890123456789012" | ||
"1234567890123456789012345678901234567890123456789012" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jagged formatting. I mean it looks like one white space is missing here and in number of other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, missed these.
test/test_test.c
Outdated
BN_hex2bn(&a, as); | ||
BN_hex2bn(&b, bs); | ||
BN_hex2bn(&c, cs); | ||
BN_hex2bn(&d, ds); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if either of BN_hex2bn fails?
Seconded.
Empty line in the middle is unnecessary/confusing... |
On side note one can wonder if it makes sense to apply this even to string and memory comparisons, i.e. excess data not being marked with carets. For example right now it reads
and question is if following would be more appropriate
One can also wonder if following would tell the story better
|
Just in case it wasn't clear, "side note" means that no modifications are expected. |
But on related note, I don't quite see the value of I also wonder what do others think of comparison to NULL. More specifically if it makes sense to print any additional information besides
And question is |
This applies to other cases as well, i.e. not specifically to BN. On the other hand one can probably argue that it's not the presence of these methods that is "problem" but their usage. I mean it can be test programmer's choice to use TEST_ptr_op when deemed more appropriate... |
I agree that the comparison with NULL doesn't need a dump. It should be clear enough from the error line, |
Ah, wait... if the comparison is |
Basically what looks strange is caret marking for NULL, i.e. as if N, U, L, L were digits.
In cases other than BN, NULL is actually not marked with carets or even dignified with offset, e,g,
I'd say it should be same even here, i.e.
|
Regarding 'offset'. It seems that 'position' would be more appropriate term. Trouble of course is that it refers to digit position and in this case digit is nibble. But looking at nibble indices is not really handy. So it would probably be appropriate to explicitly say 'byte position' or 'bit position' (naturally multiplying byte position by 8). [As already discussed elsewhere I'd vote for latter, i.e. bit position.] |
Exactly why it works as it does. Is trying to detect if the text version of the argument is The I think the side note about highlighting memory and string dumps should go in another ticket. It is a valid point. |
Still WIP, there is a problem where blank lines are produced which I'm looking into... |
Ready now. |
Nah, I think that'd be way over the top. There's only so much a framework should do.
Yup, I agree. |
NULL should be marked with + here:
|
I find output on 32-bit systems kind of odd. Because it's forced to 7 limbs per line and as result positions end up being 224, 448, 672, 896, etc. It's cool, but I think platform-neutral output would be more appropriate. Personally I don't really care much for spaces, but injecting spaces at 64-bit boundaries can be considered |
I second that |
Fix copy paste and forget to edit typo.
These two changes are done. |
Something got lost in the middle. Currently it reads
while expected output is
|
Drat the highlighting change. I'll figure this one out in the morning. Sleep time now. Well caught BTW. |
diff lines were not being produced properly.
That output looks like this now:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commits will be squashed to one.
Merged. Thanks! |
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from #3465)
… in openssl#3465 Don't highlight excess when comparing unequal length strings. Clean up the NULL / empty string display.
Excess bytes, when one block is longer than the other, are not explicitly highlighted. The NULL / zero length block output has been cleaned up.
Excess bytes, when one block is longer than the other, are not explicitly highlighted. The NULL / zero length block output has been cleaned up. Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from #3515)
Change the output from BIGNUM tests so they match the suggestions in #3341
The offset on the right is in bytes.
Extra test cases to display some of the output edge cases have been added.