英文:
Golang Fuzzing: Mismatched types in corpus entry
问题
在使用Go 1.18
引入的本地模糊测试功能时,我在重构我的测试后遇到了以下错误:
--- FAIL: FuzzTrie_InsertAndRead (0.03s)
trie_test.go:340: "testdata/fuzz/FuzzTrie_InsertAndRead/84ed65595ad05a58e293dbf423c1a816b697e2763a29d7c37aa476d6eef6fd60":
corpus entry中的类型不匹配: [[]uint8 []uint8],期望是[uint64 []uint8]
我猜测这是由于我将测试参数从byte
切片更改为uint64
和byte
切片导致的,但是我该如何摆脱这个corpus数据?它位于哪里?
英文:
When using the native fuzzing feature introduced in Go 1.18
, after refactoring my tests, I now encounter the following error:
--- FAIL: FuzzTrie_InsertAndRead (0.03s)
trie_test.go:340: "testdata/fuzz/FuzzTrie_InsertAndRead/84ed65595ad05a58e293dbf423c1a816b697e2763a29d7c37aa476d6eef6fd60":
mismatched types in corpus entry: [[]uint8 []uint8], want [uint64 []uint8]
I assume this is due to the change of my test parameters from byte
slices to a uint64
and a byte
slice, but how can I get rid of this corpus data? Where is it located?
答案1
得分: 2
使用原生的Go模糊测试运行测试时,生成的测试数据将存储在相对于正在运行的测试的以下路径中:testdata/fuzz/<FuzzTestName>
。
如果模糊测试的名称发生更改,则先前的测试数据将不再使用。而如果使用的类型发生更改,则包含的语料库数据将不再是相关类型,并且可以通过完全删除文件夹来丢弃它。
英文:
When running tests using native Go fuzzing, test data is generated and stored in the following path, relative to the tests that are being run: testdata/fuzz/<FuzzTestName>
.
If a fuzz test changes name, the previous test data is therefore effectively unused, while if the types it uses are changed, the corpus data it contains is no longer of the relevant type, and can be discarded by removing the folder entirely.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论