From f63955cb7f36e56f6de4fe6398ed246dfe9c4ca6 Mon Sep 17 00:00:00 2001 From: Zuleykha Pavlichenkova Date: Wed, 12 Jun 2024 16:33:49 +0200 Subject: [PATCH 1/2] new member enable_verification added to SQLSmithOptions and FuzzyDuck to flag the state --- src/include/fuzzyduck.hpp | 1 + src/sqlsmith_extension.cpp | 5 +++++ src/third_party/sqlsmith/include/sqlsmith.hh | 1 + 3 files changed, 7 insertions(+) diff --git a/src/include/fuzzyduck.hpp b/src/include/fuzzyduck.hpp index 4393e87..e6d5363 100644 --- a/src/include/fuzzyduck.hpp +++ b/src/include/fuzzyduck.hpp @@ -25,6 +25,7 @@ class FuzzyDuck { string complete_log; string log; bool verbose_output = false; + bool enable_verification = false; idx_t timeout = 30; public: diff --git a/src/sqlsmith_extension.cpp b/src/sqlsmith_extension.cpp index d88f4fe..f995e73 100644 --- a/src/sqlsmith_extension.cpp +++ b/src/sqlsmith_extension.cpp @@ -22,6 +22,7 @@ struct SQLSmithFunctionData : public TableFunctionData { bool dump_all_queries = false; bool dump_all_graphs = false; bool verbose_output = false; + bool enable_verification = false; string complete_log; string log; bool finished = false; @@ -67,6 +68,7 @@ static void SQLSmithFunction(ClientContext &context, TableFunctionInput &data_p, options.dump_all_queries = data.dump_all_queries; options.dump_all_graphs = data.dump_all_graphs; options.verbose_output = data.verbose_output; + options.enable_verification = data.enable_verification; options.complete_log = data.complete_log; options.log = data.log; duckdb_sqlsmith::run_sqlsmith(DatabaseInstance::GetDatabase(context), options); @@ -139,6 +141,8 @@ static duckdb::unique_ptr FuzzyDuckBind(ClientContext &context, Ta result->fuzzer.log = StringValue::Get(kv.second); } else if (kv.first == "verbose_output") { result->fuzzer.verbose_output = BooleanValue::Get(kv.second); + } else if (kv.first == "enable_verification") { + result->fuzzer.enable_verification = BooleanValue::Get(kv.second); } } return_types.emplace_back(LogicalType::BOOLEAN); @@ -186,6 +190,7 @@ void SqlsmithExtension::Load(DuckDB &db) { fuzzy_duck_fun.named_parameters["log"] = LogicalType::VARCHAR; fuzzy_duck_fun.named_parameters["complete_log"] = LogicalType::VARCHAR; fuzzy_duck_fun.named_parameters["verbose_output"] = LogicalType::BOOLEAN; + fuzzy_duck_fun.named_parameters["enable_verification"] = LogicalType::BOOLEAN; ExtensionUtil::RegisterFunction(db_instance, fuzzy_duck_fun); TableFunction fuzz_all_functions("fuzz_all_functions", {}, FuzzAllFunctions, FuzzyDuckBind); diff --git a/src/third_party/sqlsmith/include/sqlsmith.hh b/src/third_party/sqlsmith/include/sqlsmith.hh index 4bcf23b..cd00d8b 100644 --- a/src/third_party/sqlsmith/include/sqlsmith.hh +++ b/src/third_party/sqlsmith/include/sqlsmith.hh @@ -16,6 +16,7 @@ struct SQLSmithOptions { bool dump_all_queries = false; bool dump_all_graphs = false; bool verbose_output = false; + bool enable_verification = false; std::string complete_log; std::string log; }; From 6d3cd97b1e6792ced9b231ffab91cab1d7e88a85 Mon Sep 17 00:00:00 2001 From: Zuleykha Pavlichenkova Date: Wed, 12 Jun 2024 16:34:10 +0200 Subject: [PATCH 2/2] checking if enable_verification set to true on BeginFuzzing --- src/fuzzyduck.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/fuzzyduck.cpp b/src/fuzzyduck.cpp index 7d4f0b9..e227063 100644 --- a/src/fuzzyduck.cpp +++ b/src/fuzzyduck.cpp @@ -27,6 +27,9 @@ void FuzzyDuck::BeginFuzzing() { complete_log_handle = fs.OpenFile(complete_log, FileFlags::FILE_FLAGS_WRITE | FileFlags::FILE_FLAGS_FILE_CREATE_NEW); } + if (enable_verification) { + RunQuery("PRAGMA enable_verification"); + } } void FuzzyDuck::EndFuzzing() {