未验证 提交 fd266ffc 编写于 作者: A alexey-milovidov 提交者: GitHub

Merge pull request #12154 from ClickHouse/fix-test-under-thread-fuzzer

Fix test under thread fuzzer
#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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册