[rtems-libbsd commit] tests/mutex01: Fix mtx_recursed() usage

Sebastian Huber sebh at rtems.org
Thu Nov 9 13:29:18 UTC 2017


Module:    rtems-libbsd
Branch:    master
Commit:    c64806c4725ea06663b8fc94ed06a205f0ed2e69
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=c64806c4725ea06663b8fc94ed06a205f0ed2e69

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Nov  9 14:28:37 2017 +0100

tests/mutex01: Fix mtx_recursed() usage

---

 testsuite/mutex01/test_main.c | 64 +++++++++++++++++++++----------------------
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/testsuite/mutex01/test_main.c b/testsuite/mutex01/test_main.c
index 2402883..caaf118 100644
--- a/testsuite/mutex01/test_main.c
+++ b/testsuite/mutex01/test_main.c
@@ -194,15 +194,15 @@ test_mtx_non_recursive(test_context *ctx)
 	assert(mtx_initialized(mtx));
 
 	assert(!mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 	mtx_lock(mtx);
 
 	assert(mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 
 	mtx_unlock(mtx);
 	assert(!mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 
 	mtx_destroy(mtx);
 	assert(!mtx_initialized(mtx));
@@ -220,31 +220,31 @@ test_mtx_recursive(test_context *ctx)
 	assert(mtx_initialized(mtx));
 
 	assert(!mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 	mtx_lock(mtx);
 
 	assert(mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 	mtx_lock(mtx);
 
 	assert(mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 1);
+	assert(mtx_recursed(mtx));
 	mtx_lock(mtx);
 
 	assert(mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 2);
+	assert(mtx_recursed(mtx));
 
 	mtx_unlock(mtx);
 	assert(mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 1);
+	assert(mtx_recursed(mtx));
 
 	mtx_unlock(mtx);
 	assert(mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 
 	mtx_unlock(mtx);
 	assert(!mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 
 	mtx_destroy(mtx);
 	assert(!mtx_initialized(mtx));
@@ -264,21 +264,21 @@ test_mtx_trylock(test_context *ctx)
 	assert(mtx_initialized(mtx));
 
 	assert(!mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 	ok = mtx_trylock(mtx);
 	assert(ok != 0);
 	assert(mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 
 	mtx_unlock(mtx);
 	assert(!mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 
 	assert(!mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 	mtx_lock(mtx);
 	assert(mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 
 	ctx->done[index] = false;
 	ctx->rv = 1;
@@ -287,10 +287,10 @@ test_mtx_trylock(test_context *ctx)
 	assert(ctx->rv == 0);
 
 	assert(mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 	mtx_unlock(mtx);
 	assert(!mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 
 	mtx_destroy(mtx);
 	assert(!mtx_initialized(mtx));
@@ -317,10 +317,10 @@ test_mtx_lock(test_context *ctx)
 	/* Resource count one */
 
 	assert(!mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 	mtx_lock(mtx);
 	assert(mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 	assert(get_self_prio() == PRIO_MASTER);
 
 	ctx->done[low] = false;
@@ -330,21 +330,21 @@ test_mtx_lock(test_context *ctx)
 	assert(!ctx->done[low]);
 	assert(!ctx->done[high]);
 	assert(mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 	assert(get_self_prio() == prio_worker[low]);
 
 	send_events(ctx, EVENT_LOCK, high);
 	assert(!ctx->done[low]);
 	assert(!ctx->done[high]);
 	assert(mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 	assert(get_self_prio() == prio_worker[high]);
 
 	mtx_unlock(mtx);
 	assert(!ctx->done[low]);
 	assert(ctx->done[high]);
 	assert(!mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 	assert(get_self_prio() == PRIO_MASTER);
 
 	ctx->done[high] = false;
@@ -359,35 +359,35 @@ test_mtx_lock(test_context *ctx)
 	/* Resource count two */
 
 	assert(!mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 	mtx_lock(mtx);
 	assert(mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 	assert(get_self_prio() == PRIO_MASTER);
 
 	assert(!mtx_owned(mtx2));
-	assert(mtx_recursed(mtx2) == 0);
+	assert(!mtx_recursed(mtx2));
 	mtx_lock(mtx2);
 	assert(mtx_owned(mtx2));
-	assert(mtx_recursed(mtx2) == 0);
+	assert(!mtx_recursed(mtx2));
 	assert(get_self_prio() == PRIO_MASTER);
 
 	ctx->done[low] = false;
 	send_events(ctx, EVENT_LOCK, low);
 	assert(!ctx->done[low]);
 	assert(mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 	assert(get_self_prio() == prio_worker[low]);
 
 	mtx_unlock(mtx2);
 	assert(!mtx_owned(mtx2));
-	assert(mtx_recursed(mtx2) == 0);
+	assert(!mtx_recursed(mtx2));
 	assert(get_self_prio() == prio_worker[low]);
 
 	mtx_unlock(mtx);
 	assert(ctx->done[low]);
 	assert(!mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 	assert(get_self_prio() == PRIO_MASTER);
 
 	ctx->done[low] = false;
@@ -423,10 +423,10 @@ test_mtx_sleep_with_lock(test_context *ctx)
 	assert(!ctx->done[index]);
 
 	assert(!mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 	mtx_lock(mtx);
 	assert(mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 
 	wakeup(ctx);
 	assert(!ctx->done[index]);
@@ -434,7 +434,7 @@ test_mtx_sleep_with_lock(test_context *ctx)
 	mtx_unlock(mtx);
 	assert(ctx->done[index]);
 	assert(!mtx_owned(mtx));
-	assert(mtx_recursed(mtx) == 0);
+	assert(!mtx_recursed(mtx));
 
 	ctx->done[index] = false;
 	send_events(ctx, EVENT_UNLOCK, index);



More information about the vc mailing list