Skip to content

Commit

Permalink
posix: sched: Implement tests for set APIs for scheduling parameters
Browse files Browse the repository at this point in the history
Implement tests for `sched_setparam()` and `sched_setscheduler()` .
Both functions are actually placeholders and just return `ENOSYS`
since Zephyr does not yet support processes or process scheduling.

signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
  • Loading branch information
moonlight83340 authored and carlescufi committed Jan 31, 2024
1 parent 8a6c745 commit c6c9924
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
22 changes: 22 additions & 0 deletions tests/posix/common/src/pthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,28 @@ ZTEST(pthread, test_sched_getscheduler)

zassert_true((rc == -1 && err == ENOSYS));
}
ZTEST(pthread, test_sched_setparam)
{
struct sched_param param = {
.sched_priority = 2,
};
int rc = sched_setparam(0, &param);
int err = errno;

zassert_true((rc == -1 && err == ENOSYS));
}

ZTEST(pthread, test_sched_setscheduler)
{
struct sched_param param = {
.sched_priority = 2,
};
int policy = 0;
int rc = sched_setscheduler(0, policy, &param);
int err = errno;

zassert_true((rc == -1 && err == ENOSYS));
}

ZTEST(pthread, test_pthread_equal)
{
Expand Down
4 changes: 2 additions & 2 deletions tests/posix/headers/src/sched_h.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ ZTEST(posix_headers, test_sched_h)

/* zassert_not_null(sched_rr_get_interval); */ /* not implemented */

/* zassert_not_null(sched_setparam); */ /* not implemented */
/* zassert_not_null(sched_setscheduler); */ /* not implemented */
zassert_not_null(sched_setparam);
zassert_not_null(sched_setscheduler);

zassert_not_null(sched_yield);
}
Expand Down

0 comments on commit c6c9924

Please sign in to comment.