Commit Graph

2025 Commits

Author SHA1 Message Date
huojianchao 6c4948219c cmocka:Output results in both standard and XML formats when xml_path is specified, providing additional information to help locate the failure point.
Signed-off-by: Jianchao Huo <huojianchao@xiaomi.com>
2026-04-20 15:20:26 +08:00
ouyangxiangzhen 8dd18d6bb6 apps/testing: Fix CLOCK_REALTIME definition.
This commit fixed CLOCK_REALTIME definition.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-04-20 15:20:26 +08:00
yangao1 5eb72d9fea apps/testing/clock_test_timer03.c:use CLOCK_MONOTONIC instead of CLOCK_REALTIME
Replace CLOCK_REALTIME with CLOCK_MONOTONIC to prevent NTP sync or system time changes

Signed-off-by: yangao1 <yangao1@xiaomi.com>
2026-04-20 15:20:26 +08:00
anpeiyun 1a74c8b570 ostest/cancel.c: the return value of EINVAL is acceptable
when pthread_join(), TCB still exists and detached is acceptable, the return value of pthread_join is EINVAL.

Signed-off-by: anpeiyun <anpeiyun@xiaomi.com>
2026-04-20 15:20:25 +08:00
ouyangxiangzhen 076d8b9f2d testing/testsuites: Relax the timing assertion.
In QEMU and SIM environments, if the CPU is under high load, the vCPU may not get a time slice to execute, potentially leading to arbitrarily large timer delays and test failures. We have relaxed the timer delay assertion to 1 second, referencing LTP.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-04-20 15:20:25 +08:00
buxiasen 9fc884c5c1 testing/fs/fatutf8: shorten the FOLDER&FILE for default NAME_MAX 32
When NAME_MAX use default 32, the FOLDER_NAME previous length
36 will cause errno ENAMETOOLONG, use a shorter 22 bytes
should enough for test purpose.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2026-04-20 15:20:25 +08:00
buxiasen aa54266611 testing/scanftest: change default path from /mnt to /tmp
It should be more common we have mounted /tmp from tmpfs, and less case
we have /mnt mounted.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2026-04-20 15:20:25 +08:00
ouyangxiangzhen e11fd803a6 testing/testsuites: Using clock_gettime(CLOCK_MONOTONIC)
During execution, ntpclient may attempt to synchronize the time, causing incorrect test results. Here, we use CLOCK_MONOTONIC to avoid this problem.
Once the smooth time correction has been implemented, this commit can be reverted.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-04-20 15:20:25 +08:00
ligd b8056dad05 testing/ostest: fix format warning in wqueue_workthread_test
Fix format specifier mismatch where work.total_ticks is atomic_t (int)
but PRIu32 expects uint32_t on some platforms.

Add explicit cast to uint32_t and split long line for readability.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2026-04-20 15:20:24 +08:00
buxiasen d124bf474b ostest/atomic: fix the declare using atomic but reference not use.
When choose not use atomic toolchain, will cause try link with toolchain
atomic version

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2026-04-20 15:20:24 +08:00
v-liuchenxu3 8011a18ac2 clock_nanosleep:add retry mechanism for clock_nanosleep test
Sleep duration may vary due to scheduling overhead. 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
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
zhaoxingyu1 90cc6df50f mtdconfig: modify config names for mtdconfig testcases 2
change nvs module testcase name TESTING_MTD_CONFIG_FAIL_SAFE
to TESTING_MTD_CONFIG_NVS and modify the configuration names
related to mtdconfig testing.

Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-04-20 15:20:24 +08:00
yangao1 f64730a93f roudrobin.c:improve the priority of test cases
Signed-off-by: yangao1 <yangao1@xiaomi.com>
2026-04-20 15:20:24 +08:00
ouyangxiangzhen 8f6b48627e testing/ltp: Using clock_gettime(CLOCK_MONOTONIC).
During execution, ntpclient may attempt to synchronize the time, causing incorrect test results. Here, we use CLOCK_MONOTONIC to avoid this problem.
Once the smooth time correction has been implemented, this commit can be reverted.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-04-20 15:20:24 +08:00
huojianchao e6a0e8e6a8 testing/syscall: refactor gettimeofday test to handle g_basetime changes
Use CLOCK_MONOTONIC as reference to compare time deltas instead of
comparing absolute gettimeofday values. This avoids false failures
when g_basetime is adjusted by NTP or other time sync services.

- Compare time deltas between gettimeofday and CLOCK_MONOTONIC
- Allow limited basetime adjustments (max 3) before failing
- Fail immediately if CLOCK_MONOTONIC goes backwards
- Fail if gettimeofday delta exceeds CLOCK_MONOTONIC delta

Signed-off-by: huojianchao <huojianchao@xiaomi.com>
2026-04-20 15:20:24 +08:00
anpeiyun ed027aff26 ostest/spinlock.c: donot run spinlock test in TEE SMP
in secure world, only run spinlock test on one core.

Signed-off-by: anpeiyun <anpeiyun@xiaomi.com>
2026-04-20 15:20:23 +08:00
zhangyu117 ba045061e9 apps: replace atomic_fetch_xxx with atomic_xxx
Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
2026-04-20 15:20:23 +08:00
ganjing 27baebe125 testing/cmocka: remove redundant argv[0] check in cmocka_main.c
The check comparing argv[0] against CONFIG_TESTING_CMOCKA_PROGNAME
is redundant because:
1. Only one executable (cmocka) is built from this source file
2. The program always has the correct name when invoked properly
3. The check fails incorrectly when using absolute paths or renamed binaries

Signed-off-by: ganjing <ganjing@xiaomi.com>
2026-04-20 15:20:23 +08:00
ganjing dc7aafd532 testing/cmocka: add support for executing ELF test files
Signed-off-by: ganjing <ganjing@xiaomi.com>
2026-04-20 15:20:23 +08:00
ouyangxiangzhen 1d65e6e662 testing/ostest: Fix Coverity for spinlock test.
This commit fixed coverity for spinlock test.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-04-20 15:20:22 +08:00
huojianchao 41aeef5831 wqueue: printf deadlock bugfix
static void test_notifier1_callback(FAR void *arg)
{
  FAR struct test_work1_s *test_work = (FAR struct test_work1_s *)arg;
  printf("notifier_callback: triggered.\n");
  fflush(stdout);
  if (test_work)
    {
      test_work->completed = true;
      printf("test_work1 completed.\n");
      printf("start triggering notifier signal 2.\n");
      work_notifier_signal(WORK_NET_DOWN, (FAR void *)(intptr_t)FD2);
    }
}
printf may need to wait I/O,test_work->completed not set value,lead to testcase fail

Signed-off-by: huojianchao <huojianchao@xiaomi.com>
2026-04-20 15:20:22 +08:00
huojianchao 41a986deee mqueue_test: dead lock bugfix
rootcause:
receiver_thread:
	mq_receive  --success
	printf(get sem)  <-- singal coming
    sig_handler
	printf(get sem)-->DEBUGASSERT((mholder & (~NXSEM_MBLOCKING_BIT)) != nxsched_gettid());

Signed-off-by: huojianchao <huojianchao@xiaomi.com>
2026-04-20 15:20:22 +08:00
buxiasen 93f3d53f97 testing/ostest: decrease the wqueue memory usage
Decrease from 10 thread to 4 thread

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2026-04-20 15:20:21 +08:00
hujun5 6a2ec984ae fix compile error
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-04-20 15:20:21 +08:00
yangao1 a1540bf9a8 ostest/cancel.c:improve thread priority
Because the priority of ostest was increased, the priority of the main thread also increased. Newly created threads still used the default priority, causing the parent thread to prematurely cancel the child thread. This resulted in the child thread not being properly garbage collected, leading to a system busy loop.

Signed-off-by: yangao1 <yangao1@xiaomi.com>
2026-04-20 15:20:20 +08:00
haopengxiang 7b65ee86a3 apps/riltest&apps/stressapptest: update .gitignore to fix git status error
17: 33:56  + check_result='?? testing/riltest/
17: 33:56  ?? testing/stressapptest/'
17: 33:56  + echo 'check git status: ?? testing/riltest/
17: 33:56  ?? testing/stressapptest/'
17: 33:56  check git status: ?? testing/riltest/
17: 33:56  ?? testing/stressapptest/
17: 33:56  + [[ -n ?? testing/riltest/
17: 33:56  ?? testing/stressapptest/ ]]
17: 33:56  + fail=1
17: 33:56  + echo 'error: check git status warning: ?? testing/riltest/
17: 33:56  ?? testing/stressapptest/'
17: 33:56  error: check git status warning: ?? testing/riltest/
17: 33:56  ?? testing/stressapptest/
17: 33:56  + exit 2
Signed-off-by: haopengxiang <haopengxiang@xiaomi.com>
2026-04-20 15:20:20 +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
wangshaoxin 8d84c8c061 apps/timedmutex: set subthread prio and increase sleep time
In extreme cases, it's possible that the main thread accesses the `g_running` variable before the child thread assigns it a value.

Signed-off-by: wangshaoxin <wangshaoxin@xiaomi.com>
2026-04-20 15:20:17 +08:00
wangshaoxin 0ba64c8c4d apps/timedmutex: add debug log for timedmutex test
Signed-off-by: wangshaoxin <wangshaoxin@xiaomi.com>
2026-04-20 15:20:17 +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
huojianchao e73f7d44eb return EBADF if ops not match with oflags
Signed-off-by: huojianchao <huojianchao@xiaomi.com>
2026-04-20 15:20:16 +08:00
yangao1 057149f34c sem_timed.c:using two threads with different priorities to verify sem_timewait
The original test case only started one thread, but used two priorities.
In reality, two threads should have been started: the higher-priority thread should release the semaphore by calling `sem_post`,
and the main thread should wait for the semaphore using `semtimed_wait`,
thus verifying the correct operation of the semaphore interface in a multi-threaded environment.

Signed-off-by: yangao1 <yangao1@xiaomi.com>
2026-04-20 15:20:16 +08:00
zhengyu16 0e866add56 fs: rename PSEUDOFS_SOFTLINKS to FS_LINKS
Signed-off-by: zhengyu16 <zhengyu16@xiaomi.com>
2026-04-20 15:20:16 +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
ouyangxiangzhen 348235c2cf testing/ostest: refactor the spinlock test.
This commit refactored the spinlock test for better accuracy and
minimized jitters introduced by scheduling.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-04-20 15:20:16 +08:00
chenzihan1 4c002e7098 testing/clocktest: move clocktest from testing to libc test
Signed-off-by: chenzihan1 <chenzihan1@xiaomi.com>
2026-04-20 15:20:16 +08:00
wangmingrong1 4c3f5eef85 testing/sched: move event tests to sched
Signed-off-by: wangmingrong1 <wangmingrong1@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
xuxin19 576987e985 organize: clean up invalid files and directories
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-04-20 15:20:16 +08:00
xujianhang 607c3deb63 apps/testing/riltest: remove deprecated test code
Signed-off-by: xujianhang <xujianhang@xiaomi.com>
2026-04-20 15:20:15 +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
zhangyu117 2cf02b941b testing/ostest: if a generic atomic64 function is not implemented, avoid using atomic64 because some chips do not support 64-bit atomic instructions.
Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
2026-04-20 15:20:15 +08:00