# autotest **Repository Path**: wang-ziqi-code/autotest ## Basic Information - **Project Name**: autotest - **Description**: MindSpore测试工具 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2023-08-02 - **Last Updated**: 2023-08-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # AutoTest #### 介绍 MindSpore测试 #### 使用说明 1. `~/.bashrc`中加上 ``` alias autotest="python /path/to/the/script/autotest.py" ``` 重新登陆shell。 2. `autotest --help` 查看帮助信息。未列出的所有参数设定将自动转给pytest。 ``` usage: autotest [-h] [--whl WHL] [--target TARGET] [--mode {pynative,graph,all}] [--clean-pip] [--mslog LEVEL] [--ascendlog LEVEL] [--dlog] [--no-dlog] [--ge] [--ge-graph] [--xml DIR] [--xml-prefix PREFIX] [--xml-suffix SUFFIX] [--file FILE][--dump NET] optional arguments: -h, --help show this help message and exit --whl WHL Install the wheel file with the provided path . Or download the file first if a URL is provided. --target TARGET Device target. 1=ascend, 2=cpu, 4=gpu. Use addition as combination --mode {pynative,graph,all} Mode. --clean-pip Uninstall wheel after test. --mslog LEVEL Set MindSpore log level. --ascendlog LEVEL Set Ascend log level. --dlog Print Ascend device error log to stdout. ON by default. --no-dlog --ge GE mode on ascend. --ge-graph store GE graph to folder "ge_graph". --xml DIR Dump JunitXML of test at given path. --xml-prefix PREFIX Prepend to xml file name. --xml-suffix SUFFIX Append to xml file name. --file FILE Load test names from file. --dump NET Dump network. All kernels are dumped in npy format. ``` 一些示例: 下载门禁包并测试全平台全模式 ``` autotest --whl whl_url --target 7 --mode all -s operation/test_sin.py ``` 仅测试CPU+GPU (2+4=6) 的图模式 ``` autotest --target 6 --mode graph -s operation/test_sin.py ``` 设置MindSpore glog level ``` autotest --mslog 2 ``` 走GE流程, 并且保存ge图 ``` autotest --ge --ge-graph ``` 从文件中读取测试名,测试普通流程和ge流程,保存测试结果并生成html报告。 ```shell mkdir xml autotest --file tests_batch1.txt --xml xml --xml-suffix batch1 --ge # --> ./xml/ge_graph_ascend_batch1.xml autotest --file tests_batch1.txt --xml xml --xml-suffix batch1 --mode graph # --> ./xml/graph_ascend_batch1.xml cd xml report ge_graph_ascend_batch1.xml graph_ascend_batch1.xml report.html # --> report.html ``` 报告示例: ![image](report.png)