mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 18:12:02 +00:00
fix format_fuzzer
This commit is contained in:
parent
f557686774
commit
59c517dd91
@ -20,37 +20,32 @@
|
||||
|
||||
#include <AggregateFunctions/registerAggregateFunctions.h>
|
||||
|
||||
using namespace DB;
|
||||
|
||||
|
||||
ContextMutablePtr context;
|
||||
|
||||
extern "C" int LLVMFuzzerInitialize(int *, char ***)
|
||||
{
|
||||
if (context)
|
||||
return true;
|
||||
|
||||
SharedContextHolder shared_context = Context::createShared();
|
||||
context = Context::createGlobal(shared_context.get());
|
||||
context->makeGlobalContext();
|
||||
|
||||
MainThreadStatus::getInstance();
|
||||
|
||||
registerAggregateFunctions();
|
||||
registerFormats();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
|
||||
{
|
||||
try
|
||||
{
|
||||
using namespace DB;
|
||||
|
||||
static SharedContextHolder shared_context;
|
||||
static ContextMutablePtr context;
|
||||
|
||||
auto initialize = [&]() mutable
|
||||
{
|
||||
if (context)
|
||||
return true;
|
||||
|
||||
shared_context = Context::createShared();
|
||||
context = Context::createGlobal(shared_context.get());
|
||||
context->makeGlobalContext();
|
||||
context->setApplicationType(Context::ApplicationType::LOCAL);
|
||||
|
||||
MainThreadStatus::getInstance();
|
||||
|
||||
registerAggregateFunctions();
|
||||
registerFormats();
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
static bool initialized = initialize();
|
||||
(void) initialized;
|
||||
|
||||
total_memory_tracker.resetCounters();
|
||||
total_memory_tracker.setHardLimit(1_GiB);
|
||||
CurrentThread::get().memory_tracker.resetCounters();
|
||||
|
Loading…
Reference in New Issue
Block a user