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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
../../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>
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>
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>
This commit refactored the spinlock test for better accuracy and
minimized jitters introduced by scheduling.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
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>