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

test(fuzz): add testdata #19

Merged
merged 6 commits into from
Apr 4, 2023
Merged

test(fuzz): add testdata #19

merged 6 commits into from
Apr 4, 2023

Conversation

ernado
Copy link
Member

@ernado ernado commented Aug 5, 2022

Updates #10

@ernado
Copy link
Member Author

ernado commented Aug 5, 2022

@tdakkota please fix it so I can fuzz it further.

Currently I'm unable to proceed because go std fuzzing does not support multiple crashers.

@ernado ernado added the testing label Aug 5, 2022
@ernado ernado marked this pull request as draft August 8, 2022 07:52
@tdakkota tdakkota force-pushed the test/add-fuzz-testdata branch from c0dc6bc to ea81e52 Compare August 20, 2022 20:17
@codecov
Copy link

codecov bot commented Aug 20, 2022

Codecov Report

Merging #19 (55e8d71) into main (28a3a82) will increase coverage by 0.09%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main      #19      +/-   ##
==========================================
+ Coverage   76.23%   76.33%   +0.09%     
==========================================
  Files          21       21              
  Lines        7154     7154              
==========================================
+ Hits         5454     5461       +7     
+ Misses       1326     1321       -5     
+ Partials      374      372       -2     
Impacted Files Coverage Δ
parserc.go 87.41% <0.00%> (+0.44%) ⬆️
sorter.go 86.81% <0.00%> (+3.29%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@tdakkota
Copy link
Member

@ernado I've rebased this branch and moved the tag check under the env flag. Now it is possible to continue fuzzing.

@ernado
Copy link
Member Author

ernado commented Aug 21, 2022

--- FAIL: FuzzDecodeEncodeDecode (6.59s)
    --- FAIL: FuzzDecodeEncodeDecode (0.00s)
        fuzz_test.go:118:
                Error Trace:    /root/yamlx/fuzz_test.go:118
                                                        /root/yamlx/fuzz_test.go:133

                                                        /root/yamlx/value.go:339
                                                        /root/yamlx/fuzz.go:337
                Error:          Not equal:
                                expected: "\n"
                                actual  : "\n\n"

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -2 +2,2 @@

                                +
                Test:           FuzzDecodeEncodeDecode
        fuzz_test.go:87: Input: "|+\n\n#00000"
        fuzz_test.go:89: Data: "|4+\n\n\n#00000\n"

    Failing input written to testdata/fuzz/FuzzDecodeEncodeDecode/8cf4812e4e6f6f8c0276e10a83403ad06a31dd9d59a344b969bdc7a50e5822d2
    To re-run:
    go test -run=FuzzDecodeEncodeDecode/8cf4812e4e6f6f8c0276e10a83403ad06a31dd9d59a344b969bdc7a50e5822d2

Probably should normalize newlines

@tdakkota tdakkota force-pushed the test/add-fuzz-testdata branch from 8e8d8af to 23f2717 Compare August 23, 2022 02:14
@ernado
Copy link
Member Author

ernado commented Aug 29, 2022

@tdakkota

go test fuzz v1
[]byte("&x\nc: *x")

Fuzzing hangs up on this, please check. Probably infinite recursion?

@ernado
Copy link
Member Author

ernado commented Aug 29, 2022

fuzz: elapsed: 42s, execs: 4084712 (61455/sec), new interesting: 362 (total: 1425)
--- FAIL: FuzzDecodeEncodeDecode (41.95s)
    --- FAIL: FuzzDecodeEncodeDecode (0.00s)
        fuzz_test.go:115:
                Error Trace:    /root/yamlx/fuzz_test.go:115
                                                        /root/yamlx/value.go:556
                                                        /root/yamlx/value.go:339
                                                        /root/yamlx/fuzz.go:337
                Error:          Received unexpected error:
                                yaml: offset 2: did not find expected tag URI
                Test:           FuzzDecodeEncodeDecode
        fuzz_test.go:91: Input: "!<!!>"
        fuzz_test.go:93: Data: "!!\n"

    Failing input written to testdata/fuzz/FuzzDecodeEncodeDecode/daa3fb5eb85b769d93c89ebec33f7aed8714a9ff0929acaef0738972aaba2934
    To re-run:
    go test -run=FuzzDecodeEncodeDecode/daa3fb5eb85b769d93c89ebec33f7aed8714a9ff0929acaef0738972aaba2934
go test fuzz v1
[]byte("!<!!>")

@tdakkota tdakkota force-pushed the test/add-fuzz-testdata branch from 5c34d2e to 55e8d71 Compare August 30, 2022 08:14
@ernado
Copy link
Member Author

ernado commented Aug 30, 2022

--- FAIL: FuzzDecodeEncodeDecode (6.28s)
    --- FAIL: FuzzDecodeEncodeDecode (0.00s)
        fuzz_test.go:115:
                Error Trace:    /root/yamlx/fuzz_test.go:115
                                                        /root/yamlx/value.go:556
                                                        /root/yamlx/value.go:339
                                                        /root/yamlx/fuzz.go:337
                Error:          Received unexpected error:
                                yaml: offset 1: did not find expected whitespace or line break
                Test:           FuzzDecodeEncodeDecode
        fuzz_test.go:91: Input: "%TAG ! !,\n--- !0"
        fuzz_test.go:93: Data: "!,0\n"

    Failing input written to testdata/fuzz/FuzzDecodeEncodeDecode/80d7746f8ea58302875df00e90705f229103358f698aeb73f512a7cdf2e3ca6f
    To re-run:
    go test -run=FuzzDecodeEncodeDecode/80d7746f8ea58302875df00e90705f229103358f698aeb73f512a7cdf2e3ca6f
FAIL
exit status 1
FAIL    github.com/go-faster/yamlx      13.103s
go test fuzz v1
[]byte("%TAG ! !,\n--- !0")

@ernado ernado marked this pull request as ready for review April 4, 2023 00:33
@ernado ernado merged commit ed711fb into main Apr 4, 2023
@tdakkota tdakkota deleted the test/add-fuzz-testdata branch April 18, 2023 12:50
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.

2 participants