From: Jon Turney <jon.turney@dronecode.org.uk>
To: cygwin-patches@cygwin.com
Cc: Jon Turney <jon.turney@dronecode.org.uk>
Subject: [PATCH 5/8] Cygwin: testsuite: Update mutex tests for changed default mutex type
Date: Tue, 10 Jan 2023 16:37:06 +0000 [thread overview]
Message-ID: <20230110163709.16265-6-jon.turney@dronecode.org.uk> (raw)
In-Reply-To: <20230110163709.16265-1-jon.turney@dronecode.org.uk>
Default mutex type is PTHREAD_MUTEX_NORMAL.
Attempting to unlock an unowned mutex of that type is specified as
undefined behaviour, not returning EPERM.
mutex7e verfies that attempting to unlock an unowned mutex of type
PTHREAD_MUTEX_ERRORCHECK returns EPERM.
---
winsup/testsuite/winsup.api/pthread/mutex5.c | 2 +-
winsup/testsuite/winsup.api/pthread/mutex7.c | 3 +--
winsup/testsuite/winsup.api/pthread/mutex7d.c | 3 +--
winsup/testsuite/winsup.api/pthread/mutex7n.c | 1 -
4 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/winsup/testsuite/winsup.api/pthread/mutex5.c b/winsup/testsuite/winsup.api/pthread/mutex5.c
index 7029da12f..6d24275f1 100644
--- a/winsup/testsuite/winsup.api/pthread/mutex5.c
+++ b/winsup/testsuite/winsup.api/pthread/mutex5.c
@@ -23,7 +23,7 @@ main()
{
assert(pthread_mutexattr_init(&mxAttr) == 0);
assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0);
- assert(mxType == PTHREAD_MUTEX_ERRORCHECK);
+ assert(mxType == PTHREAD_MUTEX_NORMAL);
}
return 0;
diff --git a/winsup/testsuite/winsup.api/pthread/mutex7.c b/winsup/testsuite/winsup.api/pthread/mutex7.c
index d2c9f8bee..6acb12317 100644
--- a/winsup/testsuite/winsup.api/pthread/mutex7.c
+++ b/winsup/testsuite/winsup.api/pthread/mutex7.c
@@ -2,7 +2,7 @@
* mutex7.c
*
* Test the default (type not set) mutex type.
- * Should be the same as PTHREAD_MUTEX_ERRORCHECK.
+ * Should be the same as PTHREAD_MUTEX_NORMAL.
* Thread locks then trylocks mutex (attempted recursive lock).
* The thread should lock first time and EBUSY second time.
*
@@ -25,7 +25,6 @@ void * locker(void * arg)
assert(pthread_mutex_trylock(&mutex) == EBUSY);
lockCount++;
assert(pthread_mutex_unlock(&mutex) == 0);
- assert(pthread_mutex_unlock(&mutex) == EPERM);
return 0;
}
diff --git a/winsup/testsuite/winsup.api/pthread/mutex7d.c b/winsup/testsuite/winsup.api/pthread/mutex7d.c
index 906d0f043..98b74fc5b 100644
--- a/winsup/testsuite/winsup.api/pthread/mutex7d.c
+++ b/winsup/testsuite/winsup.api/pthread/mutex7d.c
@@ -2,7 +2,7 @@
* mutex7d.c
*
* Test the default (type not set) mutex type.
- * Should be the same as PTHREAD_MUTEX_ERRORCHECK.
+ * Should be the same as PTHREAD_MUTEX_NORMAL.
* Thread locks then trylocks mutex (attempted recursive lock).
* The thread should lock first time and EBUSY second time.
*
@@ -25,7 +25,6 @@ void * locker(void * arg)
assert(pthread_mutex_trylock(&mutex) == EBUSY);
lockCount++;
assert(pthread_mutex_unlock(&mutex) == 0);
- assert(pthread_mutex_unlock(&mutex) == EPERM);
return 0;
}
diff --git a/winsup/testsuite/winsup.api/pthread/mutex7n.c b/winsup/testsuite/winsup.api/pthread/mutex7n.c
index e9a36fec0..a04792b61 100644
--- a/winsup/testsuite/winsup.api/pthread/mutex7n.c
+++ b/winsup/testsuite/winsup.api/pthread/mutex7n.c
@@ -29,7 +29,6 @@ void * locker(void * arg)
assert(pthread_mutex_trylock(&mutex) == EBUSY);
lockCount++;
assert(pthread_mutex_unlock(&mutex) == 0);
- assert(pthread_mutex_unlock(&mutex) == EPERM);
return (void *) 555;
}
--
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 ` Jon Turney [this message]
2023-01-10 16:37 ` [PATCH 6/8] Cygwin: testsuite: Update pthread tests for default SCHED_FIFO Jon Turney
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-6-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).