Open ahmayun opened 4 months ago
The problem is that the grammar enables to generate surrogates as part of some tokens, however the test generator is not prepared to encode them while saving the output to file. To configure the encoding and the error handlers of encoding, you can use the --encoding
and the --encoding-errors
CLI options of grammarinator-generate
. These values will be passed to the encoding
and errors
parameter of codecs.open so you can set their values accordingly. In this case, I think the simples solution is to provide --encoding-errors=surrogatepass
argument to grammarinator-generate
.
I am trying to use grammarinator to generate test cases for
sqlite
. I am using the ANTLR grammar forsqlite
that is available at the official antlr repo:First I run:
grammarinator-process examples/grammars/SQLiteLexer.g4 examples/grammars/SQLiteParser.g4 -o examples/fuzzer
Which works fine.
But when I run:
grammarinator-generate SQLiteGenerator.SQLiteGenerator -r sql_stmt -d 20 -o examples/tests/test_%d.sql -n 100 -s SQLiteGenerator.html_space_serializer --sys-path examples/fuzzer/
I often get the following error (Note that it does not always crash but 9/10 times it will):
From my understanding, this means that grammarinator is generating values that can't be encoded as a utf-8 string. Is this an issue with grammarinator or is there a way to handle this that I am not aware of?
Here are some environment details if needed: