Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
039cf36a
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
039cf36a
编写于
7月 16, 2020
作者:
A
Alexander Kuzmenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Minor fixes for query fuzzer
上级
97e8a88b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
70 addition
and
14 deletion
+70
-14
docker/test/fuzzer/run-fuzzer.sh
docker/test/fuzzer/run-fuzzer.sh
+58
-8
programs/client/Client.cpp
programs/client/Client.cpp
+11
-5
src/Functions/FunctionsLogical.cpp
src/Functions/FunctionsLogical.cpp
+1
-1
未找到文件。
docker/test/fuzzer/run-fuzzer.sh
浏览文件 @
039cf36a
...
...
@@ -37,6 +37,8 @@ function download
wget
-nv
-nd
-c
"https://clickhouse-builds.s3.yandex.net/
$PR_TO_TEST
/
$SHA_TO_TEST
/clickhouse_build_check/clang-10_debug_none_bundled_unsplitted_disable_False_binary/clickhouse"
chmod
+x clickhouse
ln
-s
./clickhouse ./clickhouse-server
ln
-s
./clickhouse ./clickhouse-client
}
function
configure
...
...
@@ -54,30 +56,57 @@ function watchdog
sleep
3600
echo
"Fuzzing run has timed out"
./clickhouse client
--query
"select elapsed, query from system.processes"
||
:
killall
-9
clickhouse clickhouse-server clickhouse-client
||
:
killall clickhouse-client
||
:
for
x
in
{
1..10
}
do
if
!
pgrep
-f
clickhouse-client
then
break
fi
sleep
1
done
./clickhouse-client
--query
"select elapsed, query from system.processes"
||
:
killall clickhouse-server
||
:
for
x
in
{
1..10
}
do
if
!
pgrep
-f
clickhouse-server
then
break
fi
sleep
1
done
killall
-9
clickhouse-server clickhouse-client
||
:
}
function
fuzz
{
./clickhouse
server
--config-file
db/config.xml
--
--path
db 2>&1 |
tail
-100000
>
server.log &
./clickhouse
-
server
--config-file
db/config.xml
--
--path
db 2>&1 |
tail
-100000
>
server.log &
server_pid
=
$!
kill
-0
$server_pid
while
!
./clickhouse
client
--query
"select 1"
&&
kill
-0
$server_pid
;
do
echo
.
;
sleep
1
;
done
./clickhouse
client
--query
"select 1"
while
!
./clickhouse
-
client
--query
"select 1"
&&
kill
-0
$server_pid
;
do
echo
.
;
sleep
1
;
done
./clickhouse
-
client
--query
"select 1"
kill
-0
$server_pid
echo
Server started
fuzzer_exit_code
=
0
./clickhouse
client
--query-fuzzer-runs
=
1000
\
./clickhouse
-
client
--query-fuzzer-runs
=
1000
\
< <
(
for
f
in
$(
ls
ch/tests/queries/0_stateless/
*
.sql |
sort
-R
)
;
do
cat
"
$f
"
;
echo
';'
;
done
)
\
>
>(
tail
-100000
>
fuzzer.log
)
\
2>&1
\
||
fuzzer_exit_code
=
$?
echo
"Fuzzer exit code is
$fuzzer_exit_code
"
./clickhouse
client
--query
"select elapsed, query from system.processes"
||
:
./clickhouse
-
client
--query
"select elapsed, query from system.processes"
||
:
kill
-9
$server_pid
||
:
if
[
"
$fuzzer_exit_code
"
==
"137"
]
then
# Killed by watchdog, meaning, no errors.
return
0
fi
return
$fuzzer_exit_code
}
...
...
@@ -106,11 +135,19 @@ case "$stage" in
time
configure
;
&
"fuzz"
)
# Start a watchdog that should kill the fuzzer on timeout.
# The shell won't kill the child sleep when we kill it, so we have to put it
# into a separate process group so that we can kill them all.
set
-m
watchdog &
watchdog_pid
=
$!
set
+m
# Check that the watchdog has started
kill
-0
$watchdog_pid
fuzzer_exit_code
=
0
time
fuzz
||
fuzzer_exit_code
=
$?
kill
$watchdog_pid
||
:
kill
--
-
$watchdog_pid
||
:
# Debug
date
...
...
@@ -118,6 +155,19 @@ case "$stage" in
jobs
pstree
-aspgT
# Make files with status and description we'll show for this check on Github
if
[
"
$fuzzer_exit_code
"
==
0
]
then
echo
"OK"
>
description.txt
echo
"success"
>
status.txt
else
echo
"failure"
>
status.txt
if
!
grep
-m2
"received signal
\|
Logical error"
server-log.txt
>
description.txt
then
echo
"Fuzzer exit code
$fuzzer_exit_code
. See the logs"
>
description.txt
fi
fi
exit
$fuzzer_exit_code
;
&
esac
...
...
programs/client/Client.cpp
浏览文件 @
039cf36a
...
...
@@ -216,7 +216,7 @@ private:
ConnectionParameters
connection_parameters
;
QueryFuzzer
fuzzer
;
int
query_fuzzer_runs
;
int
query_fuzzer_runs
=
0
;
void
initialize
(
Poco
::
Util
::
Application
&
self
)
override
{
...
...
@@ -1041,10 +1041,12 @@ private:
begin
-
text
.
data
());
ASTPtr
fuzz_base
=
orig_ast
;
for
(
int
fuzz_step
=
0
;
fuzz_step
<
query_fuzzer_runs
;
fuzz_step
++
)
// Don't repeat inserts, the tables grow too big.
const
int
this_query_runs
=
as_insert
?
1
:
query_fuzzer_runs
;
for
(
int
fuzz_step
=
0
;
fuzz_step
<
this_query_runs
;
fuzz_step
++
)
{
fprintf
(
stderr
,
"fuzzing step %d for query at pos %zd
\n
"
,
fuzz_step
,
this_query_begin
-
text
.
data
());
fprintf
(
stderr
,
"fuzzing step %d
out of %d
for query at pos %zd
\n
"
,
fuzz_step
,
this_query_
runs
,
this_query_
begin
-
text
.
data
());
ASTPtr
ast_to_process
;
try
...
...
@@ -1058,7 +1060,11 @@ private:
std
::
stringstream
dump_of_cloned_ast
;
ast_to_process
->
dumpTree
(
dump_of_cloned_ast
);
fuzzer
.
fuzzMain
(
ast_to_process
);
// Run the original query as well.
if
(
fuzz_step
>
0
)
{
fuzzer
.
fuzzMain
(
ast_to_process
);
}
auto
base_after_fuzz
=
fuzz_base
->
formatForErrorMessage
();
...
...
src/Functions/FunctionsLogical.cpp
浏览文件 @
039cf36a
...
...
@@ -222,7 +222,7 @@ struct ValueGetterBuilderImpl<>
static
TernaryValueGetter
build
(
const
IColumn
*
x
)
{
throw
Exception
(
std
::
string
(
"Unknown numeric column of type: "
)
+
demangle
(
typeid
(
x
).
name
()),
std
::
string
(
"Unknown numeric column of type: "
)
+
demangle
(
typeid
(
*
x
).
name
()),
ErrorCodes
::
LOGICAL_ERROR
);
}
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录