Skip to content
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

Add Fuzz test for RSA #549

Closed
wants to merge 1 commit into from
Closed

Conversation

HectorMalot
Copy link

As per #480 , my proposal to include fuzzing for RSA. Note that the test will run as a normal test if fuzzing is not enabled, so I didn't duplicate the code, but rather updated the test to allow fuzzing as well as normal testing.

Details of this change:

  • Changed test from *Testing.T to *Testing.F
  • Increased the testing prime numbers to larger numbers so that larger rune inputs also work. (i.e. up to MaxInt32)
  • Included a unicode test case (that would fail on the previous test)

Updated the existsing RSA test to also allow fuzzing. Note that the
test will run as a normal test if fuzzing is not enabled.

Also updated the provided prime numbers to larger numbers so that
larger rune inputs also work. (i.e. up to MaxInt32)
Copy link
Member

@tjgurwara99 tjgurwara99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally am not in favour of removing old test and just having the fuzzing tests. I think both should be present.

@HectorMalot
Copy link
Author

Hi @tjgurwara99,

That is how I started, but I realized that it would mean a lot of duplication, or a helper that contains all this code, called by nearly identical Test… and Fuzz… functions.

This is in the go documentation:

When fuzzing is disabled, the fuzz target is called with the seed inputs registered with F.Add and seed inputs from testdata/fuzz/. In this mode, the fuzz test acts much like a regular test, with subtests started with F.Fuzz instead of T.Run.

That gives me the impression that in this case, the proposed setup in the PR makes most sense. It functions as a normal test during a normal run, and can be used to fuzz when called with the fuzzing options.

Source: https://pkg.go.dev/testing#hdr-Fuzzing

Happy to change, but hope this makes you reconsider.

Cheers
Dennis

@tjgurwara99
Copy link
Member

That is how I started, but I realized that it would mean a lot of duplication, or a helper that contains all this code, called by nearly identical Test… and Fuzz… functions.

Duplicate code for doing two separate things (in this case Fuzzing and Testing) are valid reasons for duplicating code.

@raklaptudirm @siriak what are your opinions?

I'm personally against having test and fuzzing mixed because of the inherent flaky nature of fuzzing.

@siriak
Copy link
Member

siriak commented Oct 9, 2022

Both ways are acceptable IMO

@HectorMalot
Copy link
Author

HectorMalot commented Oct 11, 2022 via email

@github-actions
Copy link

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Nov 11, 2022
@github-actions
Copy link

This PR was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants