All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bogdan Lezhepekov via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v1 5/6] rt:pi-tests:testpi-5: return exit code
Date: Tue, 14 Sep 2021 20:08:50 +0300	[thread overview]
Message-ID: <20210914170851.22931-5-bogdan.lezhepekov@suse.com> (raw)
Message-ID: <20210914170850.Zfhafg_TMW2368HTVU8yFYuarsEFj36B-yawpykgq2k@z> (raw)
In-Reply-To: <20210914170851.22931-1-bogdan.lezhepekov@suse.com>

Signed-off-by: Bogdan Lezhepekov <bogdan.lezhepekov@suse.com>
---
 testcases/realtime/func/pi-tests/testpi-5.c | 24 ++++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/testcases/realtime/func/pi-tests/testpi-5.c b/testcases/realtime/func/pi-tests/testpi-5.c
index a52486417..538be1e44 100644
--- a/testcases/realtime/func/pi-tests/testpi-5.c
+++ b/testcases/realtime/func/pi-tests/testpi-5.c
@@ -68,29 +68,37 @@ int do_test(int argc, char **argv)
 {
 	pthread_mutexattr_t mutexattr;
 	int retc, protocol;
+	unsigned int err = 0;
 
 #if HAS_PRIORITY_INHERIT
 
-	if (pthread_mutexattr_init(&mutexattr) != 0)
+	if (pthread_mutexattr_init(&mutexattr) != 0) {
 		printf("Failed to init mutexattr\n");
+		err++;
+	}
 
 	if (pthread_mutexattr_setprotocol(&mutexattr,
-					  PTHREAD_PRIO_INHERIT) != 0)
+					  PTHREAD_PRIO_INHERIT) != 0) {
 		printf("Can't set protocol prio inherit\n");
-
-	if (pthread_mutexattr_getprotocol(&mutexattr, &protocol) != 0)
+		err++;
+	}
+		
+	if (pthread_mutexattr_getprotocol(&mutexattr, &protocol) != 0) {
 		printf("Can't get mutexattr protocol\n");
-	else
+		err++;
+	} else 
 		printf("protocol in mutexattr is %d\n", protocol);
-
+		
 	retc = pthread_mutex_init(&child_mutex, &mutexattr);
-	if (retc != 0)
+	if (retc != 0) {
 		printf("Failed to init mutex: %d\n", retc);
+		err++;
+	}
 
 	create_other_thread(child_thread, NULL);
 	join_threads();
 
-	return 0;
+	return err > 0 ? 1: 0;
 #else
 	return 1;
 #endif
-- 
2.32.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2021-09-14 17:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-14 17:08 [LTP] [PATCH v1 1/6] realtime:async_handler_jk: return actual exit code Bogdan Lezhepekov via ltp
2021-09-14 17:08 ` Bogdan Lezhepekov via ltp
2021-09-14 17:08   ` [LTP] [PATCH v1 2/6] rt:pi-tests::sbrk_mutex: " Bogdan Lezhepekov via ltp
2021-09-14 17:08     ` Bogdan Lezhepekov via ltp
2021-09-24 15:33       ` Cyril Hrubis
2021-09-14 17:08   ` [LTP] [PATCH v1 3/6] rt:pi-tests:testpi-0: " Bogdan Lezhepekov via ltp
2021-09-14 17:08     ` Bogdan Lezhepekov via ltp
2021-09-14 17:08   ` [LTP] [PATCH v1 4/6] rt:pi-tests:test-skeleton: fix wrong return value Bogdan Lezhepekov via ltp
2021-09-14 17:08     ` Bogdan Lezhepekov via ltp
2021-09-14 17:08   ` Bogdan Lezhepekov via ltp [this message]
2021-09-14 17:08     ` [LTP] [PATCH v1 5/6] rt:pi-tests:testpi-5: return exit code Bogdan Lezhepekov via ltp
2021-09-24  9:53       ` Petr Vorel
2021-09-24 10:07         ` Bogdan Lezhepekov via ltp
2021-09-14 17:08   ` [LTP] [PATCH v1 6/6] rt:pi-tests:testpi-6: " Bogdan Lezhepekov via ltp
2021-09-14 17:08     ` Bogdan Lezhepekov via ltp

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=20210914170851.22931-5-bogdan.lezhepekov@suse.com \
    --to=ltp@lists.linux.it \
    --cc=bogdan.lezhepekov@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.