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

x/playground: playground does not run fuzz tests #57029

Closed
bcmills opened this issue Dec 1, 2022 · 5 comments
Closed

x/playground: playground does not run fuzz tests #57029

bcmills opened this issue Dec 1, 2022 · 5 comments
Labels
FrozenDueToAge fuzz Issues related to native fuzzing support help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Dec 1, 2022

What did you do?

Write a Fuzz test in the Playground: https://go.dev/play/p/YWPNCv-_iS7

What did you expect to see?

The same output as running go test -v locally on the file:

$ go test -v
=== RUN   FuzzNorm
=== RUN   FuzzNorm/seed#0
    main_test.go:67: oldNorm(-9223372036854775808, -9223372036854775808, 1) = 0, 0
    main_test.go:70: norm(-9223372036854775808, -9223372036854775808, 1) = 0, 0, false
=== RUN   FuzzNorm/seed#1
    main_test.go:67: oldNorm(-9223372036854775808, 9223372036854775807, 1) = -1, 0
    main_test.go:70: norm(-9223372036854775808, 9223372036854775807, 1) = -1, 0, true
=== RUN   FuzzNorm/seed#2
    main_test.go:67: oldNorm(9223372036854775807, -9223372036854775808, 1) = -1, 0
    main_test.go:70: norm(9223372036854775807, -9223372036854775808, 1) = -1, 0, true
=== RUN   FuzzNorm/seed#3
    main_test.go:67: oldNorm(9223372036854775807, 9223372036854775807, 1) = -2, 0
    main_test.go:70: norm(9223372036854775807, 9223372036854775807, 1) = 0, 0, false
=== RUN   FuzzNorm/c8836bb80adad37a
    main_test.go:67: oldNorm(-9223372036854775783, -9223372036854775799, 111) = 9140278595081309384, 40
    main_test.go:70: norm(-9223372036854775783, -9223372036854775799, 111) = 0, 0, false
--- PASS: FuzzNorm (0.00s)
    --- PASS: FuzzNorm/seed#0 (0.00s)
    --- PASS: FuzzNorm/seed#1 (0.00s)
    --- PASS: FuzzNorm/seed#2 (0.00s)
    --- PASS: FuzzNorm/seed#3 (0.00s)
    --- PASS: FuzzNorm/c8836bb80adad37a (0.00s)
PASS
ok      example 0.011s

What did you see instead?

A build error:

runtime.main_main·f: function main is undeclared in the main package

Go build failed.

Adding a dummy Test function (https://go.dev/play/p/OoIPkmP05-K) causes only that test to be run, not the seed values for the Fuzz function:

=== RUN   TestDummy
--- PASS: TestDummy (0.00s)
PASS

Program exited.

(CC @golang/fuzzing for Fuzz, @toothrot for x/playground)

@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. fuzz Issues related to native fuzzing support labels Dec 1, 2022
@bcmills bcmills added this to the Unreleased milestone Dec 1, 2022
@bcmills
Copy link
Contributor Author

bcmills commented Dec 1, 2022

@nikola-jokic
Copy link
Contributor

Hey, may I give it a shot? 😄

@bcmills
Copy link
Contributor Author

bcmills commented Dec 5, 2022

Sure! (See https://go.dev/doc/contribute for documentation on the code review process.)

@nikola-jokic
Copy link
Contributor

Just a quick update, I am finishing up changes. I tested by hand and it works.
I want to add unit tests as well, just in case.
Everything should be ready by tomorrow ☺️

@gopherbot
Copy link

Change https://go.dev/cl/456355 mentions this issue: x/playground: allow playground to run fuzz tests

@golang golang locked and limited conversation to collaborators Jan 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge fuzz Issues related to native fuzzing support help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants