一、安装

1. 下载源文件

https://github.com/linux-test-project/ltp/releases/tag/20210524

 2. 解压后安装,默认安装在/opt/ltp

./configure
sudo make
sudo make install

二、执行

1.全集测试

直接运行 runltp 命令将测试 ltp/scenario_groups/default 中的所有测试集

cd /opt/ltp
sudo ./runltp   //全集测试
sudo ./runltp -t 60s |tee ~/LTP/log/runltp_test.log

-t 60s:表示执行60s,全集预计3小时

|tee ~/LTP/log/runltp_test.log:把终端打印测试的日志收集到/home/LTP/log/runltp_test.log文件)

测试结果会在/opt/ltp/results中展示LTP_RUN_ON-实时.log

 2.测试集测试(-f)

/opt/ltp/runtest下有n个测试集(每一个文件就是一个测试集)

sudo ./runltp -f mm //测试内存

sudo ./runltp -f mm -t 60s |tee ~/LTP/log/runltp_test_mm.log

对应执行结果如下:

3.  单条执行(-s)

sudo ./runltp -s bind06 //复测全集测试中的失败项bind06

对应执行结果如下:

sudo ./runltp -s mtest06 //复测单测试集测试中的失败项mtest06

对应执行结果如下:

还可以直接去源文件里面的testcases中找到对应的脚本直接执行

cd /home/ts/LTP/ltp-full-20210524/testcases/kernel/syscalls/bind
sudo ./bind06

三、结果

1. 终端打印测试结果如下(以执行测试集mm为例)

(通过命令|tee ~/LTP/log/runltp_test.log,可以把终端打印的日志保存到home下的.log中)

1.1【Running tests.......】表示测试开始

1.2【PAN will run for 60 seconds】因为输入命令设置了时间-t 60s

1.3   <<<test_start>>> -- <<<test_end>>>之间的内容为单个用例执行的结果

1.4   <<<test_start>>> 后的打印数据

tag=mm01 -- 对应/opt/ltp/runtest中mm中第一行 tag

stime=1625816237 -- 执行此条用例时的时间
cmdline="mmap001 -m 10000" -- 对应/opt/ltp/runtest中mm中第一行 执行命令
contacts=""
analysis=exit

1.5 Summary中skipped表示测试环境不满足而跳过测试

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐