Skip to content

AST-based query fuzzing mode for clickhouse-client#12111

Merged
akuzm merged 11 commits intomasterfrom
aku/query-fuzzer
Jul 8, 2020
Merged

AST-based query fuzzing mode for clickhouse-client#12111
akuzm merged 11 commits intomasterfrom
aku/query-fuzzer

Conversation

@akuzm
Copy link
Contributor

@akuzm akuzm commented Jul 3, 2020

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Implement AST-based query fuzzing mode for clickhouse-client. See this label for the list of issues we recently found by fuzzing. Most of them were found by this tool, and a couple by SQLancer and 00746_sql_fuzzy.pl.

@blinkov blinkov added the pr-build Pull request with build/testing/packaging improvement label Jul 3, 2020
struct QueryFuzzer
{
//pcg64 fuzz_rand{static_cast<UInt64>(rand())};
pcg64 fuzz_rand{clock_gettime_ns()};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is randomSeed function.

@alexey-milovidov
Copy link
Member

Please link all the issues found by this fuzzer to let people know how good this tool is.

@akuzm
Copy link
Contributor Author

akuzm commented Jul 8, 2020

Please link all the issues found by this fuzzer to let people know how good this tool is.

Added the list of issues to the changelog entry.

The tests are green and I cleaned up the code, so merging now. Next step is to start running it in the CI.

@akuzm akuzm marked this pull request as ready for review July 8, 2020 16:46
@akuzm akuzm merged commit dd907b2 into master Jul 8, 2020
@akuzm akuzm deleted the aku/query-fuzzer branch July 8, 2020 16:47
std::cerr << "Read too much text and still can't parse a query."
" Aborting." << std::endl;
last_exception_received_from_server
= std::make_unique<Exception>(1, "~");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will require cleanups.

// Debug AST cloning errors.
if (base_before_fuzz != base_after_fuzz)
{
fprintf(stderr, "base before fuzz: %s\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It represents you as a seasoned C developer.

("highlight", po::value<bool>()->default_value(true), "enable or disable basic syntax highlight in interactive command line")
("log-level", po::value<std::string>(), "client log level")
("server_logs_file", po::value<std::string>(), "put server logs into specified file")
("query-fuzzer-runs", po::value<int>()->default_value(0), "query fuzzer runs")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minimal comment about usage is required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-build Pull request with build/testing/packaging improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants