1. 整体测试

直接运行runltp命令,将测试/opt/ltp/scenario_groups/default文件中所有的测试集。测试时间比较长一次测试约 2 ~ 3 小时。

[root@localhost ~]# /opt/ltp/runltp

2. 测试集测试

由于完整测试时间比较,需要对某个功能进行测试时,可以采用测试集测试单个模块,测试集可以在ltp/runtest/下查看测试集

[root@localhost ~]# ls /opt/ltp/runtest/
can          crypto              fs               input             ltp-aiodio.part3      net.ipv6_lib          net_stress.interface   net.tcp_cmds                      s390x_tests       tpm_tools
cap_bounds   cve                 fs_bind          io                ltp-aiodio.part4      net.multicast         net_stress.ipsec_dccp  net.tirpc_tests                   sched             tracing
commands     demoA               fs_perms_simple  io_cd             ltp-aio-stress.part1  net.nfs               net_stress.ipsec_icmp  nptl                              scsi_debug.part1  uevent
connectors   dio                 fs_readonly      io_floppy         ltp-aio-stress.part2  net.rpc               net_stress.ipsec_sctp  numa                              securebits        unlink
containers   dma_thread_diotest  fsx              ipc               math                  net.rpc_tests         net_stress.ipsec_tcp   power_management_tests            smack
controllers  echo                hugetlb          kernel_misc       mm                    net.sctp              net_stress.ipsec_udp   power_management_tests_exclusive  smoketest
cpuhotplug   fcntl-locktests     hyperthreading   ltp-aiodio.part1  net.features          net_stress.appl       net_stress.multicast   pty                               syscalls
crashme      filecaps            ima              ltp-aiodio.part2  net.ipv6              net_stress.broken_ip  net_stress.route       rm                                syscalls-ipc

需要注意的是,如果我们测试某个测试集,runltp 需要指定-f参数。如进行内存测试集测试命令如下。

[root@localhost ~]# /opt/ltp/runltp -f mm

3.单独测试

如果我们只想对某个测试项进行测试,不想测试某个测试集,可以采用安装包测试或者源码包测试。下面以 pipe01 为例,讲解单独测试。

安装包测试

进入安装包,直接执行以下命令即可。

[root@localhost ~]# cd /opt/ltp/
[root@localhost ~]# ./runltp -s pipe01

源码包测试

进入源码包,找到 pipe01 所在文件夹的位置,直接执行./access01即可。

[root@localhost ~]# cd /root/ltp-20210524/testcases/kernel/syscalls/pipe
[root@localhost ~]# ./pipe01
tst_test.c:1313: TINFO: Timeout per run is 0h 05m 00s
pipe01.c:48: TPASS: pipe() functionality is correct

Summary:
passed   1
failed   0
broken   0
skipped  0
warnings 0