From: Jon Turney <jon.turney@dronecode.org.uk>
To: cygwin-patches@cygwin.com
Cc: Jon Turney <jon.turney@dronecode.org.uk>
Subject: [PATCH 6/8] Cygwin: testsuite: Update pthread tests for default SCHED_FIFO
Date: Tue, 10 Jan 2023 16:37:07 +0000 [thread overview]
Message-ID: <20230110163709.16265-7-jon.turney@dronecode.org.uk> (raw)
In-Reply-To: <20230110163709.16265-1-jon.turney@dronecode.org.uk>
Update for default (and only) thread scheduler policy is SCHED_FIFO.
---
winsup/testsuite/winsup.api/pthread/inherit1.c | 8 ++++----
winsup/testsuite/winsup.api/pthread/priority1.c | 6 +++---
winsup/testsuite/winsup.api/pthread/priority2.c | 8 ++++----
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/winsup/testsuite/winsup.api/pthread/inherit1.c b/winsup/testsuite/winsup.api/pthread/inherit1.c
index 545e4596f..16c3f534b 100644
--- a/winsup/testsuite/winsup.api/pthread/inherit1.c
+++ b/winsup/testsuite/winsup.api/pthread/inherit1.c
@@ -65,8 +65,8 @@ main()
int policy;
int inheritsched = -1;
- assert((maxPrio = sched_get_priority_max(SCHED_OTHER)) != -1);
- assert((minPrio = sched_get_priority_min(SCHED_OTHER)) != -1);
+ assert((maxPrio = sched_get_priority_max(SCHED_FIFO)) != -1);
+ assert((minPrio = sched_get_priority_min(SCHED_FIFO)) != -1);
assert(pthread_attr_init(&attr) == 0);
assert(pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED) == 0);
@@ -78,9 +78,9 @@ main()
mainParam.sched_priority = prio;
/* Change the main thread priority */
- assert(pthread_setschedparam(mainThread, SCHED_OTHER, &mainParam) == 0);
+ assert(pthread_setschedparam(mainThread, SCHED_FIFO, &mainParam) == 0);
assert(pthread_getschedparam(mainThread, &policy, &mainParam) == 0);
- assert(policy == SCHED_OTHER);
+ assert(policy == SCHED_FIFO);
assert(mainParam.sched_priority == prio);
for (param.sched_priority = prio;
diff --git a/winsup/testsuite/winsup.api/pthread/priority1.c b/winsup/testsuite/winsup.api/pthread/priority1.c
index b740b997f..a1e8d051d 100644
--- a/winsup/testsuite/winsup.api/pthread/priority1.c
+++ b/winsup/testsuite/winsup.api/pthread/priority1.c
@@ -47,7 +47,7 @@ void * func(void * arg)
struct sched_param param;
assert(pthread_getschedparam(pthread_self(), &policy, ¶m) == 0);
- assert(policy == SCHED_OTHER);
+ assert(policy == SCHED_FIFO);
return (void *)(size_t)param.sched_priority;
}
@@ -58,8 +58,8 @@ main()
pthread_attr_t attr;
void * result = NULL;
struct sched_param param;
- int maxPrio = sched_get_priority_max(SCHED_OTHER);
- int minPrio = sched_get_priority_min(SCHED_OTHER);
+ int maxPrio = sched_get_priority_max(SCHED_FIFO);
+ int minPrio = sched_get_priority_min(SCHED_FIFO);
assert(pthread_attr_init(&attr) == 0);
assert(pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED) == 0);
diff --git a/winsup/testsuite/winsup.api/pthread/priority2.c b/winsup/testsuite/winsup.api/pthread/priority2.c
index d2d0b0695..0534e7ba1 100644
--- a/winsup/testsuite/winsup.api/pthread/priority2.c
+++ b/winsup/testsuite/winsup.api/pthread/priority2.c
@@ -51,7 +51,7 @@ void * func(void * arg)
assert(pthread_mutex_lock(&startMx) == 0);
assert(pthread_getschedparam(pthread_self(), &policy, ¶m) == 0);
assert(pthread_mutex_unlock(&startMx) == 0);
- assert(policy == SCHED_OTHER);
+ assert(policy == SCHED_FIFO);
return (void *) (size_t)param.sched_priority;
}
@@ -61,8 +61,8 @@ main()
pthread_t t;
void * result = NULL;
struct sched_param param;
- int maxPrio = sched_get_priority_max(SCHED_OTHER);
- int minPrio = sched_get_priority_min(SCHED_OTHER);
+ int maxPrio = sched_get_priority_max(SCHED_FIFO);
+ int minPrio = sched_get_priority_min(SCHED_FIFO);
for (param.sched_priority = minPrio;
param.sched_priority <= maxPrio;
@@ -70,7 +70,7 @@ main()
{
assert(pthread_mutex_lock(&startMx) == 0);
assert(pthread_create(&t, NULL, func, NULL) == 0);
- assert(pthread_setschedparam(t, SCHED_OTHER, ¶m) == 0);
+ assert(pthread_setschedparam(t, SCHED_FIFO, ¶m) == 0);
assert(pthread_mutex_unlock(&startMx) == 0);
pthread_join(t, &result);
assert((int)(size_t)result == param.sched_priority);
--
2.39.0
next prev parent reply other threads:[~2023-01-10 16:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-10 16:37 [PATCH 0/8] Further testsuite fixes Jon Turney
2023-01-10 16:37 ` [PATCH 1/8] Cygwin: testsuite: automake doesn't define objdir Jon Turney
2023-01-10 16:37 ` [PATCH 2/8] Cygwin: testsuite: Build testcases using automake Jon Turney
2023-01-10 16:37 ` [PATCH 3/8] Cygwin: testsuite: Fix compilation warnings Jon Turney
2023-01-10 16:37 ` [PATCH 4/8] Cygwin: testsuite: 64-bit fixes in pthread testcases Jon Turney
2023-01-10 16:37 ` [PATCH 5/8] Cygwin: testsuite: Update mutex tests for changed default mutex type Jon Turney
2023-01-10 16:37 ` Jon Turney [this message]
2023-01-10 16:37 ` [PATCH 7/8] Cygwin: testsuite: Drop appending 'ntsec' to CYGWIN in cygrun wrapper Jon Turney
2023-01-10 16:37 ` [PATCH 8/8] Cygwin: CI: Run cygserver for tests Jon Turney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230110163709.16265-7-jon.turney@dronecode.org.uk \
--to=jon.turney@dronecode.org.uk \
--cc=cygwin-patches@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).