summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Bmakefile2
-rw-r--r--tests/ChangeLog11
-rw-r--r--tests/GNUmakefile2
-rw-r--r--tests/Makefile2
-rw-r--r--tests/Wmakefile2
-rw-r--r--tests/rwlock3.c4
-rw-r--r--tests/rwlock4.c4
-rw-r--r--tests/rwlock5.c4
-rw-r--r--tests/spin3.c6
9 files changed, 29 insertions, 8 deletions
diff --git a/tests/Bmakefile b/tests/Bmakefile
index bd8d7b7..992b240 100644
--- a/tests/Bmakefile
+++ b/tests/Bmakefile
@@ -326,7 +326,7 @@ robust4.pass: robust3.pass
robust5.pass: robust4.pass
rwlock1.pass: condvar6.pass
rwlock2.pass: rwlock1.pass
-rwlock3.pass: rwlock2.pass
+rwlock3.pass: rwlock2.pass join2.pass
rwlock4.pass: rwlock3.pass
rwlock5.pass: rwlock4.pass
rwlock6.pass: rwlock5.pass
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 803b4dc..91bb8ef 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,14 @@
+2011-07-02 Ross Johnson <ross dot johnson at homemail dot com dot au>
+
+ * spin3.c: Unlock the unlocked spinlock now returns success.
+ * rwlock3.c: Join the thread to ensure it's completed.
+ * rwlock4.c: Likewise.
+ * rwlock5.c: Likewise.
+ * Makefile: Adjust prerequisites.
+ * GNUmakefile: Likewise.
+ * Bmakefile: Likewise.
+ * Wmakefile: Likewise.
+
2011-07-02 Daniel Richard G. <skunk at iskunk dot org>
* *.[ch]: Cleanups around timeb struct, mainly centralising
diff --git a/tests/GNUmakefile b/tests/GNUmakefile
index e0e9de5..e773433 100644
--- a/tests/GNUmakefile
+++ b/tests/GNUmakefile
@@ -348,7 +348,7 @@ robust4.pass: robust3.pass
robust5.pass: robust4.pass
rwlock1.pass: condvar6.pass
rwlock2.pass: rwlock1.pass
-rwlock3.pass: rwlock2.pass
+rwlock3.pass: rwlock2.pass join2.pass
rwlock4.pass: rwlock3.pass
rwlock5.pass: rwlock4.pass
rwlock6.pass: rwlock5.pass
diff --git a/tests/Makefile b/tests/Makefile
index cb4cacb..595c5b5 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -417,7 +417,7 @@ robust4.pass: robust3.pass
robust5.pass: robust4.pass
rwlock1.pass: condvar6.pass
rwlock2.pass: rwlock1.pass
-rwlock3.pass: rwlock2.pass
+rwlock3.pass: rwlock2.pass join2.pass
rwlock4.pass: rwlock3.pass
rwlock5.pass: rwlock4.pass
rwlock6.pass: rwlock5.pass
diff --git a/tests/Wmakefile b/tests/Wmakefile
index 0fcbd43..8d5d7a5 100644
--- a/tests/Wmakefile
+++ b/tests/Wmakefile
@@ -324,7 +324,7 @@ robust4.pass: robust3.pass
robust5.pass: robust4.pass
rwlock1.pass: condvar6.pass
rwlock2.pass: rwlock1.pass
-rwlock3.pass: rwlock2.pass
+rwlock3.pass: rwlock2.pass join2.pass
rwlock4.pass: rwlock3.pass
rwlock5.pass: rwlock4.pass
rwlock6.pass: rwlock5.pass
diff --git a/tests/rwlock3.c b/tests/rwlock3.c
index 36ccf58..d30f040 100644
--- a/tests/rwlock3.c
+++ b/tests/rwlock3.c
@@ -37,6 +37,8 @@
* and then unlock it again.
*
* Depends on API functions:
+ * pthread_create()
+ * pthread_join()
* pthread_rwlock_wrlock()
* pthread_rwlock_trywrlock()
* pthread_rwlock_unlock()
@@ -66,7 +68,7 @@ main()
assert(pthread_create(&t, NULL, func, NULL) == 0);
- Sleep(20);
+ assert(pthread_join(t, NULL) == 0);
assert(pthread_rwlock_unlock(&rwlock1) == 0);
diff --git a/tests/rwlock4.c b/tests/rwlock4.c
index 7ba6302..a19a001 100644
--- a/tests/rwlock4.c
+++ b/tests/rwlock4.c
@@ -37,6 +37,8 @@
* and then unlock it again.
*
* Depends on API functions:
+ * pthread_create()
+ * pthread_join()
* pthread_rwlock_rdlock()
* pthread_rwlock_trywrlock()
* pthread_rwlock_unlock()
@@ -66,7 +68,7 @@ main()
assert(pthread_create(&t, NULL, func, NULL) == 0);
- Sleep(20);
+ assert(pthread_join(t, NULL) == 0);
assert(pthread_rwlock_unlock(&rwlock1) == 0);
diff --git a/tests/rwlock5.c b/tests/rwlock5.c
index 75880cd..3b40547 100644
--- a/tests/rwlock5.c
+++ b/tests/rwlock5.c
@@ -37,6 +37,8 @@
* and then unlock it again.
*
* Depends on API functions:
+ * pthread_create()
+ * pthread_join()
* pthread_rwlock_rdlock()
* pthread_rwlock_tryrdlock()
* pthread_rwlock_unlock()
@@ -68,7 +70,7 @@ main()
assert(pthread_create(&t, NULL, func, NULL) == 0);
- Sleep(20);
+ assert(pthread_join(t, NULL) == 0);
assert(pthread_rwlock_unlock(&rwlock1) == 0);
diff --git a/tests/spin3.c b/tests/spin3.c
index fa16b35..bbf8bfb 100644
--- a/tests/spin3.c
+++ b/tests/spin3.c
@@ -64,7 +64,11 @@ main()
assert(pthread_spin_lock(&spin) == 0);
assert(pthread_create(&t, NULL, unlocker, (void*)0) == 0);
assert(pthread_join(t, NULL) == 0);
- assert(pthread_spin_unlock(&spin) == EPERM);
+ /*
+ * Our spinlocks don't record the owner thread so any thread can unlock the spinlock,
+ * but nor is it an error for any thread to unlock a spinlock that is not locked.
+ */
+ assert(pthread_spin_unlock(&spin) == 0);
assert(pthread_spin_destroy(&spin) == 0);
assert(wasHere == 2);