mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Merge pull request #12154 from ClickHouse/fix-test-under-thread-fuzzer
Fix test under thread fuzzer
This commit is contained in:
commit
fd266ffccd
50
src/Functions/hasThreadFuzzer.cpp
Normal file
50
src/Functions/hasThreadFuzzer.cpp
Normal file
@ -0,0 +1,50 @@
|
||||
#include <Common/ThreadFuzzer.h>
|
||||
#include <Functions/FunctionFactory.h>
|
||||
#include <DataTypes/DataTypesNumber.h>
|
||||
#include <Core/Field.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
/** Returns whether Thread Fuzzer is effective.
|
||||
* It can be used in tests to prevent too long runs.
|
||||
*/
|
||||
class FunctionHasThreadFuzzer : public IFunction
|
||||
{
|
||||
public:
|
||||
static constexpr auto name = "hasThreadFuzzer";
|
||||
static FunctionPtr create(const Context &)
|
||||
{
|
||||
return std::make_shared<FunctionHasThreadFuzzer>();
|
||||
}
|
||||
|
||||
String getName() const override
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
size_t getNumberOfArguments() const override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
DataTypePtr getReturnTypeImpl(const DataTypes & /*arguments*/) const override
|
||||
{
|
||||
return std::make_shared<DataTypeUInt8>();
|
||||
}
|
||||
|
||||
void executeImpl(Block & block, const ColumnNumbers &, size_t result, size_t input_rows_count) override
|
||||
{
|
||||
block.getByPosition(result).column = DataTypeUInt8().createColumnConst(input_rows_count, ThreadFuzzer::instance().isEffective());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void registerFunctionHasThreadFuzzer(FunctionFactory & factory)
|
||||
{
|
||||
factory.registerFunction<FunctionHasThreadFuzzer>();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ void registerFunctionGetMacro(FunctionFactory &);
|
||||
void registerFunctionGetScalar(FunctionFactory &);
|
||||
void registerFunctionIsConstant(FunctionFactory &);
|
||||
void registerFunctionGlobalVariable(FunctionFactory &);
|
||||
void registerFunctionHasThreadFuzzer(FunctionFactory &);
|
||||
void registerFunctionInitializeAggregation(FunctionFactory &);
|
||||
|
||||
#if USE_ICU
|
||||
@ -117,6 +118,7 @@ void registerFunctionsMiscellaneous(FunctionFactory & factory)
|
||||
registerFunctionGetScalar(factory);
|
||||
registerFunctionIsConstant(factory);
|
||||
registerFunctionGlobalVariable(factory);
|
||||
registerFunctionHasThreadFuzzer(factory);
|
||||
registerFunctionInitializeAggregation(factory);
|
||||
|
||||
#if USE_ICU
|
||||
|
@ -219,6 +219,7 @@ SRCS(
|
||||
h3ToParent.cpp
|
||||
h3ToString.cpp
|
||||
hasColumnInTable.cpp
|
||||
hasThreadFuzzer.cpp
|
||||
hasTokenCaseInsensitive.cpp
|
||||
hasToken.cpp
|
||||
hostName.cpp
|
||||
|
@ -19,7 +19,7 @@ threads=10
|
||||
count_multiplier=1
|
||||
max_time_ms=1000
|
||||
|
||||
debug_or_sanitizer_build=`$CLICKHOUSE_CLIENT -q "WITH ((SELECT value FROM system.build_options WHERE name='BUILD_TYPE') AS build, (SELECT value FROM system.build_options WHERE name='CXX_FLAGS') as flags) SELECT build='Debug' OR flags LIKE '%fsanitize%'"`
|
||||
debug_or_sanitizer_build=`$CLICKHOUSE_CLIENT -q "WITH ((SELECT value FROM system.build_options WHERE name='BUILD_TYPE') AS build, (SELECT value FROM system.build_options WHERE name='CXX_FLAGS') as flags) SELECT build='Debug' OR flags LIKE '%fsanitize%' OR hasThreadFuzzer()"`
|
||||
|
||||
if [[ debug_or_sanitizer_build -eq 1 ]]; then tables=100; count_multiplier=10; max_time_ms=1500; fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user