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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>