Edit online

测试指南

26 Nov 2024
Read time: 2 minute(s)
RTC 测试所需的测试环境如下:
  • 硬件:开发板上安装有电池,用于给 RTC 供电
  • 软件
    • PC 端的串口终端软件,用于 PC 和开发板进行串口通信

    • Linux 内核原生的 rtctest 工具

配置软件

在 Luban 的根目录下通过 make menuconfig 打开 rtctest
Linux kernel
    Advance setting
        Linux Kernel Tools
            [*] selftests

rtctest 测试

  1. 进入rtctest 所在目录 /usr/lib/kselftests/rtc/
    cd /usr/lib/kselftests/rtc/

    rtctest 的主要功能是测试 RTC 的 Alarm 功能。

  2. 执行下列命令运行 rtctest
    ./rtctest
    输出结果示例如下:
    TAP version 13
    1..7
    # Starting 7 tests from 2 test cases.
    #  RUN           rtc.date_read ...
    # rtctest.c:49:date_read:Current RTC date/time is 05/01/1970 21:50:57.
    #            OK  rtc.date_read
    ok 1 rtc.date_read
    #  RUN           rtc.uie_read ...
    #            OK  rtc.uie_read
    ok 2 rtc.uie_read
    #  RUN           rtc.uie_select ...
    #            OK  rtc.uie_select
    ok 3 rtc.uie_select
    #  RUN           rtc.alarm_alm_set ...
    # rtctest.c:137:alarm_alm_set:Alarm time now set to 21:51:06.
    # rtctest.c:156:alarm_alm_set:data: 1a0
    #            OK  rtc.alarm_alm_set
    ok 4 rtc.alarm_alm_set
    #  RUN           rtc.alarm_wkalm_set ...
    # rtctest.c:195:alarm_wkalm_set:Alarm time now set to 05/01/1970 21:51:09.
    #            OK  rtc.alarm_wkalm_set
    ok 5 rtc.alarm_wkalm_set
    #  RUN           rtc.alarm_alm_set_minute ...
    # rtctest.c:239:alarm_alm_set_minute:Alarm time now set to 21:52:00.
    # rtctest.c:258:alarm_alm_set_minute:data: 1a0
    #            OK  rtc.alarm_alm_set_minute
    ok 6 rtc.alarm_alm_set_minute
    #  RUN           rtc.alarm_wkalm_set_minute ...
    # rtctest.c:297:alarm_wkalm_set_minute:Alarm time now set to 05/01/1970 21:53:00.
    #            OK  rtc.alarm_wkalm_set_minute
    ok 7 rtc.alarm_wkalm_set_minute
    # PASSED: 7 / 7 tests passed.
    # Totals: pass:7 fail:0 xfail:0 xpass:0 skip:0 error:0