Skip to content

Commit

Permalink
posix: Adds test for clock_getcpuclockid()
Browse files Browse the repository at this point in the history
Adds test for clock_getcpuclockid() to
make sure clock_id is equal to CLOCK_PROCESS_CPUTIME_ID
after a successful call

Fixes zephyrproject-rtos#59954

Signed-off-by: Jai Arora <infolinesoni@gmail.com>
  • Loading branch information
jaiiarora committed Jan 19, 2024
1 parent 68316ac commit 202aacf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/posix/common/src/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,11 @@ ZTEST(clock, test_realtime)
ZTEST(clock, test_clock_getcpuclockid)
{
int ret = 0;
clockid_t clock_id;
clockid_t clock_id = CLOCK_INVALID;

ret = clock_getcpuclockid((pid_t)0, &clock_id);
zassert_equal(ret, 0, "POSIX clock_getcpuclock id failed");
zassert_equal(clock_id, CLOCK_PROCESS_CPUTIME_ID, "POSIX clock_getcpuclock id failed");

ret = clock_getcpuclockid((pid_t)2482, &clock_id);
zassert_equal(ret, EPERM, "POSIX clock_getcpuclock id failed");
Expand Down

0 comments on commit 202aacf

Please sign in to comment.