基于linux5.15.5的IMX 参考手册 --- 19

基于linux5.15.5的IMX 参考手册 — 19

第十章 单元测试
10.1系统
10.1.1 OProfile
10.1.1.1测试名称
•autorun-oprofile.sh
10.1.1.1.1位置
/unit_tests/OProfile/
10.1.1.1.2功能
OProfile是一个系统范围的分析器,能够以较低的开销分析所有正在运行的代码。OProfile由一个内核驱动程序、一个用于收集样例数据的守护进程和几个用于将数据转换为信息的后分析工具组成。
10.1.1.1.3配置
没有
10.1.1.1.4用例和预期结果
./autorun-oprofile.sh
10.1.2 Owire
10.1.2.1测试名称
•autorun-owire.sh
10.1.2.1.1位置
./autorun-oprofile.sh
10.1.2.1.2功能
测试EEPROM功能。
10.1.2.1.3配置
没有
10.1.2.1.4用例和预期输出
./autorun-oprofile.sh
10.1.3电源管理
10.1.3.1测试名称
• /unit_tests/Power_Management/suspend_random_auto.sh
• /unit_tests/Power_Management/suspend_quick_auto.sh
10.1.3.1.1位置
/unit_tests/Power_Management/
10.1.3.1.2功能
启用低功率模式,唤醒所有i.MX板上的不同核心。
10.1.3.1.3配置
没有
10.1.3.1.4用例和预期输出
$ /unit_tests/Power_Management/suspend_random_auto.sh
or
$ /unit_tests/Power_Management/suspend_quick_auto.sh
在i.MX 7D Sabre SD板上的预期输出:

# /unit_tests/Power_Management/suspend_random_auto.sh
rtcwakeup.out: wakeup from "mem" using rtc0 at Wed Feb 22 22:55:29 2017
PM: Syncing filesystems ... done.
Freezing user space processes ... (elapsed 0.001 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
Suspending console(s) (use no_console_suspend to debug)
PM: suspend of devices complete after 632.862 msecs
PM: suspend devices took 0.640 seconds
PM: late suspend of devices complete after 1.258 msecs
PM: noirq suspend of devices complete after 1.198 msecs
Disabling non-boot CPUs ...
CPU1: shutdown
Turn off Mega/Fast mix in DSM
Enabling non-boot CPUs ...
CPU1 is up
PM: noirq resume of devices complete after 0.832 msecs
imx-sdma 30bd0000.sdma: loaded firmware 4.2
PM: early resume of devices complete after 0.930 msecs
PM: resume of devices complete after 483.310 msecs
PM: resume devices took 0.480 seconds
Restarting tasks ... done.
=============================
suspend 0 times
=============================
wakeup 7 seconds, sleep 16 seconds
rtcwakeup.out: wakeup from "mem" using rtc0 at Wed Feb 22 22:55:42 2017
PM: Syncing filesystems ... done.
Freezing user space processes ... (elapsed 0.001 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
Suspending console(s) (use no_console_suspend to debug)
PM: suspend of devices complete after 630.328 msecs
PM: suspend devices took 0.640 seconds
PM: late suspend of devices complete after 1.252 msecs
PM: noirq suspend of devices complete after 1.203 msecs
Disabling non-boot CPUs ...
CPU1: shutdown
Turn off Mega/Fast mix in DSM
Enabling non-boot CPUs ...
CPU1 is up
PM: noirq resume of devices complete after 0.777 msecs
imx-sdma 30bd0000.sdma: loaded firmware 4.2
PM: early resume of devices complete after 0.873 msecs
PM: resume of devices complete after 483.406 msecs
PM: resume devices took 0.480 seconds
Restarting tasks ... done.
=============================
suspend 1 times
=============================
wakeup 11 seconds, sleep 20 seconds
rtcwakeup.out: wakeup from "mem" using rtc0 at Wed Feb 22 22:56:10 2017
37PM: Syncing filesystems ... done.
Freezing user space processes ... (elapsed 0.001 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
Suspending console(s) (use no_console_suspend to debug)
PM: suspend of devices complete after 651.761 msecs
PM: suspend devices took 0.660 seconds
PM: late suspend of devices complete after 1.245 msecs
PM: noirq suspend of devices complete after 1.193 msecs
Disabling non-boot CPUs ...
CPU1: shutdown
Turn off Mega/Fast mix in DSM
Enabling non-boot CPUs ...
CPU1 is up
PM: noirq resume of devices complete after 0.728 msecs
imx-sdma 30bd0000.sdma: loaded firmware 4.2
PM: early resume of devices complete after 0.859 msecs
PM: resume of devices complete after 483.441 msecs
PM: resume devices took 0.480 seconds
Restarting tasks ... done.
=============================
suspend 2 times
=============================
wakeup 3 seconds, sleep 12 seconds
rtcwakeup.out: wakeup from "mem" using rtc0 at Wed Feb 22 22:56:34 2017
PM: Syncing filesystems ... done.
Freezing user space processes ... (elapsed 0.001 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
Suspending console(s) (use no_console_suspend to debug)
PM: suspend of devices complete after 641.321 msecs
PM: suspend devices took 0.650 seconds
PM: late suspend of devices complete after 1.258 msecs
PM: noirq suspend of devices complete after 1.195 msecs
Disabling non-boot CPUs ...
CPU1: shutdown
Turn off Mega/Fast mix in DSM
Enabling non-boot CPUs ...
CPU1 is up
PM: noirq resume of devices complete after 0.730 msecs
imx-sdma 30bd0000.sdma: loaded firmware 4.2
PM: early resume of devices complete after 0.857 msecs
PM: resume of devices complete after 483.451 msecs
PM: resume devices took 0.480 seconds
Restarting tasks ... done.
=============================
suspend 3 times
=============================
wakeup 9 seconds, sleep 8 seconds
rtcwakeup.out: wakeup from "mem" using rtc0 at Wed Feb 22 22:56:56 2017
PM: Syncing filesystems ... done.
Freezing user space processes ... (elapsed 0.001 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
38Suspending console(s) (use no_console_suspend to debug)
PM: suspend of devices complete after 641.492 msecs
PM: suspend devices took 0.650 seconds
PM: late suspend of devices complete after 1.255 msecs
PM: noirq suspend of devices complete after 1.201 msecs
Disabling non-boot CPUs ...
CPU1: shutdown
Turn off Mega/Fast mix in DSM
Enabling non-boot CPUs ...
CPU1 is up
PM: noirq resume of devices complete after 0.731 msecs
imx-sdma 30bd0000.sdma: loaded firmware 4.2
PM: early resume of devices complete after 0.861 msecs
PM: resume of devices complete after 483.476 msecs
PM: resume devices took 0.480 seconds
Restarting tasks ... done.
^c
# /unit_tests/Power_Management/suspend_quick_auto.sh
rtcwakeup.out: wakeup from "mem" using rtc0 at Wed Feb 22 23:01:16 2017
PM: Syncing filesystems ... done.
Freezing user space processes ... (elapsed 0.001 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
Suspending console(s) (use no_console_suspend to debug)
PM: suspend of devices complete after 632.891 msecs
PM: suspend devices took 0.640 seconds
PM: late suspend of devices complete after 1.254 msecs
PM: noirq suspend of devices complete after 1.200 msecs
Disabling non-boot CPUs ...
CPU1: shutdown
Turn off Mega/Fast mix in DSM
Enabling non-boot CPUs ...
CPU1 is up
PM: noirq resume of devices complete after 0.734 msecs
imx-sdma 30bd0000.sdma: loaded firmware 4.2
PM: early resume of devices complete after 0.862 msecs
PM: resume of devices complete after 483.417 msecs
PM: resume devices took 0.480 seconds
Restarting tasks ... done.
===============================
suspend 1 times
===============================
rtcwakeup.out: wakeup from "mem" using rtc0 at Wed Feb 22 23:01:19 2017
PM: Syncing filesystems ... done.
Freezing user space processes ... (elapsed 0.001 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
Suspending console(s) (use no_console_suspend to debug)
PM: suspend of devices complete after 631.833 msecs
39PM: suspend devices took 0.640 seconds
PM: late suspend of devices complete after 1.253 msecs
PM: noirq suspend of devices complete after 1.242 msecs
Disabling non-boot CPUs ...
CPU1: shutdown
Turn off Mega/Fast mix in DSM
Enabling non-boot CPUs ...
CPU1 is up
PM: noirq resume of devices complete after 0.729 msecs
imx-sdma 30bd0000.sdma: loaded firmware 4.2
PM: early resume of devices complete after 0.862 msecs
PM: resume of devices complete after 483.416 msecs
PM: resume devices took 0.480 seconds
Restarting tasks ... done.
===============================
suspend 2 times
===============================
rtcwakeup.out: wakeup from "mem" using rtc0 at Wed Feb 22 23:01:22 2017
PM: Syncing filesystems ... done.
Freezing user space processes ... (elapsed 0.001 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
Suspending console(s) (use no_console_suspend to debug)
PM: suspend of devices complete after 633.624 msecs
PM: suspend devices took 0.640 seconds
PM: late suspend of devices complete after 1.252 msecs
PM: noirq suspend of devices complete after 1.204 msecs
Disabling non-boot CPUs ...
CPU1: shutdown
Turn off Mega/Fast mix in DSM
Enabling non-boot CPUs ...
CPU1 is up
PM: noirq resume of devices complete after 0.733 msecs
imx-sdma 30bd0000.sdma: loaded firmware 4.2
PM: early resume of devices complete after 0.853 msecs
PM: resume of devices complete after 483.450 msecs
PM: resume devices took 0.480 seconds
Restarting tasks ... done.
^c

10.1.4远程处理器消息传递
10.1.4.1测试名称
•mxc_mcc_tty_test.out
10.1.4.1.1位置
/unit_tests/Remote_Processor_Messaging
10.1.4.1.2功能
测试Cortex-A和Cortex-M内核之间的通信。
10.1.4.1.3配置
要运行i.mx RPMsg测试程序,请执行以下操作:确保使用了正确的Cortex-M4处理器RTOS和Linux映像。关于i.MX7Dual单板的举例如下:
•rpmsg_pingpong_sdk_7dsdb.bin→imx7dual SDB板的乒乓测试
•rpmsg_str_echo_sdk_7dsdb.bin→i.MX7Dual SDB板上使用的tty字符串回声测试
•rpmsg_pingpong_sdk_7dval.bin→i.MX7Dual 12x12 LPDDR3 ARM2单板乒乓测试
•rpmsg_str_echo_sdk_7dval.bin→tty string i.MX7Dual 12x12 LPDDR3 ARM2板回声测试
加载Cortex-M4处理器RTOS映像,并在U-Boot中启动它。通过TFTP服务器或U-Boot中的可引导SD卡加载Cortex-M4处理器RTOS镜像。
•通过TFTP服务器加载Cortex-M4处理器RTOS镜像:
-进入U-Boot并停止。
—使用以下命令TFTP传输相应的Cortex-M4处理器RTOS镜像并启动它。

=> dhcp 0x7f8000 10.192.242.53:rpmsg_pingpong_sdk_7dval.bin; bootaux 0x7f8000

•通过SD卡加载Cortex-M4处理器RTOS镜像:
—使用MFGtools创建可引导SD卡。
—将使用VFAT文件系统格式化的Cortex-M4处理器RTOS文件拷贝到第一个分区。
•修改U-Boot默认的Cortex-M4处理器RTOS名称。

=> setenv m4image '';save

设置一个用于Cortex-M4处理器的启动器。

=> setenv run_m4_tcm 'if run loadm4image; then cp.b ${loadaddr} 0x7f8000 0x8000;
=> bootaux 0x7f8000; fi'; save

通过添加run run_m4_tcm来修改原来的bootcmd。

=> setenv bootcmd "run run_m4_tcm; "; save

说明当Cortex-M4处理器RTOS镜像运行时,i.m mx 6SoloX需要" uart_from_osc "。因此,U-Boot的mmcargs需要在i.MX 6SoloX上进行修改。

=> setenv mmcargs 'setenv bootargs console=${console},${baudrate} root=${mmcroot}, uart_from_osc';save

运行RPMsg测试程序。*确保t imx_rpmsg_pingpong.ko 和imx_rpmsg_tty.ko是建出来的。*使用insmod imx_rpmsg_pingpong.ko or insmod imx_rpmsg_tty.ko来运行测试程序。
说明请勿同时运行不同的测试程序。
10.1.4.1.4用例和预期输出
运行以下命令,并确保在启动RPMsg TTY测试时,RPMsg TTY接收程序正在后端运行。

# ./mxc_mcc_tty_test.out /dev/ttyRPMSG30 115200 R 100 1000 &
Expected output:
mxc_mcc_tty_test.out:
$ insmod imx_rpmsg_tty.ko
$ imx_rpmsg_tty rpmsg0: new channel: 0x400 -> 0x1!
$ Install rpmsg tty driver!
$ echo deadbeaf > /dev/ttyRPMSG30
$ imx_rpmsg_tty rpmsg0: msg(<- src 0x1) deadbeaf len 8

10.1.5看门狗(WDOG)命令
10.1.5.1测试名称
•autorun-wdog.sh
•wdt_driver_test.out
10.1.5.1.1位置
/unit_tests/Watchdog/
10.1.5.1.2功能
测试看门狗定时器模块,该模块通过提供对意外挂起、无限循环情况或编程错误的逃避来防止系统故障。
10.1.5.1.3配置
没有
10.1.5.1.4用例和预期输出

Use case
./autorun-wdog.sh
or
./wdt_driver_test.out 1 2 0 &
Expected output
This should generate a reset after 3 seconds (a 1 second time-out and a 2 second sleep).
or
./wdt_driver_test.out 2 1 0
The system should keep running without being reset. This test requires the kernel to be executed
with the "jtag=on" on some platforms. Press "Ctrl+C" to terminate this test program.

10.2储存
10.2.1媒体本地总线
10.2.1.1测试名称
• mxc_mlb150_test
10.2.1.1.1位置
/unit_tests/Media_Local_Bus/
10.2.1.1.2功能
MediaLB是一种PCB上或芯片间通信总线,专门设计用于标准化通用硬件接口和软件API库。
10.2.1.1.3配置
在菜单配置中启用以下模块:

Device Drivers > MXC support drivers > MXC Media Local Bus Driver > MLB support

仅在i.MX6SX、i.MX6QP、i.MX6GQ、i.MX6DL上支持测试
10.2.1.1.4用例和预期输出

./mxc_mlb150_test [-v] [-h] [-b] [-f fps] [-t casetype] [-q sync quadlets] [-p isoc
packet length]\n"
-v verbose
-h help
-b block io test
-f FPS, 256/512/1024/2048/3072/4096/6144
-t CASE, CASE can be 'sync', 'ctrl', 'async', 'isoc'
-q SYNC QUADLETS, quadlets per frame in sync mode, can be 1, 2, or 3
-p Packet length, package length in isoc mode, can be 188 or 196

10.2.2 MMC/SD/SDIO主机
10.2.2.1测试名称

./autorun-mmc-blockrw.sh
./autorun-mmc-fdisk.sh
./autorun-mmc-fs.sh
./autorun-mmc-mkfs.sh
./autorun-mmc.sh

10.2.2.1.1位置
/ unit_test / MMC_SD_SDIO/
10.2.2.1.2功能
MMC SD SDIO测试的结合执行以下指令:
•MMC/SD读写测试。
•MMC/SD块读写测试。
•MMC/SD fdisk测试。
•MMC/SD文件系统测试。
•MMC/SD mkfs测试。
10.2.2.1.3配置
没有
10.2.2.1.4用例和预期输出
如果成功,所有测试返回“Pass”。

./autorun-mmc-blockrw.sh
./autorun-mmc-fdisk.sh
./autorun-mmc-fs.sh
./autorun-mmc-mkfs.sh
./autorun-mmc.sh

你可能感兴趣的:(NXP芯片,linux驱动,压力测试,单元测试,linux)