# Maple 测试框架
## 目录结构
```shell
test
├── main.py 运行测试套入口
├── maple_test 测试框架代码
│ ├── compare.py 结果校验模块
│ ├── configs.py 参数设置与框架配置文件模块
│ ├── __init__.py
│ ├── main.py 内部入口
│ ├── maple_test.cfg 测试框架配置文件
│ ├── run.py 命令运行模块
│ ├── task.py 测试任务准备与运行模块
│ ├── template.cfg 测试套配置文件模板
│ ├── test.py 测试用例模块
│ └── utils.py 通用模块
├── README.md 测试框架说明
└── testsuite
├── irbuild_test irbuild测试套
├── ouroboros ouroboros测试套
│ ├──test.cfg 测试套配置文件
│ └──testlist 测试内容
├──maple.py 用例编译脚本
└──run.py 用例执行脚本
```
## 运行要求
- python版本>=3.5.2
## 修改框架配置
文件:maple_test.cfg
```ini
[test-home]
# 指定测试套路径,以‘:’划分
dir = ../testsuite/irbuild_test:../testsuite/ouroboros:
[running]
# 指定运行时的临时路径
temp_dir = ../test_temp/run
[logging]
# 指定运行时保存日志的路径
name = ../test_temp/log
level = INFO
```
## 运行说明
依赖环境变量:MAPLE_ROOT
### 运行测试套
#### irbuild_test
```
python3 test/main.py test/testsuite/irbuild_test --test_cfg=test/testsuite/irbuild_test/<test_cfg_file> -j20 -pFAIL
```
#### ouroboros
```
python3 test/main.py test/testsuite/ouroboros --test_cfg=test/testsuite/ouroboros/<test_cfg_file> -j20 -pFAIL
```
参数说明:指定参数会覆盖框架配置文件中的设置
```txt
usage: main.py [-h] [--cfg CFG] [-j <mum>] [--retry <num>] [--output <file>]
[--debug] [--fail_exit]
[-p {PASS,FAIL,XFAIL,XPASS,UNSUPPORTED,UNRESOLVED}]
[--progress {silent,normal,no_flush_progress}]
[--test_cfg <TEST_CFG_FILE>] [--test_list <TEST_LIST_FILE>]
[-c config set path] [-C key=value] [-E key=value]
[--temp_dir <TEMP_DIR_PATH>] [--timeout TIMEOUT]
[--log_dir <LOG_DIR_FILE_PATH>] [--log_level LOG_LEVEL]
[--verbose]
[test_paths [test_paths ...]]
optional arguments:
-h, --help show this help message and exit
Test FrameWork arguments:
--cfg CFG Test framework configuration file
-j <mum> Run <num> cases in parallel
--retry <num> Re-run unsuccessful test cases
--output <file> Store test result at <file>
--debug keep test temp file
--fail_exit Execute test framework with a non-zero exit code if
any tests fail
-p {PASS,FAIL,XFAIL,XPASS,UNSUPPORTED,UNRESOLVED}
Print test cases with specified results, -pPASS
-pFAIL, to print all test case that failed or passed,
UNRESOLVED test case results are not displayed by
default.
--progress {silent,normal,no_flush_progress}
set progress type, silent: Don't show progress,
normal: one line progress bar, update per
second,no_flush_progress: print test progress per 10
seconds
Test Suite arguments:
test_paths Test suite path
--test_cfg <TEST_CFG_FILE>
test suite config file, needed when run a single case
or with --test_list
--test_list <TEST_LIST_FILE>
testlist path for filter test cases
-c config set path, --config_set config set path
Run a test set with the specified config set path
-C key=value, --config key=value
Add 'key' = 'val' to the user defined configs
-E key=value, --env key=value
Add 'key' = 'val' to the user defined environment
variable
Running arguments:
--temp_dir <TEMP_DIR_PATH>
Location for test execute.
--timeout TIMEOUT test case timeout
Log arguments:
--log_dir <LOG_DIR_FILE_PATH>
Where to store test log
--log_level LOG_LEVEL, -l LOG_LEVEL
set log level from: CRITICAL, ERROR, WARNING, INFO,
DEBUG, NOTSET
--verbose enable verbose output
```
## 测试框架编码支持说明
当前测试框架仅支持编码格式为 `UTF-8`,测试用例和配置文件仅支持 `UTF-8` 编码格式,如果测试用例编码非 `UTF-8` 测试用例会被认定为 `UNRESOLVED`
## ouroboros 测试套
ouroboros测试套是基于 `Java` 测试用例的测试套。
### 测试环境准备
* 本地测试前请首先执行完成`make libcore`。
### 运行测试套
* 参数`--test_cfg`设定选择的测试套配置,默认使用`test.cfg`进行本地测试。
批量运行ouroboros:参数 `-j20` 设定并行为20。
`python3 test/main.py test/testsuite/ouroboros/ --test_cfg=test/testsuite/ouroboros/<test_cfg_file> -j20`
运行ourobors下的子文件夹:
`python3 test/main.py test/testsuite/ouroboros/string_test --test_cfg=test/testsuite/ouroboros/<test_cfg_file> -j20`
运行ourobors下的单一测试用例:
`python3 test/main.py test/testsuite/ouroboros/string_test/RT0001-rt-string-ReflectString/ReflectString.java --test_cfg=test/testsuite/ouroboros/<test_cfg_file>`
只输出失败用例:
`python3 test/main.py test/testsuite/ouroboros/string_test/RT0001-rt-string-ReflectString/ReflectString.java --test_cfg=test/testsuite/ouroboros/<test_cfg_file> -pFAIL`
屏幕输出详细运行日志:
`python3 test/main.py test/testsuite/ouroboros/string_test/RT0001-rt-string-ReflectString/ReflectString.java --test_cfg=test/testsuite/ouroboros/<test_cfg_file> --verbose`
### 测试套配置
测试套配置文件路径在 `testsuite/ourobors/`下, 以`test.cfg`为例,其中含有测试套的一些设置和内部变量
```ini
[suffix]
java = //
[internal-var]
maple = <用例编译脚本>
run = <用运行脚本>
build_option = <编译脚本参数>
run_option = <运行脚本参数>
[description]
title = Maple Ouroboros Test
```
**`[suffix]`**:限定搜索测试用例文件的后缀,以及测试用例中注释符,注释符后会跟随执行语句或者校验语句,当前测试套中的用例为 `java` 文件,`//` 作为注释符。
**`[internal-val]`**:内部变量,此处的内部变量会替换用例中相应的变量。例如配置文件中的 `maple = python3 ${MAPLE_ROOT}/test/testsuite/maple.py` ,将会将用例中跟随在 `\\ EXEC: ` 之后的执行语句中的 `%maple` 替换为 `python3 ${MAPLE_ROOT}/test/testsuite/maple.py`。
**`[description]`**:测试套的描述信息。
### 测试套列表
默认测试列表路径为 `testsuite/ourobors/testlist`,测试列表规定了运行测试用例的范围,同时指定了排除的测试用例。
```ini
[ALL-TEST-CASE]
arrayboundary_test
clinit_test
eh_test
fuzzapi_test
other_test
parent_test
reflection_test
stmtpre_test
string_test
subsumeRC_test
thread_test
unsafe_test
memory_management
[EXCLUDE-TEST-CASE]
memory_management/Annotation
```
由两个部分组成:`[ALL-TEST-CASE]` 与 `[EXCLUDE-TEST-CASE]`
**`[ALL-TEST-CASE]`**: 指定了运行测试用例的范围。
**`[EXCLUDE-TEST-CASE]`**: 不运行的测试用例。
当前测试用例排除了测试套 `testsuite/ourobors` 下子文件夹 `memory_management/Annotation` 中所有的用例文件,及部分其他用例。
## irbuild测试套
irbuild用于对maple中端产物进行测试,仅进行本地测试,不支持手机测试。
irbuild测试套配置:testsuite/irbuild_test/test.cfg
如果涉及脚本的运行路径需要填�
没有合适的资源?快使用搜索试试~ 我知道了~
面向多设备、支持多语言的统一编程平台
共2000个文件
c:1018个
txt:919个
h:46个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 123 浏览量
2023-12-27
11:18:32
上传
评论
收藏 30MB ZIP 举报
温馨提示
面向多设备、支持多语言的统一编程平台。能够将不同语言代码编译成一套可执行文件,在运行环境中高效执行:支持多语言联合优化、消除跨语言调用开销;更轻量的语言运行时;软硬协同充分发挥硬件能效;支持多样化的终端设备平台
资源推荐
资源详情
资源评论
收起资源包目录
面向多设备、支持多语言的统一编程平台 (2000个子文件)
ReedSolomon.c 14KB
strlen-5.c 13KB
conversion.c 12KB
pr58574.c 11KB
asm.c 10KB
boundary_check_funcptr.c 9KB
flexibleArray.c 8KB
boundary_check_funcptr.c 7KB
memset-2.c 7KB
nonnull_check_warning.c 7KB
ashrdi-1.c 7KB
boundary_check_funcptr.c 6KB
990326-1.c 6KB
va-arg-2.c 6KB
boundary_check_funcptr.c 6KB
memchr-1.c 6KB
20020506-1.c 5KB
20030323-1.c 5KB
boundary_count_array_insert.c 5KB
20020402-2.c 5KB
ashldi-1.c 5KB
strlen-2.c 5KB
nonnull_check_funcptr.c 5KB
va-arg-10.c 5KB
cc_sret.c 4KB
20101011-1.c 4KB
nonnull_check_funcptr.c 4KB
va-arg-9.c 4KB
tdate.c 4KB
20040709-2.c 4KB
main.c 4KB
cmpdi-1.c 4KB
boundary_check_funcptr.c 4KB
memset-3.c 4KB
boundary_check_funcptr.c 4KB
boundary_count_insert.c 4KB
boundary_check_funcptr.c 4KB
boundary_check_funcptr.c 4KB
nonnull_check_var.c 4KB
builtin-prefetch-3.c 4KB
20040629-1.c 4KB
20040629-1.c 4KB
boundary_check_funcptr.c 3KB
gofast.c 3KB
cmpsf-1.c 3KB
20040703-1.c 3KB
20090113-2.c 3KB
boundary_count_field.c 3KB
nonnull_check_field.c 3KB
boundary_count_var.c 3KB
scal-to-vec1.c 3KB
pr51581-2.c 3KB
defaultSafe.c 3KB
boundary_string.c 3KB
strncmp-1.c 3KB
boundary_count_insert.c 3KB
pr51581-1.c 3KB
pr20527-1.c 3KB
pr23324.c 3KB
20090113-3.c 3KB
safe_region.c 3KB
pr39501.c 3KB
boundary_count_field.c 3KB
20190820-1.c 3KB
nonnull_check_insert.c 3KB
pr80421.c 3KB
safe_region.c 3KB
nonnull_check_if_err.c 3KB
return-addr.c 3KB
set.c 2KB
20020404-1.c 2KB
20020406-1.c 2KB
boundary_count_return_insert.c 2KB
cc_param3.c 2KB
boundary_byte_count.c 2KB
stdarg-2.c 2KB
test7.c 2KB
20020508-1.c 2KB
nonnull_check_if.c 2KB
boundary_count_field.c 2KB
stdarg-4.c 2KB
20020508-2.c 2KB
fmaxminl.c 2KB
20071120-1.c 2KB
cc_param1.c 2KB
boundary_count_call_insert.c 2KB
test13.c 2KB
nonnull_check_funcptr.c 2KB
boundary_func_11.c 2KB
pr92140.c 2KB
stdarg-1.c 2KB
puzzle.c 2KB
align-2.c 2KB
nonnull_check_call.c 2KB
boundary_count_malloc.c 2KB
extensions.c 2KB
inline_nonnull_check_return_warning.c 2KB
test11.c 2KB
nonnull_check_ternary.c 2KB
bf-sign-2.c 2KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
Java程序员-张凯
- 粉丝: 1w+
- 资源: 6732
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功