zephyr: ehl_crb: portability.posix.common.posix_realtime failed.
Bug Description
The posix_realtime test in the /tests/posix/common test suite is failing due to assert:
Assertion failed at WEST_TOPDIR/zephyr/tests/posix/common/src/clock.c:75: test_posix_realtime: (rts.tv_nsec not equal to mts.tv_nsec)
This is observed in the other configurations of testcase.yml
- portability.posix.common
- portability.posix.common.newlib
- portability.posix.common.tls
- portability.posix.common.tls.newlib
To Reproduce Steps to reproduce the behavior:
- Example for a single configuration: west build -b ehl_crb -p auto tests/posix/common/ –DCONFIG_NEWLIB_LIBC=n
- copy binary to USB/PXE boot media
- boot
- See error
Logs and console output Booting Zephyr OS build zephyr-v2.5.0-1430-g911ba334a06a … START - test_posix_recursive_mutex recrusive mutex lock is taken PASS - test_posix_recursive_mutex in 0.4 seconds
START - test_posix_mqueue PASS - test_posix_mqueue in 0.11 seconds
START - test_posix_realtime POSIX clock set APIs Assertion failed at WEST_TOPDIR/zephyr/tests/posix/common/src/clock.c:75: test_posix_realtime: (rts.tv_nsec not equal to mts.tv_nsec) Nanoseconds not equal FAIL - test_posix_realtime in 0.19 seconds
START - test_posix_timer POSIX timer test Timer fires every 0 secs and 100000000 nsecs Time remaining to fire 0 secs and 899000000 nsecs Handler Signal value :20 for 1 times Handler Signal value :20 for 2 times Handler Signal value :20 for 3 times Handler Signal value :20 for 4 times Handler Signal value :20 for 5 times Handler Signal value :20 for 6 times Handler Signal value :20 for 7 times Handler Signal value :20 for 8 times Handler Signal value :20 for 9 times Handler Signal value :20 for 10 times Handler Signal value :20 for 11 times Handler Signal value :20 for 12 times PASS - test_posix_timer in 2.112 seconds
Environment (please complete the following information):
- OS: Fedora33
- Toolchain: zephyr-sdk-0.12.3
- Commit ID: 911ba334a06a
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 21 (4 by maintainers)
Commits related to this issue
- tests: posix: common: fix k_usleep() tick alignment The kusleep(1) in test_posix_realtime() is not sufficient for all boards. Extend it by the difference between rts.tv_nsec and mts.tv_nsec on ehl_cr... — committed to jenmwms/zephyr by jenmwms 3 years ago
- tests: posix: common: clock: exclude ehl_crb from test posix realtime The ehl_crb board has hardware issue that prevents this test from being able to pass this otherwise-correct test. So exclude ehl_... — committed to jenmwms/zephyr by jenmwms 3 years ago
- tests: posix: common: clock: exclude ehl_crb from test posix realtime The ehl_crb board has hardware issue that prevents this test from being able to pass this otherwise-correct test. So exclude ehl_... — committed to zephyrproject-rtos/zephyr by jenmwms 3 years ago
- merge ##34 :: Zephyr 2.6.0 * arm: shrink names for null-pointer exception detection Kconfigs Reduce the length of the Kconfig defines related to null-pointed dereference detection in Cortex-M. ... — committed to recogni/zephyr by sabhiram 3 years ago
FWIW: the k_usleep(1) is a tick alignment, not a workaround. The idea is that timer behavior is only deterministic if you start the test at the beginning of an OS tick. Otherwise there are inevitable timer aliasing bugs (think of them as “race conditions against the passage of real time” – you can’t take a lock to stop the universe). So you have to ask the kernel “please sleep until the very next tick expires”. And the simplest way to do that is to request a sleep for the smallest unit of time expressible[1].
Playing with timeouts to make this pass makes me nervous, and implies there’s something else going on.
[1] Actually there’s a nanosecond API now, but nothing uses a MHz+ tick rate so this is shorter and simpler.