Skip to content

test(os/time): add coverage for pid 0, TIMER_ABSTIME, and ovalue#113

Open
nhuvaoanh123 wants to merge 1 commit intoeclipse-score:mainfrom
nhuvaoanh123:feat/time-test-coverage-gaps
Open

test(os/time): add coverage for pid 0, TIMER_ABSTIME, and ovalue#113
nhuvaoanh123 wants to merge 1 commit intoeclipse-score:mainfrom
nhuvaoanh123:feat/time-test-coverage-gaps

Conversation

@nhuvaoanh123
Copy link
Contributor

Three gaps identified in time_test.cpp:

  1. ClockGetCpuClockIdWithCurrentProcess: Existing test uses pid 1 (init), which is semantically incorrect and may fail on privilege-restricted systems. POSIX specifies pid 0 means the calling process — more portable and spec-correct.

  2. TimerSettimeWithAbsoluteTimeFlag: All existing timer_settime calls use flags=0 (relative). TIMER_ABSTIME is a distinct code path (absolute wall-clock timestamp interpretation) with no prior test coverage.

  3. TimerSettimeOldValueReflectsPreviousArming: TimerSettimeSuccess passes an ovalue but never asserts its contents. This test re-arms a live timer and verifies ovalue correctly reports the remaining time of the previous arming (~10s).

All tests annotated with SCR-46010294, ASIL B, Interface test.

Note for future improvement:
Test 1: pid=0 is Linux-only — QNX CI may fail; assertion is too shallow
Test 2: 200ms absolute deadline is flaky under sanitizers; missing SIGEV_NONE could kill the test process
Test 3: The 8–10s range window is the most likely reviewer flag — asan/ubsan slowdown can blow this
All three: No negative/error path coverage (ASIL B typically requires this); RecordProperty may not be consumed by baselibs CI

Three gaps identified in time_test.cpp:

1. ClockGetCpuClockIdWithCurrentProcess:
   Existing test uses pid 1 (init), which is semantically incorrect and
   may fail on privilege-restricted systems. POSIX specifies pid 0 means
   the calling process — more portable and spec-correct.

2. TimerSettimeWithAbsoluteTimeFlag:
   All existing timer_settime calls use flags=0 (relative). TIMER_ABSTIME
   is a distinct code path (absolute wall-clock timestamp interpretation)
   with no prior test coverage.

3. TimerSettimeOldValueReflectsPreviousArming:
   TimerSettimeSuccess passes an ovalue but never asserts its contents.
   This test re-arms a live timer and verifies ovalue correctly reports
   the remaining time of the previous arming (~10s).

All tests annotated with SCR-46010294, ASIL B, Interface test.

Signed-off-by: nhuvaoanh123 <webmaster@taktflow-systems.com>
@nhuvaoanh123 nhuvaoanh123 force-pushed the feat/time-test-coverage-gaps branch from 09f7238 to fc0f120 Compare March 14, 2026 02:45
@github-actions
Copy link

The created documentation from the pull request is available at: docu-html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant