UnityChipForXiangShan/documents/content/zh-cn/docs/02_run_test.md

1.4 KiB
Raw Permalink Blame History

title linkTitle weight
运行测试 运行测试 14

本项目基于PyTest测试框架进行验证。运行测试时PyTest框架自动搜索所有test_*.py文件,并自动执行其中所有以test_开头的测试用例Test Case

# 执行所有ut_*目录中的test case
make test_all
# 执行指定目录下的test case
make test target=<dir>
# 例如执行ut_backend/ctrl_block/decode目录中所有的test case
make test target=ut_backend/ctrl_block/decode

可通过args参数传递Pytest的运行参数例如启动x-dist插件的多核功能

make test args="-n 4"     # 启用 4 个进程
make test args="-n auto"  # 让框架自动选择启用多少个进程

*注x-dist可以在多节点上并发运行测试可参考其文档

运行完成后,默认在out/report目录会生成html版本的测试报告其 html 文件可通过浏览器直接打开查看VS Code IDE建议安装Open In Default Browser插件)。

运行测试主要完成以下三部分内容:

  1. 按要求运行Test Case可通过cfg.tests中的选项进行配置
  2. 统计测试结果输出测试报告。有toffee-report自动生成 (总测试报告所有Test的结果合并在一起)
  3. 根据需要(cfg.doc_result.disable = True)在测试报告上进行进一步数据统计