Commit Graph

223 Commits

Author SHA1 Message Date
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
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
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
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
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
hujun5 9f554669e8 fix compile error
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-04-20 15:20:12 +08:00
wangxingxing e8646ab848 fs/test:remove the usleep of evend_fd read to solve the questiong of sem wait
Signed-off-by: wangxingxing <wangxingxing@xiaomi.com>
2026-04-20 15:19:54 +08:00
huojianchao a1584f1832 test_nuttx_syscall_fsync03 execute too long bugfix
Signed-off-by: huojianchao <huojianchao@xiaomi.com>
2026-04-20 15:19:52 +08:00
huojianchao a1483389eb test_nuttx_syscall_mkdir02 execute too long bugfix
Signed-off-by: huojianchao <huojianchao@xiaomi.com>
2026-04-20 15:19:52 +08:00
wangzhi16 5528cc8286 test/mutex: fix mutex testcases.
Multiple threads should use the same lock for resource protection.

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-04-20 15:19:49 +08:00
v-yanxingyu 43ff0e6978 "test_nuttx_syscall_getitimer01,test_nuttx_syscall_gettimeofday01,test_nuttx_syscall_timergettime01"
Add the "CONFIG_PREALLOC_TIMERS" judgment

Signed-off-by: v-yanxingyu <v-yanxingyu@xiaomi.com>
2026-04-20 15:19:49 +08:00
jiangtao16 921fe30e73 testing/testsuites: modify the output formatting
modify the output formatting because type of timer_t changed
Signed-off-by: jiangtao16 <jiangtao16@xiaomi.com>
2026-04-20 15:19:48 +08:00
guoshengyuan1 d055d1dd39 [app/testig/kernel]: fix memory bound check in test_nuttx_mm07()
Signed-off-by: guoshengyuan1 <guoshengyuan1@xiaomi.com>
2026-04-20 15:19:45 +08:00
wushenhui 6dc4d1e161 tests: reduce syscall and sched test case execution time
The execution time of the modified test case has been reduced from 46.657s to 1.735s.

Signed-off-by: wushenhui <wushenhui@xiaomi.com>
2026-04-20 15:19:44 +08:00
ouyangxiangzhen 3137d67fc9 testsuites: Fix timing errors in rare cases.
In rare cases, the delay time may exceed two ticks. For example:
1. At [t + 0.9], the thread got the current time `t`
2. At [t + 1.0], the thread set a delay of 3 (+ 1 ticks in wd_start) ticks.
3. At [t + 5.1], the timer triggered, the thread woke up.
4. At [t + 5.x], the thread got the current time t + 5.
5. (t + 5) - (t + 3) >= 2, leading to the assertion failure.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-04-20 15:19:44 +08:00
guanyi3 375e432f15 testing/time: Relax the timing constraints.
On SIM and QEMU, it is inevitable that the simulating vCPU got preempted
by other threads, causing large timing delay. This commit relax the timing constraints to reduce the CT error.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-04-20 15:19:42 +08:00
guanyi3 762153cbd5 testsuites/mkdir&fsync_test: reduce test time
After lseek with a large offset, write() will be slow; if current file system is fatfs, write() will be even slower.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-04-20 15:19:42 +08:00
wangxingxing c99a1527be fs/vtf:reduce the test time of fs test
Signed-off-by: wangxingxing <wangxingxing@xiaomi.com>
2026-04-20 15:19:41 +08:00
ligd 80a14fa245 eventfd_test: avoid the orphan Thread
Signed-off-by: ligd <liguiding1@xiaomi.com>
2026-04-20 15:19:39 +08:00
ouyangxiangzhen d8c4674c48 testing/time: Relax the timing constraints.
On SIM and QEMU, it is inevitable that the simulating vCPU got preempted
by other threads, causing large timing delay. This commit relax the timing
constraints to reduce the CT error.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-04-20 15:19:37 +08:00
wushenhui 355d27c3ac testsuits: remove not supported case when not Flat build
1. testing/testsuites/kernel/fs/cmocka_fs_test.c:
   file_put() and file_get() not available in kernel mode.

2. testing/testsuites/kernel/sched/cmocka_sched_test.c
   & testing/testsuites/Makefile & testing/testsuites/CMakeLists.txt :
   task_creat() not available in kernel mode.

3. testing/mm/heaptest/Kconfig:
   header `mm/mm_heap/mm.h` unavailable in kernel mode.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
Signed-off-by: wushenhui <wushenhui@xiaomi.com>
2026-04-20 15:19:37 +08:00
ouyangxiangzhen 9ac5058d3d testsuites: Fix timing errors in rare cases.
In rare cases, the delay time may exceed two ticks. For example:
1. At [t + 0.9], the thread got the current time `t`
2. At [t + 1.0], the thread set a delay of 3 (+ 1 ticks in wd_start) ticks.
3. At [t + 5.1], the timer triggered, the thread woke up.
4. At [t + 5.x], the thread got the current time t + 5.
5. (t + 5) - (t + 3) >= 2, leading to the assertion failure.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-04-20 15:19:36 +08:00
wushenhui 2e9635a30d testsuites/kernel/mm: replace task_create() with pthread_create()
Adaptation to kernelmode. task_create() is not available in kernel mode.

Signed-off-by: wushenhui <wushenhui@xiaomi.com>
2026-04-20 15:19:36 +08:00
guohao15 e5c9386c62 fs_test:add more info when test failed
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2026-04-20 15:19:36 +08:00
dongjiuzhu1 78cad01836 testing/fs: update api name fs_getfilep/fs_putfilep to file_get/file_put
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-20 15:19:36 +08:00
hongfengchen c4142f8de4 apps: testing:add unistd.h and pthread.h
Add unistd.h and pthread.h for memorystress_main.c,
Add unistd.h for dhm.c and cachetest_main.c.
Add pthread.h for kv_test_019.c

Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
2026-04-20 15:19:31 +08:00
hongfengchen a45fd51cdd testsuites:add malloc.h for fstest.h
Add malloc.h for fstest.h

Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
2026-04-20 15:19:30 +08:00
ligd 793b947716 timer_test: reduce the sleep time to improve testing efficiency
Signed-off-by: ligd <liguiding1@xiaomi.com>
2026-04-20 15:19:29 +08:00
tengshuangshuang 87e4540cdd syscall:fix listen case bug
UDP should not be tested without config_net_udp enabled

Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
2026-04-20 15:19:26 +08:00
zhaoxingyu1 b786d8304e testsuites/kernel/dfx: fix format errors in license
Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-04-20 15:19:21 +08:00
zhaoxingyu1 348e16b6b6 testsuites/kernel/time: fix format errors in license
Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-04-20 15:19:20 +08:00
zhaoxingyu1 77ed634420 testsuites/kernel/syscall: fix format errors in license
Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-04-20 15:19:20 +08:00
zhaoxingyu1 b52ce43ddb testsuites/kernel/socket: fix format errors in license
Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-04-20 15:19:20 +08:00
zhaoxingyu1 393cc1700c testsuites/kernel/sched: fix format errors in license
Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-04-20 15:19:20 +08:00
zhaoxingyu1 04b50ce093 testsuites/kernel/pthread: fix format errors in license
Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-04-20 15:19:20 +08:00
zhaoxingyu1 68f478069d testsuites/kernel/mutex: fix format errors in license
Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-04-20 15:19:20 +08:00
zhaoxingyu1 c1815e301b testsuites/kernel/mm: fix format errors in license
Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-04-20 15:19:20 +08:00
zhaoxingyu1 2e584f890c testsuites/kernel/kv: fix format errors in license
Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-04-20 15:19:20 +08:00
zhaoxingyu1 2d48606dc0 testsuites/kernel/fs: fix format errors in license
Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2026-04-20 15:19:20 +08:00
ouyangxiangzhen 51622ef273 testing/time: Relax the timing constraints.
On SIM and QEMU, it is inevitable that the simulating vCPU got preempted
by other threads, causing large timing delay. This commit relax the timing
constraints to reduce the CT error.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-04-20 15:19:13 +08:00
guohao15 7997a0802d testcase:fix test_kvdb_test_suites_19 stack size overflow
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2026-04-20 15:19:13 +08:00
ouyangxiangzhen 6deff103d9 testsuites: Fix timing errors.
In the simulator environment, the vCPUs are implemented as user threads, which can be preempted by other user threads, leading to large latencies in the clock test. This commit disabled the latency checking for the simulator.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-04-20 15:19:13 +08:00
guohao15 fa7594fc1e bugfix:fix misuse fd in testcase
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2026-04-20 15:19:12 +08:00
guohao15 65a87d2be6 bugfix: skip test_nuttx_syscall_read02 when FDCHECK enable
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2026-04-20 15:19:12 +08:00
guohao15 bf45c1e060 fdcheck: fix fd close in other thread
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2026-04-20 15:19:12 +08:00
tengshuangshuang fdd91923f2 syscall:fix badfd cause the fdcheck error
Turning on fdcheck will cause the original test badfd case to dump

Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
2026-04-20 15:19:09 +08:00
tengshuangshuang 821ea178d5 apps/testing:fix syscall case(setsocketopt01, dup2_test, fsync_test) error
If fdcheck enabled, fd relative case will ASSERT, not able to check ret/errno etc.

Signed-off-by: tengshuangshuang <tengshuangshuang@xiaomi.com>
2026-04-20 15:19:09 +08:00
wangxingxing a8890dbfa9 fs/bugfix: fix the fd error of fs test
Signed-off-by: wangxingxing <wangxingxing@xiaomi.com>
2026-04-20 15:19:09 +08:00
zhangshoukui ba938875e6 Add kvdb load test configuration
Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2026-04-20 15:19:08 +08:00
chenrun1 0e7d125545 testsuites/kv30:Initialize thread stack size
Summary:
  Avoid stack overflow issues when using different DEFAULT_PTHREAD_STACK sizes
  [ 1437.010700] [1190] [ ALERT] [ap] sched_dumpstack: backtrace:
[ 1437.011000] [1190] [ ALERT] [ap] sched_dumpstack: [1190] [<0x40b5532>] backtrace_unwind+0x2fd/0x300
[ 1437.012000] [1190] [ ALERT] [ap] sched_dumpstack: [1190] [<0x40138aa>] sched_backtrace+0xd9/0xf8
[ 1437.012600] [1190] [ ALERT] [ap] sched_dumpstack: [1190] [<0x4082072>] sched_dumpstack+0x59/0x134
[ 1437.013100] [1190] [ ALERT] [ap] sched_dumpstack: [1190] [<0x40068cc>] dump_running_task+0x6b/0x98
[ 1437.013800] [1190] [ ALERT] [ap] sched_dumpstack: [1190] [<0x40069e8>] dump_assert_info+0xef/0x1c4
[ 1437.014400] [1190] [ ALERT] [ap] sched_dumpstack: [1190] [<0x400712c>] _assert+0x123/0x3a8
[ 1437.014900] [1190] [ ALERT] [ap] sched_dumpstack: [1190] [<0x4060136>] __assert+0x29/0x44
[ 1437.015400] [1190] [ ALERT] [ap] sched_dumpstack: [1190] [<0x40a0c48>] tls_destruct+0xef/0xfc
[ 1437.015900] [1190] [ ALERT] [ap] sched_dumpstack: [1190] [<0x40745ce>] pthread_exit+0x59/0x74
[ 1437.016500] [1190] [ ALERT] [ap] sched_dumpstack: [1190] [<0x40744aa>] pthread_startup+0x3d/0x68
[ 1437.017000] [1190] [ ALERT] [ap] sched_dumpstack: [1190] [<0x400c49e>] pthread_start+0x4d/0xec

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2026-04-20 15:19:08 +08:00