LTP(Linux Test Project)学习(二)——LTP下载编译执行

下载
1)网站下载
登陆 https://github.com/linux-test-project/ltp
点击 Clone or download 下载zip
2)git下载
git clone https://github.com/linux-test-project/ltp.git
git clone [email protected]:linux-test-project/ltp.git
3) 下载releases:
https://github.com/linux-test-project/ltp/releases
下载release版本
建议采用2方式下载,可以git查看修改和历史记录,如果想贡献代码,比如git clone下载

编译
x86 编译:
1)git clone [email protected]:linux-test-project/ltp.git
2)不做操作使用master分支,或者git checkout 20180515切换到release版本。建议使用master分支,代码最新并且可随时发现提交bug,如果仅仅希望有个稳定的测试版本,可以使用release分支
3)make autotools (生成configure文件)
如果中间报错,看下错误,缺少什么命令装什么命令
4)./configure –prefix=/home/ltp_x86 (初始化编译,–prefix配置编译后二进制目录,默认在/opt/ltp下)
更多配置可以 ./configure –help查看,后面交叉编译会用到这里面参数
5)make && make install
编译好后生成目录/home/ltp_x86

交叉编译(arm64为例)
1)-3)同x86
4)./configure –prefix=/home/ltp_arm64 ./configure CC=aarch64-linux-gnu-gcc –host=sparc64
(初始化编译,–prefix配置编译后二进制目录,CC指定交叉编译工具链,–host指定host主机)
–with-linux-dir=DIR specify path to kernel-devel directory 可以指定编译模块时的kernel-devel目录
5)make && make install
编译好后生成目录/home/ltp_arm64

执行
本人推荐使用执行runtest中文件的方式:
cd /home/ltp_x86
./runltp -f syscalls

syscalls源于 runtest/syscalls,可以打开看下,里面每行代表每个用例,比如
waitid01 waitid01 表示用例名称waitid01,用例执行方式 waitid01(执行前添加testcases/bin到PATH)

这样好处可以定制化跑某些用例,比如 echo “waitid01 waitid01” >> runtest/test,通过./runltp -f test 可以只执行waitid01
这里写图片描述

猜你喜欢

转载自blog.csdn.net/cui841923894/article/details/81463048