Module: xenomai-3
Branch: next
Commit: f627aa5ca450915466f014fa7eb7ff49252af760
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f627aa5ca450915466f014fa7eb7ff49252af760

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Thu Feb 25 11:29:00 2016 +0100

smokey/posix-mutex: Fix test case /wrt mutex object reuse

Mutex objects created on the stack must be properly destroyed after use.
Otherwise, succeeding tests that use the same stack layout will consider
them busy and refuse to recreate the mutexes.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 testsuite/smokey/posix-mutex/posix-mutex.c |   26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/testsuite/smokey/posix-mutex/posix-mutex.c 
b/testsuite/smokey/posix-mutex/posix-mutex.c
index ae82fc1..151c2f3 100644
--- a/testsuite/smokey/posix-mutex/posix-mutex.c
+++ b/testsuite/smokey/posix-mutex/posix-mutex.c
@@ -623,7 +623,10 @@ static int protect_raise(void)
 
        if (!__Tassert(get_effective_prio() == THREAD_PRIO_MEDIUM))
                return -EINVAL;
-       
+
+       if (!__T(ret, pthread_mutex_destroy(&mutex)))
+               return ret;
+
        return 0;
 }
 
@@ -651,7 +654,10 @@ static int protect_lower(void)
 
        if (!__Tassert(get_effective_prio() == THREAD_PRIO_MEDIUM))
                return -EINVAL;
-       
+
+       if (!__T(ret, pthread_mutex_destroy(&mutex)))
+               return ret;
+
        return 0;
 }
 
@@ -699,7 +705,10 @@ static int protect_weak(void)
        if (!__T(ret, pthread_setschedparam(pthread_self(),
                                            old_policy, &old_param)))
                return ret;
-       
+
+       if (!__T(ret, pthread_mutex_destroy(&mutex)))
+               return ret;
+
        return 0;
 }
 
@@ -745,7 +754,11 @@ static int protect_nesting_protect(void)
 
        if (!__Tassert(get_effective_prio() == THREAD_PRIO_MEDIUM))
                return -EINVAL;
-       
+
+       if (!__T(ret, pthread_mutex_destroy(&mutex_high)) ||
+           !__T(ret, pthread_mutex_destroy(&mutex_very_high)))
+               return ret;
+
        return 0;
 }
 
@@ -782,7 +795,10 @@ static int protect_nesting_pi(void)
        /* PP boost just dropped: HIGH -> MEDIUM. */
        if (!__Tassert(get_effective_prio() == THREAD_PRIO_MEDIUM))
                return -EINVAL;
-       
+
+       if (!__T(ret, pthread_mutex_destroy(&mutex_pp)))
+               return ret;
+
        return 0;
 }
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to