sqlancer / sqlancer

Automated testing to find logic and performance bugs in database systems
http://www.sqlancer.com/
MIT License
1.47k stars 276 forks source link

Abstraction for expected error messages #32

Open mrigger opened 4 years ago

mrigger commented 4 years ago

To specify the expected error messages for a SQL statement, we currently use Collection<String>, see https://github.com/sqlancer/sqlancer/blob/af4374fb62419aed966c074b7888ddc78a98313e/src/sqlancer/Query.java#L27

It would be desirable to introduce an abstraction to also allow, for example, specifying regular expressions to cover multiple expected error messages at once, and thus make expected error messages more descriptive (since without using regular expressions, we need to check for the shortest common string).

mrigger commented 1 year ago

In https://github.com/sqlancer/sqlancer/blob/a195cdd0b4a97cf1113c4bded2e1a41281d4a26a/src/sqlancer/common/query/ExpectedErrors.java, we could do the following:

mrigger commented 1 year ago

@albertZhangTJ, do you want to have a look at this issue? I think working on this would be relevant, as we also need to think about how we could generate or specify the list of ExpectedErrors in your DSL.