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

feat(gnovm): add gno fuzz for gno test #3442

Closed
wants to merge 2 commits into from
Closed

Conversation

rlaau
Copy link

@rlaau rlaau commented Jan 5, 2025

Title: Add Fuzzing Support for cmd with Enhanced Options

Description:
This PR introduces a fuzzing mechanism to the cmd following Go's fuzzing approach. The new functionality includes the following features and usage:

Usage:
Command: cmd supports a fuzzing mechanism similar to Go's built-in fuzzing framework.
FuzzXXX Function:
The FuzzXXX function should follow the standard signature where f.Fuzz accepts a function with the format:
f.Fuzz(func(t *testing.T, orig ...interface{}) {})
Example Code:
func FuzzMock(f *testing.F) {
f.Add("apple hello", int(400002131323))
f.Add("rainy day", int(98401132231331))
f.Add("winter comes", int(12349123123))
f.Fuzz(func(t *testing.T, orig ...interface{}) {
v, ok := orig[0].(string)
if !ok {
panic("type mismatch")
}
i, ok2 := orig[1].(int)
if !ok2 {
panic("type mismatch")
}
rev := testing.Reverse1(v)
doubleRev := testing.Reverse1(rev)
if v != doubleRev && i > 300 && i < 500 {
t.Errorf("Before: %q, after: %q", orig, doubleRev)
}
if utf8.ValidString(v) && !utf8.ValidString(rev) && i > 300 && i < 1000 {
t.Errorf("Reverse produced invalid UTF-8 string %q", rev)
}
})
}

Example Command:

gno test mock_test.gno -fuzz=Fuzz -v

Input: ["\xce", 318]
Panic/Error: Error 
ErrorMessage: "Before: ["\xce" 'ľ'], after: """

Changes Introduced:
Added -fuzz flag for fuzz testing in the cmd.
Enhanced support for verbose output (-v) and iteration specification (-i).

@github-actions github-actions bot added the 📦 🤖 gnovm Issues or PRs gnovm related label Jan 5, 2025
@Gno2D2
Copy link
Collaborator

Gno2D2 commented Jan 5, 2025

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
  • The pull request description provides enough details
  • Determine if infra needs to be updated before merging
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🟢 Maintainers must be able to edit this pull request (more info)

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 The pull request was created from a fork (head branch repo: rlaau/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this pull request

Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission
The pull request description provides enough details

If

🟢 Condition met
└── 🟢 Not (🔴 Pull request author is a member of the team: core-contributors)

Can be checked by

  • team core-contributors
Determine if infra needs to be updated before merging

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: master
    └── 🟢 Or
        ├── 🟢 A changed file matches this pattern: Dockerfile (filename: pkg/mod/github.com/grpc-ecosystem/grpc-gateway/[email protected]/.github/Dockerfile)
        ├── 🔴 A changed file matches this pattern: ^misc/deployments
        ├── 🔴 A changed file matches this pattern: ^misc/docker-
        ├── 🔴 A changed file matches this pattern: ^.github/workflows/releaser.*\.yml$
        └── 🔴 A changed file matches this pattern: ^.github/workflows/portal-loop\.yml$

Can be checked by

  • team devops

@jefft0
Copy link
Contributor

jefft0 commented Jan 5, 2025

Hello @rlaau . This is the fifth pull request with a similar title, where the first four were opened and then closed immediately. What is going on? If you don't know how to use the pull request system, as a minimum you should open the pull request as Draft.

@jefft0
Copy link
Contributor

jefft0 commented Jan 5, 2025

In addition to changing this PR to draft, you need to change all the commit comments to English.

@rlaau rlaau closed this Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🤖 gnovm Issues or PRs gnovm related
Projects
Development

Successfully merging this pull request may close these issues.

3 participants