Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
bb5e8b9c
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bb5e8b9c
编写于
8月 12, 2019
作者:
I
Ivan Leskin
提交者:
Ashwin Agrawal
8月 12, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add unit tests for rmgrdesc
Co-authored-by:
N
David Kimura
<
dkimura@pivotal.io
>
上级
b74f174b
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
94 addition
and
0 deletion
+94
-0
src/backend/access/rmgrdesc/test/Makefile
src/backend/access/rmgrdesc/test/Makefile
+7
-0
src/backend/access/rmgrdesc/test/xactdesc_test.c
src/backend/access/rmgrdesc/test/xactdesc_test.c
+87
-0
未找到文件。
src/backend/access/rmgrdesc/test/Makefile
0 → 100644
浏览文件 @
bb5e8b9c
subdir
=
src/backend/access/rmgrdesc
top_builddir
=
../../../../..
include
$(top_builddir)/src/Makefile.global
TARGETS
=
xactdesc
include
$(top_builddir)/src/backend/mock.mk
src/backend/access/rmgrdesc/test/xactdesc_test.c
0 → 100644
浏览文件 @
bb5e8b9c
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include "cmockery.h"
#include "postgres.h"
#include "utils/memutils.h"
#include "access/xlog.h"
#include "pgtime.h"
/* Actual function body */
#include "../xactdesc.c"
static
void
test_xactdescprepareCommit
(
void
**
state
)
{
StringInfo
buf
=
makeStringInfo
();
XLogRecord
*
rec
=
palloc
(
SizeOfXLogRecord
+
MAXALIGN
(
sizeof
(
TwoPhaseFileHeader
)));
rec
->
xl_info
=
XLOG_XACT_PREPARE
;
TwoPhaseFileHeader
*
tpfh
=
(
TwoPhaseFileHeader
*
)
XLogRecGetData
(
rec
);
tpfh
->
prepared_at
=
617826371830030
;
strcpy
(
tpfh
->
gid
,
"4242424242-0000000042"
);
tpfh
->
tablespace_oid_to_delete_on_commit
=
42
;
tpfh
->
tablespace_oid_to_delete_on_abort
=
InvalidOid
;
xact_desc
(
buf
,
rec
);
assert_string_equal
(
"prepare: at = 2019-07-30 18:26:11.83003+00; gid = 4242424242-0000000042; tablespace_oid_to_delete_on_commit = 42"
,
buf
->
data
);
}
static
void
test_xactdescprepareAbort
(
void
**
state
)
{
StringInfo
buf
=
makeStringInfo
();
XLogRecord
*
rec
=
palloc
(
SizeOfXLogRecord
+
MAXALIGN
(
sizeof
(
TwoPhaseFileHeader
)));
rec
->
xl_info
=
XLOG_XACT_PREPARE
;
TwoPhaseFileHeader
*
tpfh
=
(
TwoPhaseFileHeader
*
)
XLogRecGetData
(
rec
);
tpfh
->
prepared_at
=
617826371830030
;
strcpy
(
tpfh
->
gid
,
"4242424242-0000000042"
);
tpfh
->
tablespace_oid_to_delete_on_commit
=
InvalidOid
;
tpfh
->
tablespace_oid_to_delete_on_abort
=
42
;
xact_desc
(
buf
,
rec
);
assert_string_equal
(
"prepare: at = 2019-07-30 18:26:11.83003+00; gid = 4242424242-0000000042; tablespace_oid_to_delete_on_abort = 42"
,
buf
->
data
);
}
static
void
test_xactdescprepareNone
(
void
**
state
)
{
StringInfo
buf
=
makeStringInfo
();
XLogRecord
*
rec
=
palloc
(
SizeOfXLogRecord
+
MAXALIGN
(
sizeof
(
TwoPhaseFileHeader
)));
rec
->
xl_info
=
XLOG_XACT_PREPARE
;
TwoPhaseFileHeader
*
tpfh
=
(
TwoPhaseFileHeader
*
)
XLogRecGetData
(
rec
);
tpfh
->
prepared_at
=
617826371830030
;
strcpy
(
tpfh
->
gid
,
"4242424242-0000000042"
);
tpfh
->
tablespace_oid_to_delete_on_commit
=
InvalidOid
;
tpfh
->
tablespace_oid_to_delete_on_abort
=
InvalidOid
;
xact_desc
(
buf
,
rec
);
assert_string_equal
(
"prepare: at = 2019-07-30 18:26:11.83003+00; gid = 4242424242-0000000042"
,
buf
->
data
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
cmockery_parse_arguments
(
argc
,
argv
);
MemoryContextInit
();
pg_timezone_initialize
();
const
UnitTest
tests
[]
=
{
unit_test
(
test_xactdescprepareCommit
),
unit_test
(
test_xactdescprepareAbort
),
unit_test
(
test_xactdescprepareNone
)
};
return
run_tests
(
tests
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录