Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
beddce09
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,发现更多精彩内容 >>
提交
beddce09
编写于
4月 15, 2015
作者:
A
Alexey Arno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dbms: Server: unit tests cleanup. [#METR-15090]
上级
ac1e12e8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
86 addition
and
209 deletion
+86
-209
dbms/src/IO/tests/read_buffer_aio.cpp
dbms/src/IO/tests/read_buffer_aio.cpp
+36
-54
dbms/src/IO/tests/write_buffer_aio.cpp
dbms/src/IO/tests/write_buffer_aio.cpp
+50
-155
未找到文件。
dbms/src/IO/tests/read_buffer_aio.cpp
浏览文件 @
beddce09
...
...
@@ -14,12 +14,13 @@ namespace
{
void
run
();
void
prepare
(
size_t
s
,
std
::
string
&
directory
,
std
::
string
&
filename
,
std
::
string
&
buf
);
void
prepare2
(
std
::
string
&
directory
,
std
::
string
&
filename
,
std
::
string
&
buf
);
void
prepare3
(
std
::
string
&
directory
,
std
::
string
&
filename
,
std
::
string
&
buf
);
void
prepare4
(
std
::
string
&
directory
,
std
::
string
&
filename
,
std
::
string
&
buf
);
void
prepare
(
size_t
s
,
std
::
string
&
filename
,
std
::
string
&
buf
);
void
prepare2
(
std
::
string
&
filename
,
std
::
string
&
buf
);
void
prepare3
(
std
::
string
&
filename
,
std
::
string
&
buf
);
void
prepare4
(
std
::
string
&
filename
,
std
::
string
&
buf
);
std
::
string
createTmpFile
();
void
die
(
const
std
::
string
&
msg
);
void
run
_t
est
(
unsigned
int
num
,
const
std
::
function
<
bool
()
>
func
);
void
run
T
est
(
unsigned
int
num
,
const
std
::
function
<
bool
()
>
func
);
bool
test1
(
const
std
::
string
&
filename
);
bool
test2
(
const
std
::
string
&
filename
,
const
std
::
string
&
buf
);
...
...
@@ -46,30 +47,25 @@ void run()
{
namespace
fs
=
boost
::
filesystem
;
std
::
string
directory
;
std
::
string
filename
;
std
::
string
buf
;
prepare
(
10
*
DEFAULT_AIO_FILE_BLOCK_SIZE
,
directory
,
filename
,
buf
);
prepare
(
10
*
DEFAULT_AIO_FILE_BLOCK_SIZE
,
filename
,
buf
);
std
::
string
directory2
;
std
::
string
filename2
;
std
::
string
buf2
;
prepare
(
2
*
DEFAULT_AIO_FILE_BLOCK_SIZE
-
3
,
directory2
,
filename2
,
buf2
);
prepare
(
2
*
DEFAULT_AIO_FILE_BLOCK_SIZE
-
3
,
filename2
,
buf2
);
std
::
string
directory3
;
std
::
string
filename3
;
std
::
string
buf3
;
prepare2
(
directory3
,
filename3
,
buf3
);
prepare2
(
filename3
,
buf3
);
std
::
string
directory4
;
std
::
string
filename4
;
std
::
string
buf4
;
prepare3
(
directory4
,
filename4
,
buf4
);
prepare3
(
filename4
,
buf4
);
std
::
string
directory5
;
std
::
string
filename5
;
std
::
string
buf5
;
prepare4
(
directory5
,
filename5
,
buf5
);
prepare4
(
filename5
,
buf5
);
const
std
::
vector
<
std
::
function
<
bool
()
>
>
tests
=
{
...
...
@@ -99,27 +95,21 @@ void run()
for
(
const
auto
&
test
:
tests
)
{
++
num
;
run
_t
est
(
num
,
test
);
run
T
est
(
num
,
test
);
}
fs
::
remove_all
(
directory
);
fs
::
remove_all
(
directory2
);
fs
::
remove_all
(
directory3
);
fs
::
remove_all
(
directory4
);
fs
::
remove_all
(
directory5
);
fs
::
remove_all
(
fs
::
path
(
filename
).
parent_path
().
string
()
);
fs
::
remove_all
(
fs
::
path
(
filename2
).
parent_path
().
string
()
);
fs
::
remove_all
(
fs
::
path
(
filename3
).
parent_path
().
string
()
);
fs
::
remove_all
(
fs
::
path
(
filename4
).
parent_path
().
string
()
);
fs
::
remove_all
(
fs
::
path
(
filename5
).
parent_path
().
string
()
);
}
void
prepare
(
size_t
s
,
std
::
string
&
directory
,
std
::
string
&
filename
,
std
::
string
&
buf
)
void
prepare
(
size_t
s
,
std
::
string
&
filename
,
std
::
string
&
buf
)
{
static
const
std
::
string
symbols
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
;
char
pattern
[]
=
"/tmp/fileXXXXXX"
;
char
*
dir
=
::
mkdtemp
(
pattern
);
if
(
dir
==
nullptr
)
die
(
"Could not create directory"
);
directory
=
std
::
string
(
dir
);
filename
=
directory
+
"/foo"
;
filename
=
createTmpFile
();
size_t
n
=
10
*
DEFAULT_AIO_FILE_BLOCK_SIZE
;
buf
.
reserve
(
n
);
...
...
@@ -134,15 +124,9 @@ void prepare(size_t s, std::string & directory, std::string & filename, std::st
out
<<
buf
;
}
void
prepare2
(
std
::
string
&
directory
,
std
::
string
&
filename
,
std
::
string
&
buf
)
void
prepare2
(
std
::
string
&
filename
,
std
::
string
&
buf
)
{
char
pattern
[]
=
"/tmp/fileXXXXXX"
;
char
*
dir
=
::
mkdtemp
(
pattern
);
if
(
dir
==
nullptr
)
die
(
"Could not create directory"
);
directory
=
std
::
string
(
dir
);
filename
=
directory
+
"/foo"
;
filename
=
createTmpFile
();
buf
=
"122333444455555666666777777788888888999999999"
;
...
...
@@ -153,15 +137,9 @@ void prepare2(std::string & directory, std::string & filename, std::string & buf
out
<<
buf
;
}
void
prepare3
(
std
::
string
&
directory
,
std
::
string
&
filename
,
std
::
string
&
buf
)
void
prepare3
(
std
::
string
&
filename
,
std
::
string
&
buf
)
{
char
pattern
[]
=
"/tmp/fileXXXXXX"
;
char
*
dir
=
::
mkdtemp
(
pattern
);
if
(
dir
==
nullptr
)
die
(
"Could not create directory"
);
directory
=
std
::
string
(
dir
);
filename
=
directory
+
"/foo"
;
filename
=
createTmpFile
();
buf
=
"122333444455555666666777777788888888999999999"
;
...
...
@@ -173,17 +151,11 @@ void prepare3(std::string & directory, std::string & filename, std::string & buf
out
<<
buf
;
}
void
prepare4
(
std
::
string
&
directory
,
std
::
string
&
filename
,
std
::
string
&
buf
)
void
prepare4
(
std
::
string
&
filename
,
std
::
string
&
buf
)
{
static
const
std
::
string
symbols
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
;
char
pattern
[]
=
"/tmp/fileXXXXXX"
;
char
*
dir
=
::
mkdtemp
(
pattern
);
if
(
dir
==
nullptr
)
die
(
"Could not create directory"
);
directory
=
std
::
string
(
dir
);
filename
=
directory
+
"/foo"
;
filename
=
createTmpFile
();
std
::
ofstream
out
(
filename
.
c_str
());
if
(
!
out
.
is_open
())
...
...
@@ -196,13 +168,23 @@ void prepare4(std::string & directory, std::string & filename, std::string & buf
out
<<
buf
;
}
std
::
string
createTmpFile
()
{
char
pattern
[]
=
"/tmp/fileXXXXXX"
;
char
*
dir
=
::
mkdtemp
(
pattern
);
if
(
dir
==
nullptr
)
die
(
"Could not create directory"
);
return
std
::
string
(
dir
)
+
"/foo"
;
}
void
die
(
const
std
::
string
&
msg
)
{
std
::
cout
<<
msg
<<
"
\n
"
;
::
exit
(
EXIT_FAILURE
);
}
void
run
_t
est
(
unsigned
int
num
,
const
std
::
function
<
bool
()
>
func
)
void
run
T
est
(
unsigned
int
num
,
const
std
::
function
<
bool
()
>
func
)
{
bool
ok
;
...
...
dbms/src/IO/tests/write_buffer_aio.cpp
浏览文件 @
beddce09
...
...
@@ -11,9 +11,13 @@
namespace
{
namespace
fs
=
boost
::
filesystem
;
void
run
();
void
die
(
const
std
::
string
&
msg
);
void
run_test
(
unsigned
int
num
,
const
std
::
function
<
bool
()
>
func
);
void
runTest
(
unsigned
int
num
,
const
std
::
function
<
bool
()
>
func
);
std
::
string
createTmpFile
();
std
::
string
generateString
(
size_t
n
);
bool
test1
();
bool
test2
();
...
...
@@ -46,7 +50,7 @@ void run()
for
(
const
auto
&
test
:
tests
)
{
++
num
;
run
_t
est
(
num
,
test
);
run
T
est
(
num
,
test
);
}
}
...
...
@@ -56,7 +60,7 @@ void die(const std::string & msg)
::
exit
(
EXIT_FAILURE
);
}
void
run
_t
est
(
unsigned
int
num
,
const
std
::
function
<
bool
()
>
func
)
void
run
T
est
(
unsigned
int
num
,
const
std
::
function
<
bool
()
>
func
)
{
bool
ok
;
...
...
@@ -81,21 +85,19 @@ void run_test(unsigned int num, const std::function<bool()> func)
std
::
cout
<<
"Test "
<<
num
<<
" failed
\n
"
;
}
bool
test1
()
std
::
string
createTmpFile
()
{
namespace
fs
=
boost
::
filesystem
;
static
const
std
::
string
symbols
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
;
char
pattern
[]
=
"/tmp/fileXXXXXX"
;
char
*
dir
=
::
mkdtemp
(
pattern
);
if
(
dir
==
nullptr
)
die
(
"Could not create directory"
);
const
std
::
string
directory
=
std
::
string
(
dir
)
;
const
std
::
string
filename
=
directory
+
"/foo"
;
return
std
::
string
(
dir
)
+
"/foo"
;
}
size_t
n
=
10
*
DEFAULT_AIO_FILE_BLOCK_SIZE
;
std
::
string
generateString
(
size_t
n
)
{
static
const
std
::
string
symbols
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
;
std
::
string
buf
;
buf
.
reserve
(
n
);
...
...
@@ -103,6 +105,17 @@ bool test1()
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
buf
+=
symbols
[
i
%
symbols
.
length
()];
return
buf
;
}
bool
test1
()
{
std
::
string
filename
=
createTmpFile
();
size_t
n
=
10
*
DEFAULT_AIO_FILE_BLOCK_SIZE
;
std
::
string
buf
=
generateString
(
n
);
{
DB
::
WriteBufferAIO
out
(
filename
,
3
*
DEFAULT_AIO_FILE_BLOCK_SIZE
);
...
...
@@ -121,32 +134,18 @@ bool test1()
std
::
string
received
{
std
::
istreambuf_iterator
<
char
>
(
in
),
std
::
istreambuf_iterator
<
char
>
()
};
in
.
close
();
fs
::
remove_all
(
directory
);
fs
::
remove_all
(
fs
::
path
(
filename
).
parent_path
().
string
()
);
return
(
received
==
buf
);
}
bool
test2
()
{
namespace
fs
=
boost
::
filesystem
;
static
const
std
::
string
symbols
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
;
char
pattern
[]
=
"/tmp/fileXXXXXX"
;
char
*
dir
=
::
mkdtemp
(
pattern
);
if
(
dir
==
nullptr
)
die
(
"Could not create directory"
);
const
std
::
string
directory
=
std
::
string
(
dir
);
const
std
::
string
filename
=
directory
+
"/foo"
;
std
::
string
filename
=
createTmpFile
();
size_t
n
=
10
*
DEFAULT_AIO_FILE_BLOCK_SIZE
;
std
::
string
buf
;
buf
.
reserve
(
n
);
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
buf
+=
symbols
[
i
%
symbols
.
length
()];
std
::
string
buf
=
generateString
(
n
);
{
DB
::
WriteBufferAIO
out
(
filename
,
3
*
DEFAULT_AIO_FILE_BLOCK_SIZE
);
...
...
@@ -168,7 +167,7 @@ bool test2()
std
::
string
received
{
std
::
istreambuf_iterator
<
char
>
(
in
),
std
::
istreambuf_iterator
<
char
>
()
};
in
.
close
();
fs
::
remove_all
(
directory
);
fs
::
remove_all
(
fs
::
path
(
filename
).
parent_path
().
string
()
);
if
(
received
.
substr
(
0
,
buf
.
length
()
/
2
)
!=
buf
.
substr
(
0
,
buf
.
length
()
/
2
))
return
false
;
...
...
@@ -182,25 +181,11 @@ bool test2()
bool
test3
()
{
namespace
fs
=
boost
::
filesystem
;
static
const
std
::
string
symbols
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
;
char
pattern
[]
=
"/tmp/fileXXXXXX"
;
char
*
dir
=
::
mkdtemp
(
pattern
);
if
(
dir
==
nullptr
)
die
(
"Could not create directory"
);
const
std
::
string
directory
=
std
::
string
(
dir
);
const
std
::
string
filename
=
directory
+
"/foo"
;
std
::
string
filename
=
createTmpFile
();
size_t
n
=
10
*
DEFAULT_AIO_FILE_BLOCK_SIZE
;
std
::
string
buf
;
buf
.
reserve
(
n
);
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
buf
+=
symbols
[
i
%
symbols
.
length
()];
std
::
string
buf
=
generateString
(
n
);
{
DB
::
WriteBufferAIO
out
(
filename
,
3
*
DEFAULT_AIO_FILE_BLOCK_SIZE
);
...
...
@@ -229,32 +214,18 @@ bool test3()
std
::
string
received
{
std
::
istreambuf_iterator
<
char
>
(
in
),
std
::
istreambuf_iterator
<
char
>
()
};
in
.
close
();
fs
::
remove_all
(
directory
);
fs
::
remove_all
(
fs
::
path
(
filename
).
parent_path
().
string
()
);
return
(
received
==
buf
.
substr
(
0
,
buf
.
length
()
/
2
));
}
bool
test4
()
{
namespace
fs
=
boost
::
filesystem
;
static
const
std
::
string
symbols
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
;
char
pattern
[]
=
"/tmp/fileXXXXXX"
;
char
*
dir
=
::
mkdtemp
(
pattern
);
if
(
dir
==
nullptr
)
die
(
"Could not create directory"
);
const
std
::
string
directory
=
std
::
string
(
dir
);
const
std
::
string
filename
=
directory
+
"/foo"
;
std
::
string
filename
=
createTmpFile
();
size_t
n
=
10
*
DEFAULT_AIO_FILE_BLOCK_SIZE
;
std
::
string
buf
;
buf
.
reserve
(
n
);
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
buf
+=
symbols
[
i
%
symbols
.
length
()];
std
::
string
buf
=
generateString
(
n
);
{
DB
::
WriteBufferAIO
out
(
filename
,
3
*
DEFAULT_AIO_FILE_BLOCK_SIZE
);
...
...
@@ -283,7 +254,7 @@ bool test4()
std
::
string
received
{
std
::
istreambuf_iterator
<
char
>
(
in
),
std
::
istreambuf_iterator
<
char
>
()
};
in
.
close
();
fs
::
remove_all
(
directory
);
fs
::
remove_all
(
fs
::
path
(
filename
).
parent_path
().
string
()
);
if
(
received
.
substr
(
0
,
buf
.
length
())
!=
buf
)
return
false
;
...
...
@@ -296,25 +267,11 @@ bool test4()
bool
test5
()
{
namespace
fs
=
boost
::
filesystem
;
static
const
std
::
string
symbols
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
;
char
pattern
[]
=
"/tmp/fileXXXXXX"
;
char
*
dir
=
::
mkdtemp
(
pattern
);
if
(
dir
==
nullptr
)
die
(
"Could not create directory"
);
const
std
::
string
directory
=
std
::
string
(
dir
);
const
std
::
string
filename
=
directory
+
"/foo"
;
std
::
string
filename
=
createTmpFile
();
size_t
n
=
10
*
DEFAULT_AIO_FILE_BLOCK_SIZE
;
std
::
string
buf
;
buf
.
reserve
(
n
);
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
buf
+=
symbols
[
i
%
symbols
.
length
()];
std
::
string
buf
=
generateString
(
n
);
{
DB
::
WriteBufferAIO
out
(
filename
,
3
*
DEFAULT_AIO_FILE_BLOCK_SIZE
);
...
...
@@ -335,32 +292,18 @@ bool test5()
std
::
string
received
{
std
::
istreambuf_iterator
<
char
>
(
in
),
std
::
istreambuf_iterator
<
char
>
()
};
in
.
close
();
fs
::
remove_all
(
directory
);
fs
::
remove_all
(
fs
::
path
(
filename
).
parent_path
().
string
()
);
return
received
.
substr
(
1
)
==
buf
;
}
bool
test6
()
{
namespace
fs
=
boost
::
filesystem
;
static
const
std
::
string
symbols
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
;
char
pattern
[]
=
"/tmp/fileXXXXXX"
;
char
*
dir
=
::
mkdtemp
(
pattern
);
if
(
dir
==
nullptr
)
die
(
"Could not create directory"
);
const
std
::
string
directory
=
std
::
string
(
dir
);
const
std
::
string
filename
=
directory
+
"/foo"
;
std
::
string
filename
=
createTmpFile
();
size_t
n
=
10
*
DEFAULT_AIO_FILE_BLOCK_SIZE
;
std
::
string
buf
;
buf
.
reserve
(
n
);
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
buf
+=
symbols
[
i
%
symbols
.
length
()];
std
::
string
buf
=
generateString
(
n
);
std
::
string
buf2
=
"1111111111"
;
...
...
@@ -385,7 +328,7 @@ bool test6()
std
::
string
received
{
std
::
istreambuf_iterator
<
char
>
(
in
),
std
::
istreambuf_iterator
<
char
>
()
};
in
.
close
();
fs
::
remove_all
(
directory
);
fs
::
remove_all
(
fs
::
path
(
filename
).
parent_path
().
string
()
);
if
(
received
.
substr
(
3
,
8
*
DEFAULT_AIO_FILE_BLOCK_SIZE
)
!=
buf
.
substr
(
0
,
8
*
DEFAULT_AIO_FILE_BLOCK_SIZE
))
return
false
;
...
...
@@ -401,17 +344,7 @@ bool test6()
bool
test7
()
{
namespace
fs
=
boost
::
filesystem
;
static
const
std
::
string
symbols
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
;
char
pattern
[]
=
"/tmp/fileXXXXXX"
;
char
*
dir
=
::
mkdtemp
(
pattern
);
if
(
dir
==
nullptr
)
die
(
"Could not create directory"
);
const
std
::
string
directory
=
std
::
string
(
dir
);
const
std
::
string
filename
=
directory
+
"/foo"
;
std
::
string
filename
=
createTmpFile
();
std
::
string
buf2
=
"11111111112222222222"
;
...
...
@@ -441,24 +374,14 @@ bool test7()
return
false
;
in
.
close
();
fs
::
remove_all
(
directory
);
fs
::
remove_all
(
fs
::
path
(
filename
).
parent_path
().
string
()
);
return
true
;
}
bool
test8
()
{
namespace
fs
=
boost
::
filesystem
;
static
const
std
::
string
symbols
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
;
char
pattern
[]
=
"/tmp/fileXXXXXX"
;
char
*
dir
=
::
mkdtemp
(
pattern
);
if
(
dir
==
nullptr
)
die
(
"Could not create directory"
);
const
std
::
string
directory
=
std
::
string
(
dir
);
const
std
::
string
filename
=
directory
+
"/foo"
;
std
::
string
filename
=
createTmpFile
();
std
::
string
buf2
=
"11111111112222222222"
;
...
...
@@ -488,32 +411,18 @@ bool test8()
return
false
;
in
.
close
();
fs
::
remove_all
(
directory
);
fs
::
remove_all
(
fs
::
path
(
filename
).
parent_path
().
string
()
);
return
true
;
}
bool
test9
()
{
namespace
fs
=
boost
::
filesystem
;
static
const
std
::
string
symbols
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
;
char
pattern
[]
=
"/tmp/fileXXXXXX"
;
char
*
dir
=
::
mkdtemp
(
pattern
);
if
(
dir
==
nullptr
)
die
(
"Could not create directory"
);
const
std
::
string
directory
=
std
::
string
(
dir
);
const
std
::
string
filename
=
directory
+
"/foo"
;
std
::
string
filename
=
createTmpFile
();
size_t
n
=
3
*
DEFAULT_AIO_FILE_BLOCK_SIZE
;
std
::
string
buf
;
buf
.
reserve
(
n
);
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
buf
+=
symbols
[
i
%
symbols
.
length
()];
std
::
string
buf
=
generateString
(
n
);
std
::
string
buf2
(
DEFAULT_AIO_FILE_BLOCK_SIZE
+
10
,
'1'
);
...
...
@@ -538,7 +447,7 @@ bool test9()
std
::
string
received
{
std
::
istreambuf_iterator
<
char
>
(
in
),
std
::
istreambuf_iterator
<
char
>
()
};
in
.
close
();
fs
::
remove_all
(
directory
);
fs
::
remove_all
(
fs
::
path
(
filename
).
parent_path
().
string
()
);
if
(
received
.
substr
(
3
,
2
*
DEFAULT_AIO_FILE_BLOCK_SIZE
)
!=
buf
.
substr
(
0
,
2
*
DEFAULT_AIO_FILE_BLOCK_SIZE
))
return
false
;
...
...
@@ -551,25 +460,11 @@ bool test9()
bool
test10
()
{
namespace
fs
=
boost
::
filesystem
;
static
const
std
::
string
symbols
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
;
char
pattern
[]
=
"/tmp/fileXXXXXX"
;
char
*
dir
=
::
mkdtemp
(
pattern
);
if
(
dir
==
nullptr
)
die
(
"Could not create directory"
);
const
std
::
string
directory
=
std
::
string
(
dir
);
const
std
::
string
filename
=
directory
+
"/foo"
;
std
::
string
filename
=
createTmpFile
();
size_t
n
=
10
*
DEFAULT_AIO_FILE_BLOCK_SIZE
+
3
;
std
::
string
buf
;
buf
.
reserve
(
n
);
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
buf
+=
symbols
[
i
%
symbols
.
length
()];
std
::
string
buf
=
generateString
(
n
);
{
DB
::
WriteBufferAIO
out
(
filename
,
3
*
DEFAULT_AIO_FILE_BLOCK_SIZE
);
...
...
@@ -589,7 +484,7 @@ bool test10()
std
::
string
received
{
std
::
istreambuf_iterator
<
char
>
(
in
),
std
::
istreambuf_iterator
<
char
>
()
};
in
.
close
();
fs
::
remove_all
(
directory
);
fs
::
remove_all
(
fs
::
path
(
filename
).
parent_path
().
string
()
);
return
(
received
==
buf
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录