tests: posix: xsi_realtime: move more tests into xsi_realtime
move tests with _POSIX_PRIORITY_SCHEDULING Option to xsi_realtime testsuite Signed-off-by: Marvin Ouma <pancakesdeath@protonmail.com>
This commit is contained in:
parent
52db58defa
commit
83aafaf1ae
2 changed files with 65 additions and 66 deletions
|
@ -62,8 +62,8 @@ static void *thread_top_exec(void *p1)
|
|||
struct sched_param schedparam;
|
||||
|
||||
pthread_getschedparam(pthread_self(), &policy, &schedparam);
|
||||
printk("Thread %d starting with scheduling policy %d & priority %d\n",
|
||||
id, policy, schedparam.sched_priority);
|
||||
printk("Thread %d starting with scheduling policy %d & priority %d\n", id, policy,
|
||||
schedparam.sched_priority);
|
||||
/* Try a double-lock here to exercise the failing case of
|
||||
* trylock. We don't support RECURSIVE locks, so this is
|
||||
* guaranteed to fail.
|
||||
|
@ -203,9 +203,7 @@ static void *thread_top_term(void *p1)
|
|||
zassert_false(pthread_getschedparam(self, &policy, &getschedparam),
|
||||
"Unable to get thread priority!");
|
||||
|
||||
printk("Thread %d starting with a priority of %d\n",
|
||||
id,
|
||||
getschedparam.sched_priority);
|
||||
printk("Thread %d starting with a priority of %d\n", id, getschedparam.sched_priority);
|
||||
|
||||
if (id % 2) {
|
||||
ret = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
|
||||
|
@ -304,8 +302,7 @@ ZTEST(pthread, test_pthread_execution)
|
|||
zassert_false(ret, "Set thread name failed!");
|
||||
|
||||
/* TESTPOINT: Try getting thread name */
|
||||
ret = pthread_getname_np(newthread[0], thr_name_buf,
|
||||
sizeof(thr_name_buf));
|
||||
ret = pthread_getname_np(newthread[0], thr_name_buf, sizeof(thr_name_buf));
|
||||
zassert_false(ret, "Get thread name failed!");
|
||||
|
||||
/* TESTPOINT: Thread names match */
|
||||
|
@ -460,57 +457,6 @@ ZTEST(pthread, test_pthread_descriptor_leak)
|
|||
}
|
||||
}
|
||||
|
||||
ZTEST(pthread, test_sched_getparam)
|
||||
{
|
||||
struct sched_param param;
|
||||
int rc = sched_getparam(0, ¶m);
|
||||
int err = errno;
|
||||
|
||||
zassert_true((rc == -1 && err == ENOSYS));
|
||||
}
|
||||
|
||||
ZTEST(pthread, test_sched_getscheduler)
|
||||
{
|
||||
int rc = sched_getscheduler(0);
|
||||
int err = errno;
|
||||
|
||||
zassert_true((rc == -1 && err == ENOSYS));
|
||||
}
|
||||
ZTEST(pthread, test_sched_setparam)
|
||||
{
|
||||
struct sched_param param = {
|
||||
.sched_priority = 2,
|
||||
};
|
||||
int rc = sched_setparam(0, ¶m);
|
||||
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, ¶m);
|
||||
int err = errno;
|
||||
|
||||
zassert_true((rc == -1 && err == ENOSYS));
|
||||
}
|
||||
|
||||
ZTEST(pthread, test_sched_rr_get_interval)
|
||||
{
|
||||
struct timespec interval = {
|
||||
.tv_sec = 0,
|
||||
.tv_nsec = 0,
|
||||
};
|
||||
int rc = sched_rr_get_interval(0, &interval);
|
||||
int err = errno;
|
||||
|
||||
zassert_true((rc == -1 && err == ENOSYS));
|
||||
}
|
||||
|
||||
ZTEST(pthread, test_pthread_equal)
|
||||
{
|
||||
zassert_true(pthread_equal(pthread_self(), pthread_self()));
|
||||
|
|
|
@ -4,6 +4,59 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include <zephyr/ztest.h>
|
||||
|
||||
ZTEST(xsi_realtime, test_sched_getparam)
|
||||
{
|
||||
struct sched_param param;
|
||||
int rc = sched_getparam(0, ¶m);
|
||||
int err = errno;
|
||||
|
||||
zassert_true((rc == -1 && err == ENOSYS));
|
||||
}
|
||||
|
||||
ZTEST(xsi_realtime, test_sched_getscheduler)
|
||||
{
|
||||
int rc = sched_getscheduler(0);
|
||||
int err = errno;
|
||||
|
||||
zassert_true((rc == -1 && err == ENOSYS));
|
||||
}
|
||||
ZTEST(xsi_realtime, test_sched_setparam)
|
||||
{
|
||||
struct sched_param param = {
|
||||
.sched_priority = 2,
|
||||
};
|
||||
int rc = sched_setparam(0, ¶m);
|
||||
int err = errno;
|
||||
|
||||
zassert_true((rc == -1 && err == ENOSYS));
|
||||
}
|
||||
|
||||
ZTEST(xsi_realtime, test_sched_setscheduler)
|
||||
{
|
||||
struct sched_param param = {
|
||||
.sched_priority = 2,
|
||||
};
|
||||
int policy = 0;
|
||||
int rc = sched_setscheduler(0, policy, ¶m);
|
||||
int err = errno;
|
||||
|
||||
zassert_true((rc == -1 && err == ENOSYS));
|
||||
}
|
||||
|
||||
ZTEST(xsi_realtime, test_sched_rr_get_interval)
|
||||
{
|
||||
struct timespec interval = {
|
||||
.tv_sec = 0,
|
||||
.tv_nsec = 0,
|
||||
};
|
||||
int rc = sched_rr_get_interval(0, &interval);
|
||||
int err = errno;
|
||||
|
||||
zassert_true((rc == -1 && err == ENOSYS));
|
||||
}
|
||||
|
||||
ZTEST_SUITE(xsi_realtime, NULL, NULL, NULL, NULL, NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue