-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Feature(qtest): Add the rand option to generate a random string #16
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
e3f79ea to
aa43954
Compare
aa43954 to
aee0b75
Compare
|
The subject of git commit messages was inaccurate. It can be "Recognize 'RAND' parameter for insertions." |
| static void fill_rand_string(char *buf, size_t buf_size) | ||
| { | ||
| size_t len = 0; | ||
| while (len < MIN_RANDSTR_LEN) |
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 buf_size < MIN_RANDSTR_LEN?
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.
That is a good question. But I think the function is for internal usage and both buf_size and minimum length are defined by MIN_RANDSTR_LEN and MAX_RANDSTR_LEN. So It may reduce the chance that maintainer set wrong numbers to cause segmentation fault. My question is do I still need to add a logic to prevent error occurred for these kind of functions?
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.
You can place FIXME or TODO comments for the above considerations.
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.
I decided to place TODO comments. And could you share your experiences about the question? Cause in my experience, I only make sure that the internal function works without much error checks. I want to know how do experienced programmers think. Thanks 😄
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.
I am thinking of the feasibility to re-use fill_rand_string to perform fuzzing: https://en.wikipedia.org/wiki/Fuzzing
Typically speaking, fuzzer might expect shorter strings to validate interpreter and/or qtest internals.
aee0b75 to
6635959
Compare
No description provided.