Commit Graph

64 Commits

Author SHA1 Message Date
v-liuchenxu3 1dd803e2e7 drivertest_rtc: add retry mechanism for RTC API test
RTC time may be overwritten by remote time sync service during
the test. Add 5-retry loop and pass if at least 3 attempts succeed.

Signed-off-by: v-liuchenxu3 <v-liuchenxu3@xiaomi.com>
2026-04-20 15:20:24 +08:00
hujun5 6a2ec984ae fix compile error
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-04-20 15:20:21 +08:00
tengshuangshuang a55d1cb180 apps/drivertest:fix compile error
../../apps/testing/drivers/drivertest/drivertest_i2c_spi.c:119:13: error: implicit declaration of function 'read'; did you mean 'fread'? [-Werror=implicit-function-declaration]
  119 |       ret = read(fd, &data, sizeof(struct accel_gyro_st_s));
      |             ^~~~
      |             fread
../../apps/testing/drivers/drivertest/drivertest_i2c_spi.c: In function 'cmocka_driver_i2c_spi_main':
../../apps/testing/drivers/drivertest/drivertest_i2c_spi.c:148:16: error: implicit declaration of function 'getopt' [-Werror=implicit-function-declaration]
  148 |   while ((ch = getopt(argc, argv, "d:h")) != ERROR)
      |                ^~~~~~
../../apps/testing/drivers/drivertest/drivertest_i2c_spi.c:154:22: error: 'optarg' undeclared (first use in this function)
  154 |                      optarg);

Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
2026-04-20 15:20:19 +08:00
makejian 4dcd949d7c testing/crc: add testcases for crc 8/16/32
Signed-off-by: makejian <makejian@xiaomi.com>
2026-04-20 15:20:18 +08:00
fangpeina c7372dfe94 testing/devicetree: add devicetree dynamic api testcase
config:
    CONFIG_ALLOW_MIT_COMPONENTS=y
    CONFIG_ARCH_SETJMP_H=y
    CONFIG_TESTING_CMOCKA=y
    CONFIG_TESTING_DEVICETREE=y
    CONFIG_TESTING_DEVICETREE_DYNAMIC_API=y

    CONFIG_DEVICETREE_HEADER_GENERATION=y
    CONFIG_DTS_CUSTOM_BINDINGS_DIR="../apps/testing/drivers/drivertest/devicetree/bindings;../apps/testing/drivers/drivertest/devicetree/bindings"
    CONFIG_DTS_OVERLAY_DIR="../apps/testing/drivers/drivertest/devicetree/api/base,../apps/testing/drivers/drivertest/devicetree/api/board1;../apps/testing/drivers/drivertest/devicetree/api/base,../apps/testing/drivers/drivertest/devicetree/api/board2"
    CONFIG_DTS_SOURCE_DTR="./boards/arm/qemu/qemu-armv7a/src;./boards/arm/qemu/qemu-armv7a/src"
build:
    cmake -B cmake_out -DBOARD_CONFIG=boards/arm/qemu/qemu-armv7a/configs/dts/ -GNinja
    cmake --build cmake_out
run:
    qemu-system-arm -cpu cortex-a7 -nographic -machine virt,virtualization=off,gic-version=2 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel cmake_out/qemu-armv7a_dts/nuttx -semihosting
    nsh> devicetree_test_api

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2026-04-20 15:20:18 +08:00
fangpeina 7f8d151d62 testing/devicetree: port devicetree api testcase
config:
    CONFIG_ALLOW_MIT_COMPONENTS=y
    CONFIG_ARCH_SETJMP_H=y
    CONFIG_TESTING_CMOCKA=y
    CONFIG_TESTING_DEVICETREE=y

    CONFIG_DEVICETREE_HEADER_GENERATION=y
    CONFIG_DTS_OVERLAY_DIR="../apps/testing/drivers/drivertest/devicetree/api"
    CONFIG_DTS_CUSTOM_BINDINGS_DIR="../apps/testing/drivers/drivertest/devicetree/bindings"
    CONFIG_DTS_SOURCE_DTR="./boards/arm/qemu/qemu-armv7a/src"

build:
    cmake -B cmake_out -DBOARD_CONFIG=boards/arm/qemu/qemu-armv7a/configs/dts/ -GNinja
    cmake --build cmake_out
run:
    qemu-system-arm -cpu cortex-a7 -nographic -machine virt,virtualization=off,gic-version=2 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel cmake_out/qemu-armv7a_dts/nuttx -semihosting
    nsh> devicetree_test_api

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2026-04-20 15:20:18 +08:00
makejian 0a5be61408 testing/keymanagement: export rsa testcases with key operation
Signed-off-by: makejian <makejian@xiaomi.com>
2026-04-20 15:20:18 +08:00
makejian a69e473213 testing/crypto: support rsa-512 testing case for quick check
Signed-off-by: makejian <makejian@xiaomi.com>
2026-04-20 15:20:18 +08:00
yukangzhi 373d35b268 mtdlog: Add the test cases.
Test the writing of data of different sizes and read it all out.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-04-20 15:20:17 +08:00
zhangkai25 d80d620729 move testing\enet to testing\drivers\enet
Signed-off-by: zhangkai25 <zhangkai25@xiaomi.com>
2026-04-20 15:20:16 +08:00
OceanfromXiaomi 90a7abbf21 move can_chrdev to apps/testing/drivers
Signed-off-by: OceanfromXiaomi <zhaohaiyang1@xiaomi.com>
2026-04-20 15:20:16 +08:00
makejian 5c4685e097 testing/setest; move setest case into drivers dir
Signed-off-by: makejian <makejian@xiaomi.com>
2026-04-20 15:20:15 +08:00
makejian 34d44c874a testing/crypto; move crypto testing cases into drivers dir
Signed-off-by: makejian <makejian@xiaomi.com>
2026-04-20 15:20:15 +08:00
guanyi3 cda8b56989 drivertest/cpufreq: adapt to devfreq
struct cpufreq_qos will be replace as qos_request_s, struct cpufreq_frequency_table will be replace as uint32_t *freq_table.
cpufreq framework has already implemented by devfreq, so replace to devfreq struct.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-04-20 15:20:15 +08:00
cuiziwei 6eb3eb4ff1 drivertest_timer: Fix invalid type judgment.
CID 278442: (#15 of 15): Operands do not affect result (CONSTANT_EXPRESSION_RESULT)
result_independent_of_operands: converted > 2147483647 is always false, regardless of the value of its operands. It is used as the second logical operand of "||".

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2026-04-20 15:20:13 +08:00
hujun5 9f554669e8 fix compile error
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-04-20 15:20:12 +08:00
fangpeina eeed7d61b2 testing/devicetree: add bindings files for dynamic testcase
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2026-04-20 15:19:56 +08:00
fangpeina 713de13ebf testing/devicetree: add bindings files for testcase
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2026-04-20 15:19:56 +08:00
fangpeina 8d5c3fa79c testing/drivers: move devicetree test to drivertest
config:
    CONFIG_ALLOW_MIT_COMPONENTS=y
    CONFIG_ARCH_SETJMP_H=y
    CONFIG_TESTING_CMOCKA=y
    CONFIG_TESTING_DEVICETREE=y
    CONFIG_TESTING_DEVICETREE_DYNAMIC_API=y

    CONFIG_DEVICETREE_HEADER_GENERATION=y
    CONFIG_DTS_CUSTOM_BINDINGS_DIR="../apps/testing/drivers/drivertest/devicetree/bindings;../apps/testing/drivers/drivertest/devicetree/bindings"
    CONFIG_DTS_OVERLAY_DIR="../apps/testing/drivers/drivertest/devicetree/api/base,../apps/testing/drivers/drivertest/devicetree/api/board1;../apps/testing/drivers/drivertest/devicetree/api/base,../apps/testing/drivers/drivertest/devicetree/api/board2"
    CONFIG_DTS_SOURCE_DTR="./boards/arm/qemu/qemu-armv7a/src;./boards/arm/qemu/qemu-armv7a/src"
build:
    cmake -B cmake_out -DBOARD_CONFIG=boards/arm/qemu/qemu-armv7a/configs/dts/ -GNinja
    cmake --build cmake_out
run:
    qemu-system-arm -cpu cortex-a7 -nographic -machine virt,virtualization=off,gic-version=2 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel cmake_out/qemu-armv7a_dts/nuttx -semihosting
    nsh> devicetree_test_api

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2026-04-20 15:19:55 +08:00
yukangzhi 6e3a58205d mtdlog: test cases for mtdlog driver.
Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-04-20 15:19:53 +08:00
duxiaoliang 3750109c0f apps/testing: modify the method that calling drivertest_framebuffer
run this testcase by cmock -s xx -t xx

Signed-off-by: duxiaoliang <duxiaoliang@xiaomi.com>
2026-04-20 15:19:52 +08:00
ouyangxiangzhen a28b879869 testing/drivers: Fix posix timer assertions.
On QEMU, if vcpus are preempted by other threads, the deviation of the
timer might be very large, causing assertion failure. This commit
addressed the problem.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-04-20 15:19:44 +08:00
ouyangxiangzhen 8d9cb0aec5 testing/drivers: Fix wrong test-cases.
This commit fixed totally wrong test-cases for the periodical timers.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-04-20 15:19:42 +08:00
ouyangxiangzhen 60cccbac96 testing/drivers: Change uint32_t time to uint64_t.
This commmit fixed the time multiplication overflow issue.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-04-20 15:19:42 +08:00
v-yanxingyu bc400e8d69 fix 'drivertest_watchdog_api' defined but not used
Signed-off-by: v-yanxingyu <v-yanxingyu@xiaomi.com>
2026-04-20 15:19:41 +08:00
yezhonghui 4c302a3fdb gpiotest: gpio irq trigger set timeout when poll
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-04-20 15:19:40 +08:00
buxiasen 290cea4da0 drivertest_uart: uart device open should use cfmakeraw to ensure raw.
reference: https://www.man7.org/linux/man-pages/man3/termios.3.html

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2026-04-20 15:19:39 +08:00
guanyi3 03a801b5f1 drivertest/pm: fix PM state error when busy loop
PM state do not update when busy loop, we use pm_checkstate() to get new state.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-04-20 15:19:38 +08:00
guanyi3 5a4105ae9b drivertest/cpufreq: testcase timeout
reduce sleep() time, current case exceeds 100s, and reduce to <20s.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-04-20 15:19:38 +08:00
yezhonghui d43db5b964 spitest: fix free pointer assign null
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-04-20 15:19:37 +08:00
wangzhi16 6d8c87c6a8 testing/drivers: fix compile error.
nand_sim_main.c:87:28: warning: implicit declaration of function 'kmm_zalloc'; did you mean 'lib_zalloc'? [-Wimplicit-function-declaration]
   87 |   g_nand_sim_mtd_wrapper = kmm_zalloc(sizeof(struct nand_wrapper_dev_s));
      |                            ^~~~~~~~~~
      |                            lib_zalloc
nand_sim_main.c:87:26: warning: assignment to 'struct mtd_dev_s *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   87 |   g_nand_sim_mtd_wrapper = kmm_zalloc(sizeof(struct nand_wrapper_dev_s));
      |                          ^
nand_sim_main.c: In function 'terminate':
nand_sim_main.c:122:3: warning: implicit declaration of function 'kmm_free' [-Wimplicit-function-declaration]
  122 |   kmm_free(g_nand_sim_mtd_under);
      |   ^~~~~~~~
nand_sim_main.c: In function 'nand_main':
nand_sim_main.c:144:9: warning: implicit declaration of function 'fork' [-Wimplicit-function-declaration]
  144 |   pid = fork();
      |         ^~~~
nand_sim_main.c:151:7: warning: implicit declaration of function 'daemon' [-Wimplicit-function-declaration]
  151 |   if (daemon(0, 1) == -1)
      |       ^~~~~~
nand_sim_main.c:165:18: warning: assignment to 'struct nand_raw_s *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  165 |   g_nand_mtd_raw = kmm_zalloc(sizeof(struct nand_raw_s));
      |                  ^
nand_sim_main.c:203:7: warning: implicit declaration of function 'sleep' [-Wimplicit-function-declaration]
  203 |       sleep(1);
      |       ^~~~~

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-04-20 15:19:35 +08:00
tengshuangshuang 1adeac7d34 pm/smp:add staytimeout.
Time instability under QEMU can lead to inaccuracies in the PM staycount tracking.

Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
2026-04-20 15:19:32 +08:00
tengshuangshuang 6b0c9c33c1 apps:add unistd.h for drivertest_touchpanel.c
Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
2026-04-20 15:19:31 +08:00
guanyi 1a93994516 drivertest/devfreq: add devfreq testcase
Signed-off-by: guanyi <guanyi@xiaomi.com>
2026-04-20 15:19:30 +08:00
yezhonghui 20c78f18ed gpio: Enhanced compatibility testcase based on sim
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-04-20 15:19:27 +08:00
yezhonghui 13991bc7fa drivers/spi: add spi master and slave testcase
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-04-20 15:19:25 +08:00
yezhonghui 92a909dc9d driver/i2c: add i2c master and slave dev test
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-04-20 15:19:25 +08:00
guanyi f338cb5d93 testing/drivertest: add pm_callback drivertest
testcase for feature "add priority for PM callbcak"
pm callback is called in sequence order when resume and in reverse order when suspend
1. in default priority
(i) register order: parent, child
(ii) suspend order: child, parent
(iii) resume order: parent, child
2. if child has higher priority
(i) register order: child, parent
(ii) suspend order: parent, child
(iii) resume order: child, parent

Signed-off-by: guanyi <guanyi@xiaomi.com>
2026-04-20 15:19:24 +08:00
fangpeina 23cd93460a rtc fix: set default vendor dalay to 1 for cases run correctly
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2026-04-20 15:19:24 +08:00
guoshichao 51f00889c5 watchdog: disable the drivertest_watchdog_api testcase on some platform
When we support the watchdog interrupt on the Armv7-A platform with
the TEE enabled, the watchdog interrupt needs to be configured as
a FIQ to avoid the impact of interrupt disabling in the AP.
In this case, the drivertest_watchdog_api testcase cannot pass the
test in such a scenario.

This is because the drivertest_watchdog_api itself requires
calling a specified callback after the watchdog interrupt is
triggered, instead of directly dumping the AP's context and
then asserting the system.

Therefore, when both CONFIG_ARCH_ARMV7A and CONFIG_ARCH_HAVE_TRUSTZONE
are enabled, we need to skip the current drivertest_watchdog_api
testcase.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-04-20 15:19:24 +08:00
wangzhi16 835667ee71 testing/zerointerrupt : remove enter/leave_critical_section.
Remove enter/leave_critical_section, and use up_irq_save to clarify code logic and improve multi-core performance.

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-04-20 15:19:24 +08:00
wangzhi16 c741f2a357 drivertest/watchdog : remove enter/leave_critical_section.
Because the purpose of using enter_critical_section function in watchdog is to disable interrupts rather than to synchronize information between multiple cores, it is replaced by up_irq_save.

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-04-20 15:19:24 +08:00
guanyi 40836cdb6f drivertest/pm: adapt to qemu-smartspeaker
In SMP, pm staycount of SYSTEM domain may be modified asynchronously by other cores during testcase, staycount sometimes is not equal to expectation.
BTW, the delay threshold of stability governor should be set carefully, too large or too small will affect the PM state and cause testcase to fail.

Signed-off-by: guanyi <guanyi@xiaomi.com>
2026-04-20 15:19:23 +08:00
tengshuangshuang 9f37e816e1 apps/testing:merge case to new folders
Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
2026-04-20 15:19:23 +08:00
makejian c15f805dbc testing: remove nist-sts into drivers for /dev/random
Signed-off-by: makejian <makejian@xiaomi.com>
2026-04-20 15:19:23 +08:00
zhangshoukui 6f38a3bbe3 drivertest_uart: Pass in the specified parameters to test
Tests that add cmocka are modified to be non-blocking

Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2026-04-20 15:19:22 +08:00
tengshuangshuang f52b0fa697 apps/testing:move {drivertest folders to the new driver folder(restore makefile)
Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
2026-04-20 15:19:22 +08:00
yezhonghui bcdc9d2b5b driver/gauge: add drivertest case for gauge driver
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-04-20 15:19:19 +08:00
yezhonghui b425f8458a driver/timer: fix drivertest timer ticks issue
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-04-20 15:19:19 +08:00
yezhonghui ec9ddc291e driver/simple: default y when drivertest enable
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-04-20 15:19:18 +08:00