Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Second State
SSVM
提交
6a2a62cd
S
SSVM
项目概览
Second State
/
SSVM
通知
5
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SSVM
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
6a2a62cd
编写于
2月 01, 2021
作者:
Y
YiYing He
提交者:
hydai
2月 04, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Test] Add memory page limitation test.
上级
70bf31af
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
58 addition
and
0 deletion
+58
-0
test/CMakeLists.txt
test/CMakeLists.txt
+1
-0
test/memlimit/CMakeLists.txt
test/memlimit/CMakeLists.txt
+13
-0
test/memlimit/MemLimitTest.cpp
test/memlimit/MemLimitTest.cpp
+44
-0
未找到文件。
test/CMakeLists.txt
浏览文件 @
6a2a62cd
...
@@ -13,6 +13,7 @@ add_subdirectory(externref)
...
@@ -13,6 +13,7 @@ add_subdirectory(externref)
add_subdirectory
(
expected
)
add_subdirectory
(
expected
)
add_subdirectory
(
span
)
add_subdirectory
(
span
)
add_subdirectory
(
po
)
add_subdirectory
(
po
)
add_subdirectory
(
memlimit
)
if
(
BUILD_COVERAGE
)
if
(
BUILD_COVERAGE
)
setup_target_for_coverage_gcovr_html
(
setup_target_for_coverage_gcovr_html
(
...
...
test/memlimit/CMakeLists.txt
0 → 100644
浏览文件 @
6a2a62cd
# SPDX-License-Identifier: Apache-2.0
add_executable
(
ssvmMemLimitTests
MemLimitTest.cpp
)
add_test
(
ssvmMemLimitTests ssvmMemLimitTests
)
target_link_libraries
(
ssvmMemLimitTests
PRIVATE
utilGoogleTest
ssvmVM
)
test/memlimit/MemLimitTest.cpp
0 → 100644
浏览文件 @
6a2a62cd
// SPDX-License-Identifier: Apache-2.0
#include "common/configure.h"
#include "runtime/instance/memory.h"
#include "gtest/gtest.h"
namespace
{
TEST
(
MemLimitTest
,
Limit__Pages
)
{
using
MemInst
=
SSVM
::
Runtime
::
Instance
::
MemoryInstance
;
SSVM
::
Configure
Conf
;
Conf
.
setMaxMemoryPage
(
256
);
SSVM
::
AST
::
Limit
Lim1
(
257
);
MemInst
Inst1
(
Lim1
,
Conf
.
getMaxMemoryPage
());
ASSERT_TRUE
(
Inst1
.
getDataPtr
()
==
nullptr
);
MemInst
Inst2
(
Lim1
);
ASSERT_FALSE
(
Inst2
.
getDataPtr
()
==
nullptr
);
SSVM
::
AST
::
Limit
Lim2
(
1
);
MemInst
Inst3
(
Lim2
,
Conf
.
getMaxMemoryPage
());
ASSERT_FALSE
(
Inst3
.
getDataPtr
()
==
nullptr
);
ASSERT_FALSE
(
Inst3
.
growPage
(
256
));
ASSERT_TRUE
(
Inst3
.
growPage
(
255
));
MemInst
Inst4
(
Lim2
);
ASSERT_FALSE
(
Inst4
.
getDataPtr
()
==
nullptr
);
ASSERT_TRUE
(
Inst4
.
growPage
(
256
));
SSVM
::
AST
::
Limit
Lim3
(
1
,
128
);
MemInst
Inst5
(
Lim3
,
Conf
.
getMaxMemoryPage
());
ASSERT_FALSE
(
Inst5
.
getDataPtr
()
==
nullptr
);
ASSERT_FALSE
(
Inst5
.
growPage
(
128
));
ASSERT_TRUE
(
Inst5
.
growPage
(
127
));
}
}
// namespace
GTEST_API_
int
main
(
int
argc
,
char
**
argv
)
{
SSVM
::
Log
::
setErrorLoggingLevel
();
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录