All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v1 1/6] realtime:async_handler_jk: return actual exit code
@ 2021-09-14 17:08 ` Bogdan Lezhepekov via ltp
  2021-09-14 17:08     ` Bogdan Lezhepekov via ltp
                     ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Bogdan Lezhepekov via ltp @ 2021-09-14 17:08 UTC (permalink / raw)
  To: ltp

The original version always returned 0.

Signed-off-by: Bogdan Lezhepekov <bogdan.lezhepekov@suse.com>
---
 testcases/realtime/func/async_handler/async_handler_jk.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/testcases/realtime/func/async_handler/async_handler_jk.c b/testcases/realtime/func/async_handler/async_handler_jk.c
index 4d8721822..8b40a474a 100644
--- a/testcases/realtime/func/async_handler/async_handler_jk.c
+++ b/testcases/realtime/func/async_handler/async_handler_jk.c
@@ -137,6 +137,7 @@ int main(int argc, char *argv[])
 {
 	int aes_id;		// asynchronous event server id
 	int user_id;		// User thread - that fires the event
+	int result;
 	long delta;
 	struct thread *server;
 	setup();
@@ -155,10 +156,11 @@ int main(int argc, char *argv[])
 	join_thread(user_id);
 	join_threads();
 	delta = (end - start) / NS_PER_US;
+	result = delta > pass_criteria ? 1 : 0;
 
 	printf("delta = %ld us\n", delta);
 	printf("\nCriteria: latencies < %d\n", (int)pass_criteria);
-	printf("Result: %s\n", delta > pass_criteria ? "FAIL" : "PASS");
+	printf("Result: %s\n",  result ? "FAIL" : "PASS");
 
-	return 0;
+	return result;
 }
-- 
2.32.0


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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [LTP] [PATCH v1 2/6] rt:pi-tests::sbrk_mutex: return actual exit code
@ 2021-09-14 17:08     ` Bogdan Lezhepekov via ltp
  2021-09-24 15:33       ` Cyril Hrubis
  0 siblings, 1 reply; 9+ messages in thread
From: Bogdan Lezhepekov via ltp @ 2021-09-14 17:08 UTC (permalink / raw)
  To: ltp

The original version always returned 0.

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

diff --git a/testcases/realtime/func/pi-tests/sbrk_mutex.c b/testcases/realtime/func/pi-tests/sbrk_mutex.c
index 7ed7969d9..34e4e9666 100644
--- a/testcases/realtime/func/pi-tests/sbrk_mutex.c
+++ b/testcases/realtime/func/pi-tests/sbrk_mutex.c
@@ -97,7 +97,8 @@ void *worker_thread(void *arg)
 
 int main(int argc, char *argv[])
 {
-	int m, ret, robust;
+	int m, robust;
+	int ret = 0;
 	intptr_t t;
 	pthread_mutexattr_t mutexattr;
 	setup();
@@ -123,7 +124,8 @@ int main(int argc, char *argv[])
 		if (!(mutexes[m] = malloc(sizeof(pthread_mutex_t)))) {
 			perror("malloc failed\n");
 		}
-		if ((ret = pthread_mutex_init(mutexes[m], &mutexattr))) {
+		if (pthread_mutex_init(mutexes[m], &mutexattr)) {
+			ret = 1;
 			perror("pthread_mutex_init() failed\n");
 		}
 	}
@@ -140,11 +142,13 @@ int main(int argc, char *argv[])
 	/* destroy all the mutexes */
 	for (m = 0; m < NUM_MUTEXES; m++) {
 		if (mutexes[m]) {
-			if ((ret = pthread_mutex_destroy(mutexes[m])))
+			if (pthread_mutex_destroy(mutexes[m])) {
+				ret = 1;
 				perror("pthread_mutex_destroy() failed\n");
+			}
 			free(mutexes[m]);
 		}
 	}
 
-	return 0;
+	return ret;
 }
-- 
2.32.0


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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [LTP] [PATCH v1 3/6] rt:pi-tests:testpi-0: return actual exit code
@ 2021-09-14 17:08     ` Bogdan Lezhepekov via ltp
  0 siblings, 0 replies; 9+ messages in thread
From: Bogdan Lezhepekov via ltp @ 2021-09-14 17:08 UTC (permalink / raw)
  To: ltp

The original version always returned 0.

Signed-off-by: Bogdan Lezhepekov <bogdan.lezhepekov@suse.com>
---
 testcases/realtime/func/pi-tests/testpi-0.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/testcases/realtime/func/pi-tests/testpi-0.c b/testcases/realtime/func/pi-tests/testpi-0.c
index fd8ad0717..64797c899 100644
--- a/testcases/realtime/func/pi-tests/testpi-0.c
+++ b/testcases/realtime/func/pi-tests/testpi-0.c
@@ -94,8 +94,10 @@ int main(int argc, char *argv[])
 	printf("LIBPTHREAD_VERSION: %s\n", pathbuf);
 	free(pathbuf);
 
-	if (sysconf(_SC_THREAD_PRIO_INHERIT) == -1)
+	if (sysconf(_SC_THREAD_PRIO_INHERIT) == -1) {
 		printf("No Prio inheritance support\n");
+		exit(1);
+	}
 
 	printf("Prio inheritance support present\n");
 
-- 
2.32.0


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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [LTP] [PATCH v1 4/6] rt:pi-tests:test-skeleton: fix wrong return value
@ 2021-09-14 17:08     ` Bogdan Lezhepekov via ltp
  0 siblings, 0 replies; 9+ messages in thread
From: Bogdan Lezhepekov via ltp @ 2021-09-14 17:08 UTC (permalink / raw)
  To: ltp

Signed-off-by: Bogdan Lezhepekov <bogdan.lezhepekov@suse.com>
---
 testcases/realtime/func/pi-tests/test-skeleton.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/realtime/func/pi-tests/test-skeleton.c b/testcases/realtime/func/pi-tests/test-skeleton.c
index 7816cf877..4a923cd2d 100644
--- a/testcases/realtime/func/pi-tests/test-skeleton.c
+++ b/testcases/realtime/func/pi-tests/test-skeleton.c
@@ -88,7 +88,7 @@ static void timeout_handler(int sig)
 		exit(1);
 	}
 	printf("\nResult:PASS\n");
-	exit(1);
+	exit(0);
 }
 
 int main(int argc, char **argv)
-- 
2.32.0


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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [LTP] [PATCH v1 5/6] rt:pi-tests:testpi-5: return exit code
@ 2021-09-14 17:08     ` Bogdan Lezhepekov via ltp
  2021-09-24  9:53       ` Petr Vorel
  0 siblings, 1 reply; 9+ messages in thread
From: Bogdan Lezhepekov via ltp @ 2021-09-14 17:08 UTC (permalink / raw)
  To: ltp

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [LTP] [PATCH v1 6/6] rt:pi-tests:testpi-6: return exit code
@ 2021-09-14 17:08     ` Bogdan Lezhepekov via ltp
  0 siblings, 0 replies; 9+ messages in thread
From: Bogdan Lezhepekov via ltp @ 2021-09-14 17:08 UTC (permalink / raw)
  To: ltp

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

diff --git a/testcases/realtime/func/pi-tests/testpi-6.c b/testcases/realtime/func/pi-tests/testpi-6.c
index 637d38355..bc271f242 100644
--- a/testcases/realtime/func/pi-tests/testpi-6.c
+++ b/testcases/realtime/func/pi-tests/testpi-6.c
@@ -69,27 +69,35 @@ int do_test(int argc, char **argv)
 {
 	pthread_mutexattr_t mutexattr;
 	int retc, robust;
+	unsigned int err;
 
-	if (pthread_mutexattr_init(&mutexattr) != 0)
+	if (pthread_mutexattr_init(&mutexattr) != 0) {
 		printf("Failed to init mutexattr\n");
+		err++;
+	}
 
 	if (pthread_mutexattr_setrobust(&mutexattr,
-					   PTHREAD_MUTEX_ROBUST) != 0)
+					   PTHREAD_MUTEX_ROBUST) != 0) {
 		printf("Can't set robust mutex\n");
-
-	if (pthread_mutexattr_getrobust(&mutexattr, &robust) != 0)
+		err++;
+	}
+		
+	if (pthread_mutexattr_getrobust(&mutexattr, &robust) != 0) {
 		printf("Can't get mutexattr protocol\n");
-	else
+		err++;
+	} else 
 		printf("robust in mutexattr is %d\n", robust);
 
 	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;
 }
 
 #include "test-skeleton.c"
-- 
2.32.0


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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [LTP] [PATCH v1 5/6] rt:pi-tests:testpi-5: return exit code
  2021-09-14 17:08     ` Bogdan Lezhepekov via ltp
@ 2021-09-24  9:53       ` Petr Vorel
  2021-09-24 10:07         ` Bogdan Lezhepekov via ltp
  0 siblings, 1 reply; 9+ messages in thread
From: Petr Vorel @ 2021-09-24  9:53 UTC (permalink / raw)
  To: Bogdan Lezhepekov; +Cc: ltp

Hi Bogdan,

> +++ b/testcases/realtime/func/pi-tests/testpi-5.c
...

>  	create_other_thread(child_thread, NULL);
>  	join_threads();

> -	return 0;
> +	return err > 0 ? 1: 0;
nit: "1: 0" => "1 : 0" (for better readability).

Whole patchset LGTM, thanks for improving realtime tests.

To whole patchset:
Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [LTP] [PATCH v1 5/6] rt:pi-tests:testpi-5: return exit code
  2021-09-24  9:53       ` Petr Vorel
@ 2021-09-24 10:07         ` Bogdan Lezhepekov via ltp
  0 siblings, 0 replies; 9+ messages in thread
From: Bogdan Lezhepekov via ltp @ 2021-09-24 10:07 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp


[-- Attachment #1.1: Type: text/plain, Size: 764 bytes --]

Hi Petr,

Thanks for reviewing!

-Bogdan
________________________________
From: Petr Vorel <pvorel@suse.cz>
Sent: Friday, September 24, 2021 12:53
To: Bogdan Lezhepekov <bogdan.lezhepekov@suse.com>
Cc: ltp@lists.linux.it <ltp@lists.linux.it>; Cyril Hrubis <chrubis@suse.cz>
Subject: Re: [LTP] [PATCH v1 5/6] rt:pi-tests:testpi-5: return exit code

Hi Bogdan,

> +++ b/testcases/realtime/func/pi-tests/testpi-5.c
...

>        create_other_thread(child_thread, NULL);
>        join_threads();

> -     return 0;
> +     return err > 0 ? 1: 0;
nit: "1: 0" => "1 : 0" (for better readability).

Whole patchset LGTM, thanks for improving realtime tests.

To whole patchset:
Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr


[-- Attachment #1.2: Type: text/html, Size: 2192 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [LTP] [PATCH v1 2/6] rt:pi-tests::sbrk_mutex: return actual exit code
  2021-09-14 17:08     ` Bogdan Lezhepekov via ltp
@ 2021-09-24 15:33       ` Cyril Hrubis
  0 siblings, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2021-09-24 15:33 UTC (permalink / raw)
  To: Bogdan Lezhepekov; +Cc: ltp

Hi!
I'm looking on how the pi-tests are supposed to be executed and it seems
that the return value does not seems to matter at all.

Each of these tests is executed by run_c_files.sh script that writes the
output into a logfile then a python script is used to parse the logfile.

I think that if we want to fix the realtime tests we should simplify
this mess first.

-- 
Cyril Hrubis
chrubis@suse.cz

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-09-24 15:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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   ` [LTP] [PATCH v1 5/6] rt:pi-tests:testpi-5: return exit code Bogdan Lezhepekov via ltp
2021-09-14 17:08     ` 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

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.