Linux-rt-users Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated
@ 2021-03-20 18:37 Daniel Wagner
  2021-03-20 18:37 ` [PATCH rt-tests v3 01/33] cyclictest: Remove unused include header Daniel Wagner
                   ` (33 more replies)
  0 siblings, 34 replies; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:37 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

v3:
  - rebase
  - two patches splitted into per test program change
  - commit messsage added
  
v2:
  - added 'return_code' to the common section of the JSON output
  - dropped 'inversion' as we have 'return_code' in pip_stress
  - dropped 'success' as we have 'return code in ssdd

All patches are also available at:

  https://github.com/igaw/rt-tests/tree/json-output-2021-03-20

Daniel Wagner (33):
  cyclictest: Remove unused include header
  cyclicdeadline: Remove unused include header
  signaltest: Add missing --output usage info
  rt-util: Add rt_init function
  cyclictest: Initialize rt-util
  oslat: Initialize rt-util
  pmqtest: Initialize rt-util
  ptsematest: Initialize rt-util
  rt-migrate-test: Initialize rt-util
  cyclicdeadline: Initialize rt-util
  signaltest: Initialize rt-util
  sigwaittest: Initialize rt-util
  svematest: Initialize rt-util
  rt-util: Remove superfluous arguments from rt_write_json
  rt-util: Introduce rt_test_start()
  cyclictest: Record start of test execution
  oslat: Record start of test execution
  pmqtest: Record start of test execution
  ptesematest: Record start of test execution
  rt-migrate-test: Record start of test execution
  cyclicdeadline: Record start of test execution
  signaltest: Record start of test execution
  sigwaittest: Record start of test execution
  svsematest: Record start of test execution
  rt-util: Add return_code to common section of JSON output
  pip_stress: Move test result output to main
  pip_stress: Return failure code if test fails
  pip_stress: Prepare arg parser to accept only long options
  pip_stress: Add JSON output feature
  pi_stress: Prepare command line parser for long options only
  pi_stress: Add JSON output feature
  ssdd: Add quiet command line option
  ssdd: Add JSON output feature

 src/cyclictest/cyclictest.c           |  5 +-
 src/include/rt-utils.h                |  6 +-
 src/lib/rt-utils.c                    | 85 ++++++++++++++++-----------
 src/oslat/oslat.c                     |  6 +-
 src/pi_tests/pi_stress.c              | 65 ++++++++++++++++----
 src/pi_tests/pip_stress.c             | 40 +++++++++----
 src/pmqtest/pmqtest.c                 |  4 +-
 src/ptsematest/ptsematest.c           |  4 +-
 src/rt-migrate-test/rt-migrate-test.c |  4 +-
 src/sched_deadline/cyclicdeadline.c   |  6 +-
 src/signaltest/signaltest.c           |  5 +-
 src/sigwaittest/sigwaittest.c         |  4 +-
 src/ssdd/ssdd.c                       | 43 +++++++++++---
 src/svsematest/svsematest.c           |  4 +-
 14 files changed, 199 insertions(+), 82 deletions(-)

-- 
2.30.2


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

* [PATCH rt-tests v3 01/33] cyclictest: Remove unused include header
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
@ 2021-03-20 18:37 ` Daniel Wagner
  2021-05-07 16:17   ` John Kacur
  2021-03-20 18:37 ` [PATCH rt-tests v3 02/33] cyclicdeadline: " Daniel Wagner
                   ` (32 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:37 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

The header was introduced by 24aaf9619bc2 ("cyclictest: Add JSON
output feature") for PRIu64 format specifier. As PRIu64 was removed in
commit f6881fc42baa ("cyclictest: Fix printf format specifier") remove
the include header again.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/cyclictest/cyclictest.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index dca961025433..c43dd7cbbd64 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -11,7 +11,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
-#include <inttypes.h>
 #include <stdarg.h>
 #include <unistd.h>
 #include <fcntl.h>
-- 
2.30.2


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

* [PATCH rt-tests v3 02/33] cyclicdeadline: Remove unused include header
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
  2021-03-20 18:37 ` [PATCH rt-tests v3 01/33] cyclictest: Remove unused include header Daniel Wagner
@ 2021-03-20 18:37 ` Daniel Wagner
  2021-05-07 16:19   ` John Kacur
  2021-03-20 18:37 ` [PATCH rt-tests v3 03/33] signaltest: Add missing --output usage info Daniel Wagner
                   ` (31 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:37 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

The header was introduced by 68621f3c3322 ("cyclicdeadline: Add JSON
output feature")for PRIu64 format specifier. As PRIu64 was removed in
commit 51255cc14051 ("cyclicdeadline.c: Fix printf format specifier")
remove the include header again.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/sched_deadline/cyclicdeadline.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
index a02f4e519630..d7aa9bb5d269 100644
--- a/src/sched_deadline/cyclicdeadline.c
+++ b/src/sched_deadline/cyclicdeadline.c
@@ -18,7 +18,6 @@
 #include <errno.h>
 #include <signal.h>
 #include <getopt.h>
-#include <inttypes.h>
 
 #include <sys/syscall.h>
 #include <sys/types.h>
-- 
2.30.2


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

* [PATCH rt-tests v3 03/33] signaltest: Add missing --output usage info
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
  2021-03-20 18:37 ` [PATCH rt-tests v3 01/33] cyclictest: Remove unused include header Daniel Wagner
  2021-03-20 18:37 ` [PATCH rt-tests v3 02/33] cyclicdeadline: " Daniel Wagner
@ 2021-03-20 18:37 ` Daniel Wagner
  2021-05-07 16:26   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 04/33] rt-util: Add rt_init function Daniel Wagner
                   ` (30 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:37 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

bdb20cdaa8d5 ("signaltest: Add JSON output feature") introduced the
new command line option but forgot to add it to the usage string.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/signaltest/signaltest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index b1a7e1db8302..e2ffc0bb8693 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -189,6 +189,7 @@ static void display_help(int error)
 		"-h       --help            display usage information\n"
 		"-l LOOPS --loops=LOOPS     number of loops: default=0(endless)\n"
 		"-m       --mlockall        lock current and future memory allocations\n"
+		"         --output=FILENAME write final results into FILENAME, JSON formatted\n"
 		"-p PRIO  --prio=PRIO       priority of highest prio thread\n"
 		"-q       --quiet           print a summary only on exit\n"
 		"-t NUM   --threads=NUM     number of threads: default=2\n"
-- 
2.30.2


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

* [PATCH rt-tests v3 04/33] rt-util: Add rt_init function
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (2 preceding siblings ...)
  2021-03-20 18:37 ` [PATCH rt-tests v3 03/33] signaltest: Add missing --output usage info Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:27   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 05/33] cyclictest: Initialize rt-util Daniel Wagner
                   ` (29 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

rt_init() should be called as first in the test program.
The main job for this function is to copy the command line
before getopt() runs. By default, getopt_long() permutes
the contents of argv as it scans, so that eventually all the
nonoptions are at the end. This is confusing in the JSON
output, thus copy the command line before we call getopt_long().

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/include/rt-utils.h |  2 ++
 src/lib/rt-utils.c     | 47 +++++++++++++++++++++++++++++++++++-------
 2 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/src/include/rt-utils.h b/src/include/rt-utils.h
index 36af92b170df..1dbd3f1dd8e3 100644
--- a/src/include/rt-utils.h
+++ b/src/include/rt-utils.h
@@ -80,6 +80,8 @@ static inline int64_t calctime(struct timespec t)
 	return time;
 }
 
+void rt_init(int argc, char *argv[]);
+
 void rt_write_json(const char *filename, int argc, char *argv[],
 		   void (*cb)(FILE *, void *),
 		   void *data);
diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
index 00907c573d6a..8f0e0943b137 100644
--- a/src/lib/rt-utils.c
+++ b/src/lib/rt-utils.c
@@ -29,12 +29,15 @@
 #include "rt-error.h"
 
 #define  TRACEBUFSIZ  1024
+#define  MAX_COMMAND_LINE 4096
 
 static char debugfileprefix[MAX_PATH];
 static char *fileprefix;
 static int trace_fd = -1;
 static int tracemark_fd = -1;
 static __thread char tracebuf[TRACEBUFSIZ];
+static char test_cmdline[MAX_COMMAND_LINE];
+static int rt_init_run;
 
 /*
  * Finds the tracing directory in a mounted debugfs
@@ -486,6 +489,34 @@ void disable_trace_mark(void)
 	close_tracemark_fd();
 }
 
+void rt_init(int argc, char *argv[])
+{
+	int offset = 0;
+	int len, i;
+
+	test_cmdline[0] = '\0';
+
+	/*
+	 * getopt_long() permutes the contents of argv as it scans, so
+	 * that eventually all the nonoptions are at the end. Make a
+	 * copy before calling getopt_long().
+	 */
+	for (i = 0; i < argc;) {
+		len = strlen(argv[i]);
+		if (offset + len + 1 >= MAX_COMMAND_LINE)
+			break;
+
+		strcat(test_cmdline, argv[i]);
+		i++;
+		if (i < argc)
+			strcat(test_cmdline, " ");
+
+		offset += len + 1;
+	}
+
+	rt_init_run = 1;
+}
+
 static char *get_cmdline(int argc, char *argv[])
 {
 	char *cmdline;
@@ -519,7 +550,7 @@ void rt_write_json(const char *filename, int argc, char *argv[],
 	struct timeval tv;
 	char tsbuf[64];
 	struct tm *tm;
-	char *cmdline;
+	char *cmdline = NULL;
 	FILE *f, *s;
 	time_t t;
 	size_t n;
@@ -533,10 +564,11 @@ void rt_write_json(const char *filename, int argc, char *argv[],
 			err_exit(errno, "Failed to open '%s'\n", filename);
 	}
 
-	cmdline = get_cmdline(argc, argv);
-	if (!cmdline)
-		err_exit(ENOMEM, "get_cmdline()");
-
+	if (!rt_init_run) {
+		cmdline = get_cmdline(argc, argv);
+		if (!cmdline)
+			err_exit(ENOMEM, "get_cmdline()");
+	}
 
 	gettimeofday(&tv, NULL);
 	t = tv.tv_sec;
@@ -557,7 +589,7 @@ void rt_write_json(const char *filename, int argc, char *argv[],
 
 	fprintf(f, "{\n");
 	fprintf(f, "  \"file_version\": 1,\n");
-	fprintf(f, "  \"cmdline:\": \"%s\",\n", cmdline);
+	fprintf(f, "  \"cmdline:\": \"%s\",\n", rt_init_run? test_cmdline : cmdline);
 	fprintf(f, "  \"rt_test_version:\": \"%1.2f\",\n", VERSION);
 	fprintf(f, "  \"finished\": \"%s\",\n", tsbuf);
 	fprintf(f, "  \"sysinfo\": {\n");
@@ -573,7 +605,8 @@ void rt_write_json(const char *filename, int argc, char *argv[],
 
 	fprintf(f, "}\n");
 
-	free(cmdline);
+	if (!rt_init_run)
+		free(cmdline);
 
 	if (!filename || strcmp("-", filename))
 		fclose(f);
-- 
2.30.2


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

* [PATCH rt-tests v3 05/33] cyclictest: Initialize rt-util
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (3 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 04/33] rt-util: Add rt_init function Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:28   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 06/33] oslat: " Daniel Wagner
                   ` (28 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Allow rt-util make a copy of the command line.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/cyclictest/cyclictest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index c43dd7cbbd64..e817af217952 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1778,6 +1778,7 @@ int main(int argc, char **argv)
 	int i, ret = -1;
 	int status;
 
+	rt_init(argc, argv);
 	process_options(argc, argv, max_cpus);
 
 	if (check_privs())
-- 
2.30.2


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

* [PATCH rt-tests v3 06/33] oslat: Initialize rt-util
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (4 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 05/33] cyclictest: Initialize rt-util Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:29   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 07/33] pmqtest: " Daniel Wagner
                   ` (27 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Allow rt-util make a copy of the command line.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/oslat/oslat.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
index 465a694cdd1d..da7b25d48384 100644
--- a/src/oslat/oslat.c
+++ b/src/oslat/oslat.c
@@ -796,6 +796,8 @@ int main(int argc, char *argv[])
 		exit(1);
 	}
 
+	rt_init(argc, argv);
+
 	g.app_name = argv[0];
 	g.rtprio = 0;
 	g.bucket_size = BUCKET_SIZE;
-- 
2.30.2


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

* [PATCH rt-tests v3 07/33] pmqtest: Initialize rt-util
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (5 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 06/33] oslat: " Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:29   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 08/33] ptsematest: " Daniel Wagner
                   ` (26 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Allow rt-util make a copy of the command line.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/pmqtest/pmqtest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
index e1f59836ea07..aae3c78f8a0a 100644
--- a/src/pmqtest/pmqtest.c
+++ b/src/pmqtest/pmqtest.c
@@ -502,6 +502,7 @@ int main(int argc, char *argv[])
 	mqstat.mq_msgsize = 8;
 	mqstat.mq_flags = 0;
 
+	rt_init(argc, argv);
 	process_options(argc, argv);
 
 	if (check_privs())
-- 
2.30.2


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

* [PATCH rt-tests v3 08/33] ptsematest: Initialize rt-util
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (6 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 07/33] pmqtest: " Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:30   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 09/33] rt-migrate-test: " Daniel Wagner
                   ` (25 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Allow rt-util make a copy of the command line.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/ptsematest/ptsematest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
index 2755bfde5210..eb7ac4ccc823 100644
--- a/src/ptsematest/ptsematest.c
+++ b/src/ptsematest/ptsematest.c
@@ -401,6 +401,7 @@ int main(int argc, char *argv[])
 	sigset_t sigset;
 	struct timespec maindelay;
 
+	rt_init(argc, argv);
 	process_options(argc, argv);
 
 	if (check_privs())
-- 
2.30.2


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

* [PATCH rt-tests v3 09/33] rt-migrate-test: Initialize rt-util
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (7 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 08/33] ptsematest: " Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:31   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 10/33] cyclicdeadline: " Daniel Wagner
                   ` (24 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Allow rt-util make a copy of the command line.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/rt-migrate-test/rt-migrate-test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
index 56b7b66ccdf4..daa876d3e2b2 100644
--- a/src/rt-migrate-test/rt-migrate-test.c
+++ b/src/rt-migrate-test/rt-migrate-test.c
@@ -535,6 +535,7 @@ int main (int argc, char **argv)
 	struct timespec intv;
 	struct sched_param param;
 
+	rt_init(argc, argv);
 	parse_options(argc, argv);
 
 	signal(SIGINT, stop_log);
-- 
2.30.2


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

* [PATCH rt-tests v3 10/33] cyclicdeadline: Initialize rt-util
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (8 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 09/33] rt-migrate-test: " Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:31   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 11/33] signaltest: " Daniel Wagner
                   ` (23 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Allow rt-util make a copy of the command line.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/sched_deadline/cyclicdeadline.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
index d7aa9bb5d269..13a1812c13b3 100644
--- a/src/sched_deadline/cyclicdeadline.c
+++ b/src/sched_deadline/cyclicdeadline.c
@@ -1009,6 +1009,8 @@ int main(int argc, char **argv)
 	int i;
 	int c;
 
+	rt_init(argc, argv);
+
 	cpu_count = sysconf(_SC_NPROCESSORS_CONF);
 	if (cpu_count < 1)
 		err_quit("Can not calculate number of CPUS\n");
-- 
2.30.2


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

* [PATCH rt-tests v3 11/33] signaltest: Initialize rt-util
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (9 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 10/33] cyclicdeadline: " Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:32   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 12/33] sigwaittest: " Daniel Wagner
                   ` (22 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Allow rt-util make a copy of the command line.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/signaltest/signaltest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index e2ffc0bb8693..4da8436e4296 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -414,6 +414,7 @@ int main(int argc, char **argv)
 	int status, cpu;
 	int max_cpus = sysconf(_SC_NPROCESSORS_ONLN);
 
+	rt_init(argc, argv);
 	process_options(argc, argv, max_cpus);
 
 	if (check_privs())
-- 
2.30.2


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

* [PATCH rt-tests v3 12/33] sigwaittest: Initialize rt-util
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (10 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 11/33] signaltest: " Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:33   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 13/33] svematest: " Daniel Wagner
                   ` (21 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Allow rt-util make a copy of the command line.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/sigwaittest/sigwaittest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/sigwaittest/sigwaittest.c b/src/sigwaittest/sigwaittest.c
index 0cdf30a6a769..a1808409730a 100644
--- a/src/sigwaittest/sigwaittest.c
+++ b/src/sigwaittest/sigwaittest.c
@@ -473,6 +473,7 @@ int main(int argc, char *argv[])
 	char f_opt[14];
 	struct timespec launchdelay, maindelay;
 
+	rt_init(argc, argv);
 	process_options(argc, argv);
 
 	if (check_privs())
-- 
2.30.2


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

* [PATCH rt-tests v3 13/33] svematest: Initialize rt-util
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (11 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 12/33] sigwaittest: " Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:34   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 14/33] rt-util: Remove superfluous arguments from rt_write_json Daniel Wagner
                   ` (20 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Allow rt-util make a copy of the command line.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/svsematest/svsematest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/svsematest/svsematest.c b/src/svsematest/svsematest.c
index 23f84bcbd3dc..24e5e7adf494 100644
--- a/src/svsematest/svsematest.c
+++ b/src/svsematest/svsematest.c
@@ -514,6 +514,7 @@ int main(int argc, char *argv[])
 	if (myfile == NULL)
 		myfile = argv[0];
 
+	rt_init(argc, argv);
 	process_options(argc, argv);
 
 	if (check_privs())
-- 
2.30.2


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

* [PATCH rt-tests v3 14/33] rt-util: Remove superfluous arguments from rt_write_json
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (12 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 13/33] svematest: " Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:36   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 15/33] rt-util: Introduce rt_test_start() Daniel Wagner
                   ` (19 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

We copy the command line via the rt_init() API and don't need
the argc, argv arguments for rt_write_json. Remove them.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/cyclictest/cyclictest.c           |  2 +-
 src/include/rt-utils.h                |  2 +-
 src/lib/rt-utils.c                    | 41 ++-------------------------
 src/oslat/oslat.c                     |  3 +-
 src/pmqtest/pmqtest.c                 |  2 +-
 src/ptsematest/ptsematest.c           |  2 +-
 src/rt-migrate-test/rt-migrate-test.c |  2 +-
 src/sched_deadline/cyclicdeadline.c   |  2 +-
 src/signaltest/signaltest.c           |  2 +-
 src/sigwaittest/sigwaittest.c         |  2 +-
 src/svsematest/svsematest.c           |  2 +-
 11 files changed, 12 insertions(+), 50 deletions(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index e817af217952..3f3b91bab53b 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -2134,7 +2134,7 @@ int main(int argc, char **argv)
 		printf("\033[%dB", num_threads + 2);
 
 	if (strlen(outfile) != 0)
-		rt_write_json(outfile, argc, argv, write_stats, NULL);
+		rt_write_json(outfile, write_stats, NULL);
 
 	if (quiet)
 		quiet = 2;
diff --git a/src/include/rt-utils.h b/src/include/rt-utils.h
index 1dbd3f1dd8e3..115791c55185 100644
--- a/src/include/rt-utils.h
+++ b/src/include/rt-utils.h
@@ -82,7 +82,7 @@ static inline int64_t calctime(struct timespec t)
 
 void rt_init(int argc, char *argv[]);
 
-void rt_write_json(const char *filename, int argc, char *argv[],
+void rt_write_json(const char *filename,
 		   void (*cb)(FILE *, void *),
 		   void *data);
 
diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
index 8f0e0943b137..f736a3449bf7 100644
--- a/src/lib/rt-utils.c
+++ b/src/lib/rt-utils.c
@@ -37,7 +37,6 @@ static int trace_fd = -1;
 static int tracemark_fd = -1;
 static __thread char tracebuf[TRACEBUFSIZ];
 static char test_cmdline[MAX_COMMAND_LINE];
-static int rt_init_run;
 
 /*
  * Finds the tracing directory in a mounted debugfs
@@ -513,35 +512,9 @@ void rt_init(int argc, char *argv[])
 
 		offset += len + 1;
 	}
-
-	rt_init_run = 1;
-}
-
-static char *get_cmdline(int argc, char *argv[])
-{
-	char *cmdline;
-	int len, i;
-
-	len = 0;
-	for (i = 0; i < argc; i++)
-		len += strlen(argv[i]) + 1;
-
-	cmdline = malloc(len);
-	if (!cmdline)
-		err_exit(ENOMEM, "Could not copy cmdline");
-
-	memset(cmdline, 0, len);
-	for (i = 0; i < argc;) {
-		cmdline = strcat(cmdline, argv[i]);
-		i++;
-		if (i < argc)
-			cmdline = strcat(cmdline, " ");
-	}
-
-	return cmdline;
 }
 
-void rt_write_json(const char *filename, int argc, char *argv[],
+void rt_write_json(const char *filename,
 		  void (*cb)(FILE *, void *),
 		  void *data)
 {
@@ -550,7 +523,6 @@ void rt_write_json(const char *filename, int argc, char *argv[],
 	struct timeval tv;
 	char tsbuf[64];
 	struct tm *tm;
-	char *cmdline = NULL;
 	FILE *f, *s;
 	time_t t;
 	size_t n;
@@ -564,12 +536,6 @@ void rt_write_json(const char *filename, int argc, char *argv[],
 			err_exit(errno, "Failed to open '%s'\n", filename);
 	}
 
-	if (!rt_init_run) {
-		cmdline = get_cmdline(argc, argv);
-		if (!cmdline)
-			err_exit(ENOMEM, "get_cmdline()");
-	}
-
 	gettimeofday(&tv, NULL);
 	t = tv.tv_sec;
 	tm = localtime(&t);
@@ -589,7 +555,7 @@ void rt_write_json(const char *filename, int argc, char *argv[],
 
 	fprintf(f, "{\n");
 	fprintf(f, "  \"file_version\": 1,\n");
-	fprintf(f, "  \"cmdline:\": \"%s\",\n", rt_init_run? test_cmdline : cmdline);
+	fprintf(f, "  \"cmdline:\": \"%s\",\n", test_cmdline);
 	fprintf(f, "  \"rt_test_version:\": \"%1.2f\",\n", VERSION);
 	fprintf(f, "  \"finished\": \"%s\",\n", tsbuf);
 	fprintf(f, "  \"sysinfo\": {\n");
@@ -605,9 +571,6 @@ void rt_write_json(const char *filename, int argc, char *argv[],
 
 	fprintf(f, "}\n");
 
-	if (!rt_init_run)
-		free(cmdline);
-
 	if (!filename || strcmp("-", filename))
 		fclose(f);
 }
diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
index da7b25d48384..ac54d05697ef 100644
--- a/src/oslat/oslat.c
+++ b/src/oslat/oslat.c
@@ -862,8 +862,7 @@ int main(int argc, char *argv[])
 	write_summary(threads);
 
 	if (strlen(g.outfile) != 0)
-		rt_write_json(g.outfile, argc, argv,
-			write_summary_json, threads);
+		rt_write_json(g.outfile, write_summary_json, threads);
 
 	if (g.cpu_list) {
 		free(g.cpu_list);
diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
index aae3c78f8a0a..f96b3d0bf400 100644
--- a/src/pmqtest/pmqtest.c
+++ b/src/pmqtest/pmqtest.c
@@ -651,7 +651,7 @@ int main(int argc, char *argv[])
 			.receiver = receiver,
 			.sender = sender,
 		};
-		rt_write_json(outfile, argc, argv, write_stats, &ps);
+		rt_write_json(outfile, write_stats, &ps);
 	}
 
 nomem:
diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
index eb7ac4ccc823..a32bfc1698f0 100644
--- a/src/ptsematest/ptsematest.c
+++ b/src/ptsematest/ptsematest.c
@@ -519,7 +519,7 @@ int main(int argc, char *argv[])
 			.receiver = receiver,
 			.sender = sender,
 		};
-		rt_write_json(outfile, argc, argv, write_stats, &ps);
+		rt_write_json(outfile, write_stats, &ps);
 	}
 
 nomem:
diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
index daa876d3e2b2..cdfbfafb200b 100644
--- a/src/rt-migrate-test/rt-migrate-test.c
+++ b/src/rt-migrate-test/rt-migrate-test.c
@@ -663,7 +663,7 @@ int main (int argc, char **argv)
 	print_results();
 
 	if (strlen(outfile) != 0)
-		rt_write_json(outfile, argc, argv, write_stats, NULL);
+		rt_write_json(outfile, write_stats, NULL);
 
 	if (stop) {
 		/*
diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
index 13a1812c13b3..e6811838b62d 100644
--- a/src/sched_deadline/cyclicdeadline.c
+++ b/src/sched_deadline/cyclicdeadline.c
@@ -1227,7 +1227,7 @@ int main(int argc, char **argv)
 	}
 
 	if (strlen(outfile) != 0)
-		rt_write_json(outfile, argc, argv, write_stats, sched_data);
+		rt_write_json(outfile, write_stats, sched_data);
 
 	if (setcpu_buf)
 		free(setcpu_buf);
diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index 4da8436e4296..6abf38b7821c 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -558,7 +558,7 @@ int main(int argc, char **argv)
 			free(stat[i].values);
 	}
 	if (strlen(outfile) != 0)
-		rt_write_json(outfile, argc, argv, write_stats, par);
+		rt_write_json(outfile, write_stats, par);
 
 	free(stat);
  outpar:
diff --git a/src/sigwaittest/sigwaittest.c b/src/sigwaittest/sigwaittest.c
index a1808409730a..142419f9e315 100644
--- a/src/sigwaittest/sigwaittest.c
+++ b/src/sigwaittest/sigwaittest.c
@@ -706,7 +706,7 @@ int main(int argc, char *argv[])
 			.receiver = receiver,
 			.sender = sender,
 		};
-		rt_write_json(outfile, argc, argv, write_stats, &ps);
+		rt_write_json(outfile, write_stats, &ps);
 	}
 
 nomem:
diff --git a/src/svsematest/svsematest.c b/src/svsematest/svsematest.c
index 24e5e7adf494..7c9d21edbab2 100644
--- a/src/svsematest/svsematest.c
+++ b/src/svsematest/svsematest.c
@@ -778,7 +778,7 @@ int main(int argc, char *argv[])
 			.receiver = receiver,
 			.sender = sender,
 		};
-		rt_write_json(outfile, argc, argv, write_stats, &ps);
+		rt_write_json(outfile, write_stats, &ps);
 	}
 
 nosem:
-- 
2.30.2


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

* [PATCH rt-tests v3 15/33] rt-util: Introduce rt_test_start()
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (13 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 14/33] rt-util: Remove superfluous arguments from rt_write_json Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:40   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 16/33] cyclictest: Record start of test execution Daniel Wagner
                   ` (18 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

For the JSON output records a timestamp when the test ended.
Let's introduce a new API to record a timestamp when the test
starts. We could put this into rt_init() but in this case we
would meassure also the time test needs to setup or warm up.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/include/rt-utils.h |  2 ++
 src/lib/rt-utils.c     | 34 ++++++++++++++++++++++++----------
 2 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/src/include/rt-utils.h b/src/include/rt-utils.h
index 115791c55185..42c2772262db 100644
--- a/src/include/rt-utils.h
+++ b/src/include/rt-utils.h
@@ -82,6 +82,8 @@ static inline int64_t calctime(struct timespec t)
 
 void rt_init(int argc, char *argv[]);
 
+void rt_test_start(void);
+
 void rt_write_json(const char *filename,
 		   void (*cb)(FILE *, void *),
 		   void *data);
diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
index f736a3449bf7..efb5d1d9e866 100644
--- a/src/lib/rt-utils.c
+++ b/src/lib/rt-utils.c
@@ -30,6 +30,7 @@
 
 #define  TRACEBUFSIZ  1024
 #define  MAX_COMMAND_LINE 4096
+#define  MAX_TS_SIZE 64
 
 static char debugfileprefix[MAX_PATH];
 static char *fileprefix;
@@ -37,6 +38,7 @@ static int trace_fd = -1;
 static int tracemark_fd = -1;
 static __thread char tracebuf[TRACEBUFSIZ];
 static char test_cmdline[MAX_COMMAND_LINE];
+static char ts_start[MAX_TS_SIZE];
 
 /*
  * Finds the tracing directory in a mounted debugfs
@@ -514,17 +516,32 @@ void rt_init(int argc, char *argv[])
 	}
 }
 
+static void get_timestamp(char *tsbuf)
+{
+	struct timeval tv;
+	struct tm *tm;
+	time_t t;
+
+	gettimeofday(&tv, NULL);
+	t = tv.tv_sec;
+	tm = localtime(&t);
+	/* RFC 2822-compliant date format */
+	strftime(tsbuf, MAX_TS_SIZE, "%a, %d %b %Y %T %z", tm);
+}
+
+void rt_test_start(void)
+{
+	get_timestamp(ts_start);
+}
+
 void rt_write_json(const char *filename,
 		  void (*cb)(FILE *, void *),
 		  void *data)
 {
 	unsigned char buf[1];
 	struct utsname uts;
-	struct timeval tv;
-	char tsbuf[64];
-	struct tm *tm;
+	char ts_end[MAX_TS_SIZE];
 	FILE *f, *s;
-	time_t t;
 	size_t n;
 	int rt = 0;
 
@@ -536,11 +553,7 @@ void rt_write_json(const char *filename,
 			err_exit(errno, "Failed to open '%s'\n", filename);
 	}
 
-	gettimeofday(&tv, NULL);
-	t = tv.tv_sec;
-	tm = localtime(&t);
-	/* RFC 2822-compliant date format */
-	strftime(tsbuf, sizeof(tsbuf), "%a, %d %b %Y %T %z", tm);
+	get_timestamp(ts_end);
 
 	s = fopen("/sys/kernel/realtime", "r");
 	if (s) {
@@ -557,7 +570,8 @@ void rt_write_json(const char *filename,
 	fprintf(f, "  \"file_version\": 1,\n");
 	fprintf(f, "  \"cmdline:\": \"%s\",\n", test_cmdline);
 	fprintf(f, "  \"rt_test_version:\": \"%1.2f\",\n", VERSION);
-	fprintf(f, "  \"finished\": \"%s\",\n", tsbuf);
+	fprintf(f, "  \"start_time\": \"%s\",\n", ts_start);
+	fprintf(f, "  \"end_time\": \"%s\",\n", ts_end);
 	fprintf(f, "  \"sysinfo\": {\n");
 	fprintf(f, "    \"sysname\": \"%s\",\n", uts.sysname);
 	fprintf(f, "    \"nodename\": \"%s\",\n", uts.nodename);
-- 
2.30.2


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

* [PATCH rt-tests v3 16/33] cyclictest: Record start of test execution
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (14 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 15/33] rt-util: Introduce rt_test_start() Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:41   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 17/33] oslat: " Daniel Wagner
                   ` (17 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Use rt_test_start() to record a timestamp when the test starts.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/cyclictest/cyclictest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 3f3b91bab53b..033b95a3a19a 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -615,6 +615,7 @@ static void *timerthread(void *param)
 		setitimer(ITIMER_REAL, &itimer, NULL);
 	}
 
+	rt_test_start();
 	stat->threadstarted++;
 
 	while (!shutdown) {
-- 
2.30.2


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

* [PATCH rt-tests v3 17/33] oslat: Record start of test execution
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (15 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 16/33] cyclictest: Record start of test execution Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:41   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 18/33] pmqtest: " Daniel Wagner
                   ` (16 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Use rt_test_start() to record a timestamp when the test starts.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/oslat/oslat.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
index ac54d05697ef..2f02f5399405 100644
--- a/src/oslat/oslat.c
+++ b/src/oslat/oslat.c
@@ -854,6 +854,7 @@ int main(int argc, char *argv[])
 		printf("Test starts...\n");
 	/* Reset n_threads to always run on all the cores */
 	g.n_threads = g.n_threads_total;
+	rt_test_start();
 	run_expt(threads, g.runtime);
 
 	if (!g.quiet)
-- 
2.30.2


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

* [PATCH rt-tests v3 18/33] pmqtest: Record start of test execution
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (16 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 17/33] oslat: " Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:43   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 19/33] ptesematest: " Daniel Wagner
                   ` (15 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Use rt_test_start() to record a timestamp when the test starts.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/pmqtest/pmqtest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
index f96b3d0bf400..adf72c10ce83 100644
--- a/src/pmqtest/pmqtest.c
+++ b/src/pmqtest/pmqtest.c
@@ -583,6 +583,7 @@ int main(int argc, char *argv[])
 	sigemptyset(&sigset);
 	pthread_sigmask(SIG_SETMASK, &sigset, NULL);
 
+	rt_test_start();
 	do {
 		int newsamples = 0, newtimeoutcount = 0;
 		int minsamples = INT_MAX;
-- 
2.30.2


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

* [PATCH rt-tests v3 19/33] ptesematest: Record start of test execution
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (17 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 18/33] pmqtest: " Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:43   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 20/33] rt-migrate-test: " Daniel Wagner
                   ` (14 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Use rt_test_start() to record a timestamp when the test starts.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/ptsematest/ptsematest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
index a32bfc1698f0..471f1b307c14 100644
--- a/src/ptsematest/ptsematest.c
+++ b/src/ptsematest/ptsematest.c
@@ -468,6 +468,7 @@ int main(int argc, char *argv[])
 	maindelay.tv_sec = 0;
 	maindelay.tv_nsec = 50000000; /* 50 ms */
 
+	rt_test_start();
 	while (!shutdown) {
 		for (i = 0; i < num_threads; i++)
 			shutdown |= receiver[i].shutdown | sender[i].shutdown;
-- 
2.30.2


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

* [PATCH rt-tests v3 20/33] rt-migrate-test: Record start of test execution
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (18 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 19/33] ptesematest: " Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:44   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 21/33] cyclicdeadline: " Daniel Wagner
                   ` (13 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Use rt_test_start() to record a timestamp when the test starts.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/rt-migrate-test/rt-migrate-test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
index cdfbfafb200b..8f628d347a23 100644
--- a/src/rt-migrate-test/rt-migrate-test.c
+++ b/src/rt-migrate-test/rt-migrate-test.c
@@ -621,6 +621,7 @@ int main (int argc, char **argv)
 
 	setup_ftrace_marker();
 
+	rt_test_start();
 	for (loop=0; loop < nr_runs; loop++) {
 		unsigned long long end;
 
-- 
2.30.2


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

* [PATCH rt-tests v3 21/33] cyclicdeadline: Record start of test execution
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (19 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 20/33] rt-migrate-test: " Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:45   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 22/33] signaltest: " Daniel Wagner
                   ` (12 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Use rt_test_start() to record a timestamp when the test starts.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/sched_deadline/cyclicdeadline.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
index e6811838b62d..a649e5a0fe5e 100644
--- a/src/sched_deadline/cyclicdeadline.c
+++ b/src/sched_deadline/cyclicdeadline.c
@@ -1213,6 +1213,7 @@ int main(int argc, char **argv)
 	if (duration)
 		alarm(duration);
 
+	rt_test_start();
 	loop(sched_data, nr_threads);
 
 	for (i = 0; i < nr_threads; i++) {
-- 
2.30.2


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

* [PATCH rt-tests v3 22/33] signaltest: Record start of test execution
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (20 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 21/33] cyclicdeadline: " Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:45   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 23/33] sigwaittest: " Daniel Wagner
                   ` (11 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Use rt_test_start() to record a timestamp when the test starts.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/signaltest/signaltest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index 6abf38b7821c..7327d0d0144d 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -500,6 +500,7 @@ int main(int argc, char **argv)
 			      strerror(status));
 	}
 
+	rt_test_start();
 	while (!shutdown) {
 		int allstarted = 1;
 
-- 
2.30.2


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

* [PATCH rt-tests v3 23/33] sigwaittest: Record start of test execution
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (21 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 22/33] signaltest: " Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:46   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 24/33] svsematest: " Daniel Wagner
                   ` (10 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Use rt_test_start() to record a timestamp when the test starts.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/sigwaittest/sigwaittest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/sigwaittest/sigwaittest.c b/src/sigwaittest/sigwaittest.c
index 142419f9e315..6e8bc7b50d5f 100644
--- a/src/sigwaittest/sigwaittest.c
+++ b/src/sigwaittest/sigwaittest.c
@@ -652,6 +652,7 @@ int main(int argc, char *argv[])
 			    &sender[i]);
 	}
 
+	rt_test_start();
 	while (!mustshutdown) {
 		for (i = 0; i < num_threads; i++)
 			mustshutdown |= receiver[i].shutdown |
-- 
2.30.2


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

* [PATCH rt-tests v3 24/33] svsematest: Record start of test execution
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (22 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 23/33] sigwaittest: " Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:46   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 25/33] rt-util: Add return_code to common section of JSON output Daniel Wagner
                   ` (9 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Use rt_test_start() to record a timestamp when the test starts.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/svsematest/svsematest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/svsematest/svsematest.c b/src/svsematest/svsematest.c
index 7c9d21edbab2..7533b1b569cc 100644
--- a/src/svsematest/svsematest.c
+++ b/src/svsematest/svsematest.c
@@ -724,6 +724,7 @@ int main(int argc, char *argv[])
 			    &sender[i]);
 	}
 
+	rt_test_start();
 	while (!mustshutdown) {
 		for (i = 0; i < num_threads; i++)
 			mustshutdown |= receiver[i].shutdown |
-- 
2.30.2


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

* [PATCH rt-tests v3 25/33] rt-util: Add return_code to common section of JSON output
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (23 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 24/33] svsematest: " Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:49   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 26/33] pip_stress: Move test result output to main Daniel Wagner
                   ` (8 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Many rt-tests return an error code if the test fails. Let's add
this information to the common section.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/cyclictest/cyclictest.c           |  2 +-
 src/include/rt-utils.h                |  2 +-
 src/lib/rt-utils.c                    | 11 ++++++++---
 src/oslat/oslat.c                     |  2 +-
 src/pmqtest/pmqtest.c                 |  2 +-
 src/ptsematest/ptsematest.c           |  2 +-
 src/rt-migrate-test/rt-migrate-test.c |  2 +-
 src/sched_deadline/cyclicdeadline.c   |  2 +-
 src/signaltest/signaltest.c           |  2 +-
 src/sigwaittest/sigwaittest.c         |  2 +-
 src/svsematest/svsematest.c           |  2 +-
 11 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 033b95a3a19a..59dda1973b1a 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -2135,7 +2135,7 @@ int main(int argc, char **argv)
 		printf("\033[%dB", num_threads + 2);
 
 	if (strlen(outfile) != 0)
-		rt_write_json(outfile, write_stats, NULL);
+		rt_write_json(outfile, ret, write_stats, NULL);
 
 	if (quiet)
 		quiet = 2;
diff --git a/src/include/rt-utils.h b/src/include/rt-utils.h
index 42c2772262db..f07b57d5f7c1 100644
--- a/src/include/rt-utils.h
+++ b/src/include/rt-utils.h
@@ -84,7 +84,7 @@ void rt_init(int argc, char *argv[]);
 
 void rt_test_start(void);
 
-void rt_write_json(const char *filename,
+void rt_write_json(const char *filename, int return_code,
 		   void (*cb)(FILE *, void *),
 		   void *data);
 
diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
index efb5d1d9e866..d264c348ad42 100644
--- a/src/lib/rt-utils.c
+++ b/src/lib/rt-utils.c
@@ -534,7 +534,7 @@ void rt_test_start(void)
 	get_timestamp(ts_start);
 }
 
-void rt_write_json(const char *filename,
+void rt_write_json(const char *filename, int return_code,
 		  void (*cb)(FILE *, void *),
 		  void *data)
 {
@@ -572,6 +572,7 @@ void rt_write_json(const char *filename,
 	fprintf(f, "  \"rt_test_version:\": \"%1.2f\",\n", VERSION);
 	fprintf(f, "  \"start_time\": \"%s\",\n", ts_start);
 	fprintf(f, "  \"end_time\": \"%s\",\n", ts_end);
+	fprintf(f, "  \"return_code\": %d,\n", return_code);
 	fprintf(f, "  \"sysinfo\": {\n");
 	fprintf(f, "    \"sysname\": \"%s\",\n", uts.sysname);
 	fprintf(f, "    \"nodename\": \"%s\",\n", uts.nodename);
@@ -579,9 +580,13 @@ void rt_write_json(const char *filename,
 	fprintf(f, "    \"version\": \"%s\",\n", uts.version);
 	fprintf(f, "    \"machine\": \"%s\",\n", uts.machine);
 	fprintf(f, "    \"realtime\": %d\n", rt);
-	fprintf(f, "  },\n");
 
-	(cb)(f, data);
+	if (cb) {
+		fprintf(f, "  },\n");
+		(cb)(f, data);
+	} else {
+		fprintf(f, "  }\n");
+	}
 
 	fprintf(f, "}\n");
 
diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
index 2f02f5399405..37d528f0f7ff 100644
--- a/src/oslat/oslat.c
+++ b/src/oslat/oslat.c
@@ -863,7 +863,7 @@ int main(int argc, char *argv[])
 	write_summary(threads);
 
 	if (strlen(g.outfile) != 0)
-		rt_write_json(g.outfile, write_summary_json, threads);
+		rt_write_json(g.outfile, 0, write_summary_json, threads);
 
 	if (g.cpu_list) {
 		free(g.cpu_list);
diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
index adf72c10ce83..af10b416600c 100644
--- a/src/pmqtest/pmqtest.c
+++ b/src/pmqtest/pmqtest.c
@@ -652,7 +652,7 @@ int main(int argc, char *argv[])
 			.receiver = receiver,
 			.sender = sender,
 		};
-		rt_write_json(outfile, write_stats, &ps);
+		rt_write_json(outfile, 0, write_stats, &ps);
 	}
 
 nomem:
diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
index 471f1b307c14..70eb79e89635 100644
--- a/src/ptsematest/ptsematest.c
+++ b/src/ptsematest/ptsematest.c
@@ -520,7 +520,7 @@ int main(int argc, char *argv[])
 			.receiver = receiver,
 			.sender = sender,
 		};
-		rt_write_json(outfile, write_stats, &ps);
+		rt_write_json(outfile, 0, write_stats, &ps);
 	}
 
 nomem:
diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
index 8f628d347a23..1e0abdd6c0fa 100644
--- a/src/rt-migrate-test/rt-migrate-test.c
+++ b/src/rt-migrate-test/rt-migrate-test.c
@@ -664,7 +664,7 @@ int main (int argc, char **argv)
 	print_results();
 
 	if (strlen(outfile) != 0)
-		rt_write_json(outfile, write_stats, NULL);
+		rt_write_json(outfile, check < 0, write_stats, NULL);
 
 	if (stop) {
 		/*
diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
index a649e5a0fe5e..8d801b4c154a 100644
--- a/src/sched_deadline/cyclicdeadline.c
+++ b/src/sched_deadline/cyclicdeadline.c
@@ -1228,7 +1228,7 @@ int main(int argc, char **argv)
 	}
 
 	if (strlen(outfile) != 0)
-		rt_write_json(outfile, write_stats, sched_data);
+		rt_write_json(outfile, 0, write_stats, sched_data);
 
 	if (setcpu_buf)
 		free(setcpu_buf);
diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index 7327d0d0144d..f43920e1a853 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -559,7 +559,7 @@ int main(int argc, char **argv)
 			free(stat[i].values);
 	}
 	if (strlen(outfile) != 0)
-		rt_write_json(outfile, write_stats, par);
+		rt_write_json(outfile, ret, write_stats, par);
 
 	free(stat);
  outpar:
diff --git a/src/sigwaittest/sigwaittest.c b/src/sigwaittest/sigwaittest.c
index 6e8bc7b50d5f..fda44724dd62 100644
--- a/src/sigwaittest/sigwaittest.c
+++ b/src/sigwaittest/sigwaittest.c
@@ -707,7 +707,7 @@ int main(int argc, char *argv[])
 			.receiver = receiver,
 			.sender = sender,
 		};
-		rt_write_json(outfile, write_stats, &ps);
+		rt_write_json(outfile, 0, write_stats, &ps);
 	}
 
 nomem:
diff --git a/src/svsematest/svsematest.c b/src/svsematest/svsematest.c
index 7533b1b569cc..9485ab6d95c8 100644
--- a/src/svsematest/svsematest.c
+++ b/src/svsematest/svsematest.c
@@ -779,7 +779,7 @@ int main(int argc, char *argv[])
 			.receiver = receiver,
 			.sender = sender,
 		};
-		rt_write_json(outfile, write_stats, &ps);
+		rt_write_json(outfile, 0, write_stats, &ps);
 	}
 
 nosem:
-- 
2.30.2


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

* [PATCH rt-tests v3 26/33] pip_stress: Move test result output to main
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (24 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 25/33] rt-util: Add return_code to common section of JSON output Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:55   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 27/33] pip_stress: Return failure code if test fails Daniel Wagner
                   ` (7 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Instead printing the result high() close directly move it to main()
function to simplify the return code if the test fails.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/pi_tests/pip_stress.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/pi_tests/pip_stress.c b/src/pi_tests/pip_stress.c
index 8b91578f9ab8..2c3288984202 100644
--- a/src/pi_tests/pip_stress.c
+++ b/src/pi_tests/pip_stress.c
@@ -146,6 +146,7 @@ int main(int argc, char *argv[])
 		exit(1);
 	} else if (pid1 != 0) {		/* parent code */
 		low(pid1);
+		exit(0);
 	} else {			/* child code */
 		pid2 = fork();		/* parent code */
 		if (pid2 == -1) {
@@ -155,9 +156,15 @@ int main(int argc, char *argv[])
 			high(pid2);
 		} else {			/* child code */
 			medium();
+			exit(0);
 		}
 	}
 
+	if (statep->inversion)
+		printf("Successfully used priority inheritance to handle an inversion\n");
+	else
+		printf("No inversion incurred\n");
+
 	exit(0);
 }
 
@@ -222,14 +229,6 @@ void high(pid_t pid)
 	Pthread_mutex_unlock(resource);
 	kill(pid, SIGKILL);	/* kill the medium thread */
 	waitpid(pid, &status, 0);
-
-	Pthread_mutex_lock(statep->mutex);
-
-	if (statep->inversion)
-		printf("Successfully used priority inheritance to handle an inversion\n");
-	else
-		printf("No inversion incurred\n");
-	Pthread_mutex_unlock(statep->mutex);
 }
 
 /* mmap a page of anonymous shared memory */
-- 
2.30.2


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

* [PATCH rt-tests v3 27/33] pip_stress: Return failure code if test fails
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (25 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 26/33] pip_stress: Move test result output to main Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:54   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 28/33] pip_stress: Prepare arg parser to accept only long options Daniel Wagner
                   ` (6 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Let the test return a failure code when the test fails.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/pi_tests/pip_stress.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/pi_tests/pip_stress.c b/src/pi_tests/pip_stress.c
index 2c3288984202..ed034799da66 100644
--- a/src/pi_tests/pip_stress.c
+++ b/src/pi_tests/pip_stress.c
@@ -160,11 +160,11 @@ int main(int argc, char *argv[])
 		}
 	}
 
-	if (statep->inversion)
-		printf("Successfully used priority inheritance to handle an inversion\n");
-	else
+	if (!statep->inversion) {
 		printf("No inversion incurred\n");
-
+		exit(1);
+	}
+	printf("Successfully used priority inheritance to handle an inversion\n");
 	exit(0);
 }
 
-- 
2.30.2


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

* [PATCH rt-tests v3 28/33] pip_stress: Prepare arg parser to accept only long options
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (26 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 27/33] pip_stress: Return failure code if test fails Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:55   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 29/33] pip_stress: Add JSON output feature Daniel Wagner
                   ` (5 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Introduce the option value enums to be able to parse only long
options.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/pi_tests/pip_stress.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/pi_tests/pip_stress.c b/src/pi_tests/pip_stress.c
index ed034799da66..0831f698ff1d 100644
--- a/src/pi_tests/pip_stress.c
+++ b/src/pi_tests/pip_stress.c
@@ -77,6 +77,10 @@ static void usage(int error)
 	exit(error);
 }
 
+enum option_values {
+	OPT_HELP=1
+};
+
 int main(int argc, char *argv[])
 {
 	void *mptr;	/* memory pointer */
@@ -87,14 +91,15 @@ int main(int argc, char *argv[])
 
 	for (;;) {
 		struct option long_options[] = {
-			{ "help",	no_argument,		NULL,	'h' },
-			{ NULL,		0,			NULL,	0 },
+			{"help",	no_argument,		NULL, OPT_HELP},
+			{NULL,		0,			NULL, 0}
 		};
 
-		int c = getopt_long(argc, argv, "s:h", long_options, NULL);
+		int c = getopt_long(argc, argv, "h", long_options, NULL);
 		if (c == -1)
 			break;
 		switch (c) {
+		case OPT_HELP:
 		case 'h':
 			usage(0);
 			break;
-- 
2.30.2


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

* [PATCH rt-tests v3 29/33] pip_stress: Add JSON output feature
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (27 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 28/33] pip_stress: Prepare arg parser to accept only long options Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:58   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 30/33] pi_stress: Prepare command line parser for long options only Daniel Wagner
                   ` (4 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Write the test results as JSON output to a file. This allows to
simplifies any parsing later on.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/pi_tests/pip_stress.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/pi_tests/pip_stress.c b/src/pi_tests/pip_stress.c
index 0831f698ff1d..f6096a2de273 100644
--- a/src/pi_tests/pip_stress.c
+++ b/src/pi_tests/pip_stress.c
@@ -67,18 +67,21 @@ struct State *statep;
 const int policy = SCHED_FIFO;
 static int prio_min;	/* Initialized for the minimum priority of policy */
 
+static char outfile[MAX_PATH];
+
 static void usage(int error)
 {
 	printf("pip_stress V %1.2f\n", VERSION);
 	printf("Usage:\n"
 	       "pip_stress <options>\n"\
-	       "-h	--help                  Show this help menu.\n"
+	       "-h	 --help            Show this help menu.\n"
+	       "         --output=FILENAME write final results into FILENAME, JSON formatted\n"
 	       );
 	exit(error);
 }
 
 enum option_values {
-	OPT_HELP=1
+	OPT_HELP=1, OPT_OUTPUT,
 };
 
 int main(int argc, char *argv[])
@@ -89,9 +92,11 @@ int main(int argc, char *argv[])
 	int res;
 	int *minimum_priority = (int*)&prio_min;
 
+	rt_init(argc, argv);
 	for (;;) {
 		struct option long_options[] = {
 			{"help",	no_argument,		NULL, OPT_HELP},
+			{"output",	required_argument,	NULL, OPT_OUTPUT },
 			{NULL,		0,			NULL, 0}
 		};
 
@@ -103,6 +108,9 @@ int main(int argc, char *argv[])
 		case 'h':
 			usage(0);
 			break;
+		case OPT_OUTPUT:
+			strncpy(outfile, optarg, strnlen(optarg, MAX_PATH-1));
+			break;
 		default:
 			usage(1);
 			break;
@@ -145,6 +153,7 @@ int main(int argc, char *argv[])
 		err_exit(err, NULL);
 	}
 
+	rt_test_start();
 	pid1 = fork();
 	if (pid1 == -1) {
 		perror("fork");
@@ -165,6 +174,9 @@ int main(int argc, char *argv[])
 		}
 	}
 
+	if (strlen(outfile) != 0)
+		rt_write_json(outfile, !statep->inversion, NULL, NULL);
+
 	if (!statep->inversion) {
 		printf("No inversion incurred\n");
 		exit(1);
-- 
2.30.2


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

* [PATCH rt-tests v3 30/33] pi_stress: Prepare command line parser for long options only
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (28 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 29/33] pip_stress: Add JSON output feature Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:58   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 31/33] pi_stress: Add JSON output feature Daniel Wagner
                   ` (3 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Introduce option value enums in order to be able to parse long options
only.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/pi_tests/pi_stress.c | 45 ++++++++++++++++++++++++++++------------
 1 file changed, 32 insertions(+), 13 deletions(-)

diff --git a/src/pi_tests/pi_stress.c b/src/pi_tests/pi_stress.c
index 49f89b7b0136..73f0e6a402e3 100644
--- a/src/pi_tests/pi_stress.c
+++ b/src/pi_tests/pi_stress.c
@@ -1274,23 +1274,29 @@ int process_sched_line(const char *arg)
 	return retval;
 }
 
+enum option_values {
+	OPT_DEBUG=1, OPT_DURATION, OPT_GROUPS, OPT_HELP, OPT_INVERSIONS,
+	OPT_MLOCKALL, OPT_PROMPT, OPT_QUIET, OPT_RR, OPT_SCHED,
+	OPT_UNIPROCESSOR, OPT_VERBOSE, OPT_VERSION,
+};
+
 void process_command_line(int argc, char **argv)
 {
 	for (;;) {
 		struct option options[] = {
-			{"debug",		no_argument,		NULL, 'd'},
-			{"duration",		required_argument,	NULL, 'D'},
-			{"groups",		required_argument,	NULL, 'g'},
-			{"help",		no_argument,		NULL, 'h'},
-			{"inversions",		required_argument,	NULL, 'i'},
-			{"mlockall",		no_argument,		NULL, 'm'},
-			{"prompt",		no_argument,		NULL, 'p'},
-			{"quiet",		no_argument,		NULL, 'q'},
-			{"rr",			no_argument,		NULL, 'r'},
-			{"sched",		required_argument,	NULL, 's'},
-			{"uniprocessor",	no_argument,		NULL, 'u'},
-			{"verbose",		no_argument,		NULL, 'v'},
-			{"version",		no_argument,		NULL, 'V'},
+			{"debug",		no_argument,		NULL, OPT_DEBUG},
+			{"duration",		required_argument,	NULL, OPT_DURATION},
+			{"groups",		required_argument,	NULL, OPT_GROUPS},
+			{"help",		no_argument,		NULL, OPT_HELP},
+			{"inversions",		required_argument,	NULL, OPT_INVERSIONS},
+			{"mlockall",		no_argument,		NULL, OPT_MLOCKALL},
+			{"prompt",		no_argument,		NULL, OPT_PROMPT},
+			{"quiet",		no_argument,		NULL, OPT_QUIET},
+			{"rr",			no_argument,		NULL, OPT_RR},
+			{"sched",		required_argument,	NULL, OPT_SCHED},
+			{"uniprocessor",	no_argument,		NULL, OPT_UNIPROCESSOR},
+			{"verbose",		no_argument,		NULL, OPT_VERBOSE},
+			{"version",		no_argument,		NULL, OPT_VERSION},
 			{NULL, 0, NULL, 0},
 		};
 
@@ -1298,12 +1304,15 @@ void process_command_line(int argc, char **argv)
 		if (c == -1)
 			break;
 		switch (c) {
+		case OPT_DEBUG:
 		case 'd':
 			debugging = 1;
 			break;
+		case OPT_DURATION:
 		case 'D':
 			duration = parse_time_string(optarg);
 			break;
+		case OPT_GROUPS:
 		case 'g':
 			ngroups = strtol(optarg, NULL, 10);
 			if (ngroups > num_processors) {
@@ -1314,37 +1323,47 @@ void process_command_line(int argc, char **argv)
 			}
 			pi_info("number of groups set to %d\n", ngroups);
 			break;
+		case OPT_HELP:
 		case 'h':
 			usage(0);
 			break;
+		case OPT_INVERSIONS:
 		case 'i':
 			inversions = strtol(optarg, NULL, 10);
 			pi_info("doing %d inversion per group\n", inversions);
 			break;
+		case OPT_MLOCKALL:
 		case 'm':
 			lockall = 1;
 			break;
+		case OPT_PROMPT:
 		case 'p':
 			prompt = 1;
 			break;
+		case OPT_QUIET:
 		case 'q':
 			verbose = 0;
 			quiet = 1;
 			break;
+		case OPT_RR:
 		case 'r':
 			policy = SCHED_RR;
 			break;
+		case OPT_SCHED:
 		case 's':
 			if (process_sched_line(optarg))
 				pi_error("ignoring invalid options '%s'\n", optarg);
 			break;
+		case OPT_UNIPROCESSOR:
 		case 'u':
 			uniprocessor = 1;
 			break;
+		case OPT_VERBOSE:
 		case 'v':
 			verbose = 1;
 			quiet = 0;
 			break;
+		case OPT_VERSION:
 		case 'V':
 			printf("pi_stress v%1.2f ", VERSION);
 			exit(0);
-- 
2.30.2


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

* [PATCH rt-tests v3 31/33] pi_stress: Add JSON output feature
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (29 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 30/33] pi_stress: Prepare command line parser for long options only Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 16:59   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 32/33] ssdd: Add quiet command line option Daniel Wagner
                   ` (2 subsequent siblings)
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Write the test results as JSON output to a file. This allows to
simplifies any parsing later on.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/pi_tests/pi_stress.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/pi_tests/pi_stress.c b/src/pi_tests/pi_stress.c
index 73f0e6a402e3..3f93d4aadd53 100644
--- a/src/pi_tests/pi_stress.c
+++ b/src/pi_tests/pi_stress.c
@@ -99,6 +99,9 @@ int debugging = 0;
 
 int quiet = 0;	/* turn off all prints, default = 0 (off) */
 
+/* filename for JSON output */
+char outfile[MAX_PATH];
+
 /* prompt to start test */
 int prompt = 0;
 
@@ -209,6 +212,7 @@ int create_group(struct group_parameters *group);
 unsigned long total_inversions(void);
 void banner(void);
 void summary(void);
+void write_stats(FILE *f, void *data);
 void wait_for_termination(void);
 int barrier_init(pthread_barrier_t *b, const pthread_barrierattr_t *attr,
 		 unsigned int count, const char *name);
@@ -235,6 +239,7 @@ int main(int argc, char **argv)
 
 
 	/* process command line arguments */
+	rt_init(argc, argv);
 	process_command_line(argc, argv);
 
 	/* set default sched attributes */
@@ -299,6 +304,7 @@ int main(int argc, char **argv)
 	}
 	/* report */
 	banner();
+	rt_test_start();
 	start = time(NULL);
 
 	/* turn loose the threads */
@@ -335,6 +341,10 @@ int main(int argc, char **argv)
 		kill(0, SIGTERM);
 	finish = time(NULL);
 	summary();
+
+	if (strlen(outfile) != 0)
+		rt_write_json(outfile, retval, write_stats, NULL);
+
 	if (lockall)
 		munlockall();
 	exit(retval);
@@ -983,6 +993,7 @@ void usage(int error)
 	       "-h       --help            print this message\n"
 	       "-i INV   --inversions=INV  number of inversions per group (default is infinite)\n"
 	       "-m       --mlockall        lock current and future memory\n"
+	       "         --output=FILENAME write final results into FILENAME, JSON formatted\n"
 	       "-p       --prompt          prompt before starting the test\n"
 	       "-q       --quiet           suppress running output\n"
 	       "-r       --rr              use SCHED_RR for test threads [SCHED_FIFO]\n"
@@ -1276,7 +1287,7 @@ int process_sched_line(const char *arg)
 
 enum option_values {
 	OPT_DEBUG=1, OPT_DURATION, OPT_GROUPS, OPT_HELP, OPT_INVERSIONS,
-	OPT_MLOCKALL, OPT_PROMPT, OPT_QUIET, OPT_RR, OPT_SCHED,
+	OPT_MLOCKALL, OPT_OUTPUT, OPT_PROMPT, OPT_QUIET, OPT_RR, OPT_SCHED,
 	OPT_UNIPROCESSOR, OPT_VERBOSE, OPT_VERSION,
 };
 
@@ -1290,6 +1301,7 @@ void process_command_line(int argc, char **argv)
 			{"help",		no_argument,		NULL, OPT_HELP},
 			{"inversions",		required_argument,	NULL, OPT_INVERSIONS},
 			{"mlockall",		no_argument,		NULL, OPT_MLOCKALL},
+			{"output",		required_argument,	NULL, OPT_OUTPUT},
 			{"prompt",		no_argument,		NULL, OPT_PROMPT},
 			{"quiet",		no_argument,		NULL, OPT_QUIET},
 			{"rr",			no_argument,		NULL, OPT_RR},
@@ -1336,6 +1348,9 @@ void process_command_line(int argc, char **argv)
 		case 'm':
 			lockall = 1;
 			break;
+		case OPT_OUTPUT:
+			strncpy(outfile, optarg, strnlen(optarg, MAX_PATH-1));
+			break;
 		case OPT_PROMPT:
 		case 'p':
 			prompt = 1;
@@ -1439,6 +1454,11 @@ void summary(void)
 	       t->tm_yday, t->tm_hour, t->tm_min, t->tm_sec);
 }
 
+void write_stats(FILE *f, void *data)
+{
+	fprintf(f, "  \"inversion\": %lu\n", total_inversions());
+}
+
 int
 barrier_init(pthread_barrier_t *b, const pthread_barrierattr_t *attr,
 	     unsigned int count, const char *name)
-- 
2.30.2


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

* [PATCH rt-tests v3 32/33] ssdd: Add quiet command line option
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (30 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 31/33] pi_stress: Add JSON output feature Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 17:00   ` John Kacur
  2021-03-20 18:38 ` [PATCH rt-tests v3 33/33] ssdd: Add JSON output feature Daniel Wagner
  2021-03-22 15:50 ` [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated John Kacur
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

The quiet option is useful for automated test setups where
only the final result of the run is interesting.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/ssdd/ssdd.c | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/src/ssdd/ssdd.c b/src/ssdd/ssdd.c
index 9fa61f39f6e3..50bec824b2e8 100644
--- a/src/ssdd/ssdd.c
+++ b/src/ssdd/ssdd.c
@@ -64,9 +64,11 @@ static const char *get_state_name(int state)
 
 #define unused __attribute__((unused))
 
+static int quiet;
+
 static int got_sigchld;
 
-enum option_value { OPT_NFORKS=1, OPT_NITERS, OPT_HELP };
+enum option_value { OPT_NFORKS=1, OPT_NITERS, OPT_HELP, OPT_QUIET };
 
 static void usage(int error)
 {
@@ -75,6 +77,7 @@ static void usage(int error)
 	       "ssdd <options>\n\n"
 	       "-f       --forks=NUM       number of forks\n"
 	       "-h       --help            print this message\n"
+	       "-q       --quiet           suppress running output\n"
 	       "-i       --iters=NUM       number of iterations\n"
 	       );
 	exit(error);
@@ -176,7 +179,8 @@ static int forktests(int testid)
 	if (!child)
 		child_process();
 
-	printf("forktest#%d/%d/%d: STARTING\n", testid, parent, child);
+	if (!quiet)
+		printf("forktest#%d/%d/%d: STARTING\n", testid, parent, child);
 
 	act.sa_sigaction = sigchld;
 	sigemptyset(&act.sa_mask);
@@ -278,8 +282,8 @@ static int forktests(int testid)
 	/* There is no need for the tracer to kill the tracee. It will
 	 * automatically exit when its owner, ie, us, exits.
 	 */
-
-	printf("forktest#%d/%d: EXITING, no error\n", testid, parent);
+	if (!quiet)
+		printf("forktest#%d/%d: EXITING, no error\n", testid, parent);
 	exit(0);
 }
 
@@ -297,10 +301,11 @@ int main(int argc, char **argv)
 		static struct option long_options[] = {
 			{"forks",		required_argument,	NULL, OPT_NFORKS},
 			{"help",		no_argument,		NULL, OPT_HELP},
+			{"quiet",		no_argument,		NULL, OPT_QUIET},
 			{"iters",		required_argument,	NULL, OPT_NITERS},
 			{NULL, 0, NULL, 0},
 		};
-		int c = getopt_long(argc, argv, "f:hi:", long_options, &option_index);
+		int c = getopt_long(argc, argv, "f:hqi:", long_options, &option_index);
 		if (c == -1)
 			break;
 		switch(c) {
@@ -312,6 +317,10 @@ int main(int argc, char **argv)
 		case OPT_HELP:
 			usage(0);
 			break;
+		case OPT_QUIET:
+		case 'q':
+			quiet = 1;
+			break;
 		case 'i':
 		case OPT_NITERS:
 			nsteps = atoi(optarg);
@@ -322,10 +331,12 @@ int main(int argc, char **argv)
 		}
 	}
 
-	printf("#main : %d\n", getpid());
-	printf("#forks: %d\n", nforks);
-	printf("#steps: %d\n", nsteps);
-	printf("\n");
+	if (!quiet) {
+		printf("#main : %d\n", getpid());
+		printf("#forks: %d\n", nforks);
+		printf("#steps: %d\n", nsteps);
+		printf("\n");
+	}
 
 	for (i = 0; i < nforks; i++) {
 		child = fork();
-- 
2.30.2


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

* [PATCH rt-tests v3 33/33] ssdd: Add JSON output feature
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (31 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 32/33] ssdd: Add quiet command line option Daniel Wagner
@ 2021-03-20 18:38 ` Daniel Wagner
  2021-05-07 17:00   ` John Kacur
  2021-03-22 15:50 ` [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated John Kacur
  33 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-03-20 18:38 UTC (permalink / raw)
  To: Clark Williams, John Kacur; +Cc: linux-rt-users, Daniel Wagner

Write the test results as JSON output to a file. This allows to
simplifies any parsing later on.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/ssdd/ssdd.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/ssdd/ssdd.c b/src/ssdd/ssdd.c
index 50bec824b2e8..3ead14d0127e 100644
--- a/src/ssdd/ssdd.c
+++ b/src/ssdd/ssdd.c
@@ -36,6 +36,8 @@
 #include <sys/wait.h>
 #include <sys/ptrace.h>
 
+#include "rt-utils.h"
+
 /* do_wait return values */
 #define STATE_EXITED	1
 #define STATE_STOPPED	2
@@ -65,10 +67,11 @@ static const char *get_state_name(int state)
 #define unused __attribute__((unused))
 
 static int quiet;
+static char outfile[MAX_PATH];
 
 static int got_sigchld;
 
-enum option_value { OPT_NFORKS=1, OPT_NITERS, OPT_HELP, OPT_QUIET };
+enum option_value { OPT_NFORKS=1, OPT_NITERS, OPT_HELP, OPT_OUTPUT, OPT_QUIET };
 
 static void usage(int error)
 {
@@ -77,6 +80,7 @@ static void usage(int error)
 	       "ssdd <options>\n\n"
 	       "-f       --forks=NUM       number of forks\n"
 	       "-h       --help            print this message\n"
+	       "         --output=FILENAME write final results into FILENAME, JSON formatted\n"
 	       "-q       --quiet           suppress running output\n"
 	       "-i       --iters=NUM       number of iterations\n"
 	       );
@@ -295,12 +299,14 @@ int main(int argc, char **argv)
 
 	setbuf(stdout, NULL);
 
+	rt_init(argc, argv);
 	for (;;) {
 		int option_index = 0;
 
 		static struct option long_options[] = {
 			{"forks",		required_argument,	NULL, OPT_NFORKS},
 			{"help",		no_argument,		NULL, OPT_HELP},
+			{"output",		required_argument,	NULL, OPT_OUTPUT},
 			{"quiet",		no_argument,		NULL, OPT_QUIET},
 			{"iters",		required_argument,	NULL, OPT_NITERS},
 			{NULL, 0, NULL, 0},
@@ -317,6 +323,9 @@ int main(int argc, char **argv)
 		case OPT_HELP:
 			usage(0);
 			break;
+		case OPT_OUTPUT:
+			strncpy(outfile, optarg, strnlen(optarg, MAX_PATH-1));
+			break;
 		case OPT_QUIET:
 		case 'q':
 			quiet = 1;
@@ -348,6 +357,7 @@ int main(int argc, char **argv)
 			forktests(i);
 	}
 
+	rt_test_start();
 	for (i = 0; i < nforks; i++) {
 		status = do_wait(&wait_pid, &ret_sig);
 		if (status != STATE_EXITED) {
@@ -363,5 +373,9 @@ int main(int argc, char **argv)
 	printf("%s.\n", error ?
 		"One or more tests FAILED" :
 		"All tests PASSED");
+
+	if (strlen(outfile) != 0)
+		rt_write_json(outfile, error, NULL, NULL);
+
 	exit(error);
 }
-- 
2.30.2


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

* Re: [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated
  2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
                   ` (32 preceding siblings ...)
  2021-03-20 18:38 ` [PATCH rt-tests v3 33/33] ssdd: Add JSON output feature Daniel Wagner
@ 2021-03-22 15:50 ` John Kacur
  33 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-03-22 15:50 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> v3:
>   - rebase
>   - two patches splitted into per test program change
>   - commit messsage added
>   
> v2:
>   - added 'return_code' to the common section of the JSON output
>   - dropped 'inversion' as we have 'return_code' in pip_stress
>   - dropped 'success' as we have 'return code in ssdd
> 
> All patches are also available at:
> 
>   https://github.com/igaw/rt-tests/tree/json-output-2021-03-20
> 
> Daniel Wagner (33):
>   cyclictest: Remove unused include header
>   cyclicdeadline: Remove unused include header
>   signaltest: Add missing --output usage info
>   rt-util: Add rt_init function
>   cyclictest: Initialize rt-util
>   oslat: Initialize rt-util
>   pmqtest: Initialize rt-util
>   ptsematest: Initialize rt-util
>   rt-migrate-test: Initialize rt-util
>   cyclicdeadline: Initialize rt-util
>   signaltest: Initialize rt-util
>   sigwaittest: Initialize rt-util
>   svematest: Initialize rt-util
>   rt-util: Remove superfluous arguments from rt_write_json
>   rt-util: Introduce rt_test_start()
>   cyclictest: Record start of test execution
>   oslat: Record start of test execution
>   pmqtest: Record start of test execution
>   ptesematest: Record start of test execution
>   rt-migrate-test: Record start of test execution
>   cyclicdeadline: Record start of test execution
>   signaltest: Record start of test execution
>   sigwaittest: Record start of test execution
>   svsematest: Record start of test execution
>   rt-util: Add return_code to common section of JSON output
>   pip_stress: Move test result output to main
>   pip_stress: Return failure code if test fails
>   pip_stress: Prepare arg parser to accept only long options
>   pip_stress: Add JSON output feature
>   pi_stress: Prepare command line parser for long options only
>   pi_stress: Add JSON output feature
>   ssdd: Add quiet command line option
>   ssdd: Add JSON output feature
> 
>  src/cyclictest/cyclictest.c           |  5 +-
>  src/include/rt-utils.h                |  6 +-
>  src/lib/rt-utils.c                    | 85 ++++++++++++++++-----------
>  src/oslat/oslat.c                     |  6 +-
>  src/pi_tests/pi_stress.c              | 65 ++++++++++++++++----
>  src/pi_tests/pip_stress.c             | 40 +++++++++----
>  src/pmqtest/pmqtest.c                 |  4 +-
>  src/ptsematest/ptsematest.c           |  4 +-
>  src/rt-migrate-test/rt-migrate-test.c |  4 +-
>  src/sched_deadline/cyclicdeadline.c   |  6 +-
>  src/signaltest/signaltest.c           |  5 +-
>  src/sigwaittest/sigwaittest.c         |  4 +-
>  src/ssdd/ssdd.c                       | 43 +++++++++++---
>  src/svsematest/svsematest.c           |  4 +-
>  14 files changed, 199 insertions(+), 82 deletions(-)
> 
> -- 
> 2.30.2
> 
> 

Thanks Daniel! On this right away.

John

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

* Re: [PATCH rt-tests v3 01/33] cyclictest: Remove unused include header
  2021-03-20 18:37 ` [PATCH rt-tests v3 01/33] cyclictest: Remove unused include header Daniel Wagner
@ 2021-05-07 16:17   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:17 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> The header was introduced by 24aaf9619bc2 ("cyclictest: Add JSON
> output feature") for PRIu64 format specifier. As PRIu64 was removed in
> commit f6881fc42baa ("cyclictest: Fix printf format specifier") remove
> the include header again.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/cyclictest/cyclictest.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index dca961025433..c43dd7cbbd64 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -11,7 +11,6 @@
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <stdint.h>
> -#include <inttypes.h>
>  #include <stdarg.h>
>  #include <unistd.h>
>  #include <fcntl.h>
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

(In fact I pushed this awhile ago)

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

* Re: [PATCH rt-tests v3 02/33] cyclicdeadline: Remove unused include header
  2021-03-20 18:37 ` [PATCH rt-tests v3 02/33] cyclicdeadline: " Daniel Wagner
@ 2021-05-07 16:19   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:19 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> The header was introduced by 68621f3c3322 ("cyclicdeadline: Add JSON
> output feature")for PRIu64 format specifier. As PRIu64 was removed in
> commit 51255cc14051 ("cyclicdeadline.c: Fix printf format specifier")
> remove the include header again.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/sched_deadline/cyclicdeadline.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
> index a02f4e519630..d7aa9bb5d269 100644
> --- a/src/sched_deadline/cyclicdeadline.c
> +++ b/src/sched_deadline/cyclicdeadline.c
> @@ -18,7 +18,6 @@
>  #include <errno.h>
>  #include <signal.h>
>  #include <getopt.h>
> -#include <inttypes.h>
>  
>  #include <sys/syscall.h>
>  #include <sys/types.h>
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 03/33] signaltest: Add missing --output usage info
  2021-03-20 18:37 ` [PATCH rt-tests v3 03/33] signaltest: Add missing --output usage info Daniel Wagner
@ 2021-05-07 16:26   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:26 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> bdb20cdaa8d5 ("signaltest: Add JSON output feature") introduced the
> new command line option but forgot to add it to the usage string.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/signaltest/signaltest.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
> index b1a7e1db8302..e2ffc0bb8693 100644
> --- a/src/signaltest/signaltest.c
> +++ b/src/signaltest/signaltest.c
> @@ -189,6 +189,7 @@ static void display_help(int error)
>  		"-h       --help            display usage information\n"
>  		"-l LOOPS --loops=LOOPS     number of loops: default=0(endless)\n"
>  		"-m       --mlockall        lock current and future memory allocations\n"
> +		"         --output=FILENAME write final results into FILENAME, JSON formatted\n"
>  		"-p PRIO  --prio=PRIO       priority of highest prio thread\n"
>  		"-q       --quiet           print a summary only on exit\n"
>  		"-t NUM   --threads=NUM     number of threads: default=2\n"
> -- 
> 2.30.2
> 
> 

Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 04/33] rt-util: Add rt_init function
  2021-03-20 18:38 ` [PATCH rt-tests v3 04/33] rt-util: Add rt_init function Daniel Wagner
@ 2021-05-07 16:27   ` John Kacur
  2021-05-12  7:30     ` Daniel Wagner
  0 siblings, 1 reply; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:27 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> rt_init() should be called as first in the test program.
> The main job for this function is to copy the command line
> before getopt() runs. By default, getopt_long() permutes
> the contents of argv as it scans, so that eventually all the
> nonoptions are at the end. This is confusing in the JSON
> output, thus copy the command line before we call getopt_long().
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/include/rt-utils.h |  2 ++
>  src/lib/rt-utils.c     | 47 +++++++++++++++++++++++++++++++++++-------
>  2 files changed, 42 insertions(+), 7 deletions(-)
> 
> diff --git a/src/include/rt-utils.h b/src/include/rt-utils.h
> index 36af92b170df..1dbd3f1dd8e3 100644
> --- a/src/include/rt-utils.h
> +++ b/src/include/rt-utils.h
> @@ -80,6 +80,8 @@ static inline int64_t calctime(struct timespec t)
>  	return time;
>  }
>  
> +void rt_init(int argc, char *argv[]);
> +
>  void rt_write_json(const char *filename, int argc, char *argv[],
>  		   void (*cb)(FILE *, void *),
>  		   void *data);
> diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
> index 00907c573d6a..8f0e0943b137 100644
> --- a/src/lib/rt-utils.c
> +++ b/src/lib/rt-utils.c
> @@ -29,12 +29,15 @@
>  #include "rt-error.h"
>  
>  #define  TRACEBUFSIZ  1024
> +#define  MAX_COMMAND_LINE 4096
>  
>  static char debugfileprefix[MAX_PATH];
>  static char *fileprefix;
>  static int trace_fd = -1;
>  static int tracemark_fd = -1;
>  static __thread char tracebuf[TRACEBUFSIZ];
> +static char test_cmdline[MAX_COMMAND_LINE];
> +static int rt_init_run;
>  
>  /*
>   * Finds the tracing directory in a mounted debugfs
> @@ -486,6 +489,34 @@ void disable_trace_mark(void)
>  	close_tracemark_fd();
>  }
>  
> +void rt_init(int argc, char *argv[])
> +{
> +	int offset = 0;
> +	int len, i;
> +
> +	test_cmdline[0] = '\0';
> +
> +	/*
> +	 * getopt_long() permutes the contents of argv as it scans, so
> +	 * that eventually all the nonoptions are at the end. Make a
> +	 * copy before calling getopt_long().
> +	 */
> +	for (i = 0; i < argc;) {
> +		len = strlen(argv[i]);
> +		if (offset + len + 1 >= MAX_COMMAND_LINE)
> +			break;
> +
> +		strcat(test_cmdline, argv[i]);
> +		i++;
> +		if (i < argc)
> +			strcat(test_cmdline, " ");
> +
> +		offset += len + 1;
> +	}
> +
> +	rt_init_run = 1;
> +}
> +
>  static char *get_cmdline(int argc, char *argv[])
>  {
>  	char *cmdline;
> @@ -519,7 +550,7 @@ void rt_write_json(const char *filename, int argc, char *argv[],
>  	struct timeval tv;
>  	char tsbuf[64];
>  	struct tm *tm;
> -	char *cmdline;
> +	char *cmdline = NULL;
>  	FILE *f, *s;
>  	time_t t;
>  	size_t n;
> @@ -533,10 +564,11 @@ void rt_write_json(const char *filename, int argc, char *argv[],
>  			err_exit(errno, "Failed to open '%s'\n", filename);
>  	}
>  
> -	cmdline = get_cmdline(argc, argv);
> -	if (!cmdline)
> -		err_exit(ENOMEM, "get_cmdline()");
> -
> +	if (!rt_init_run) {
> +		cmdline = get_cmdline(argc, argv);
> +		if (!cmdline)
> +			err_exit(ENOMEM, "get_cmdline()");
> +	}
>  
>  	gettimeofday(&tv, NULL);
>  	t = tv.tv_sec;
> @@ -557,7 +589,7 @@ void rt_write_json(const char *filename, int argc, char *argv[],
>  
>  	fprintf(f, "{\n");
>  	fprintf(f, "  \"file_version\": 1,\n");
> -	fprintf(f, "  \"cmdline:\": \"%s\",\n", cmdline);
> +	fprintf(f, "  \"cmdline:\": \"%s\",\n", rt_init_run? test_cmdline : cmdline);
>  	fprintf(f, "  \"rt_test_version:\": \"%1.2f\",\n", VERSION);
>  	fprintf(f, "  \"finished\": \"%s\",\n", tsbuf);
>  	fprintf(f, "  \"sysinfo\": {\n");
> @@ -573,7 +605,8 @@ void rt_write_json(const char *filename, int argc, char *argv[],
>  
>  	fprintf(f, "}\n");
>  
> -	free(cmdline);
> +	if (!rt_init_run)
> +		free(cmdline);
>  
>  	if (!filename || strcmp("-", filename))
>  		fclose(f);
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

But I don't like the name, it's not initing any test state, it's copying 
the command line, and the name should reflect that.

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

* Re: [PATCH rt-tests v3 05/33] cyclictest: Initialize rt-util
  2021-03-20 18:38 ` [PATCH rt-tests v3 05/33] cyclictest: Initialize rt-util Daniel Wagner
@ 2021-05-07 16:28   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:28 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Allow rt-util make a copy of the command line.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/cyclictest/cyclictest.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index c43dd7cbbd64..e817af217952 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -1778,6 +1778,7 @@ int main(int argc, char **argv)
>  	int i, ret = -1;
>  	int status;
>  
> +	rt_init(argc, argv);
>  	process_options(argc, argv, max_cpus);
>  
>  	if (check_privs())
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 06/33] oslat: Initialize rt-util
  2021-03-20 18:38 ` [PATCH rt-tests v3 06/33] oslat: " Daniel Wagner
@ 2021-05-07 16:29   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:29 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Allow rt-util make a copy of the command line.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/oslat/oslat.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
> index 465a694cdd1d..da7b25d48384 100644
> --- a/src/oslat/oslat.c
> +++ b/src/oslat/oslat.c
> @@ -796,6 +796,8 @@ int main(int argc, char *argv[])
>  		exit(1);
>  	}
>  
> +	rt_init(argc, argv);
> +
>  	g.app_name = argv[0];
>  	g.rtprio = 0;
>  	g.bucket_size = BUCKET_SIZE;
> -- 
> 2.30.2
> 
> 

Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 07/33] pmqtest: Initialize rt-util
  2021-03-20 18:38 ` [PATCH rt-tests v3 07/33] pmqtest: " Daniel Wagner
@ 2021-05-07 16:29   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:29 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Allow rt-util make a copy of the command line.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/pmqtest/pmqtest.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
> index e1f59836ea07..aae3c78f8a0a 100644
> --- a/src/pmqtest/pmqtest.c
> +++ b/src/pmqtest/pmqtest.c
> @@ -502,6 +502,7 @@ int main(int argc, char *argv[])
>  	mqstat.mq_msgsize = 8;
>  	mqstat.mq_flags = 0;
>  
> +	rt_init(argc, argv);
>  	process_options(argc, argv);
>  
>  	if (check_privs())
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 08/33] ptsematest: Initialize rt-util
  2021-03-20 18:38 ` [PATCH rt-tests v3 08/33] ptsematest: " Daniel Wagner
@ 2021-05-07 16:30   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:30 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Allow rt-util make a copy of the command line.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/ptsematest/ptsematest.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
> index 2755bfde5210..eb7ac4ccc823 100644
> --- a/src/ptsematest/ptsematest.c
> +++ b/src/ptsematest/ptsematest.c
> @@ -401,6 +401,7 @@ int main(int argc, char *argv[])
>  	sigset_t sigset;
>  	struct timespec maindelay;
>  
> +	rt_init(argc, argv);
>  	process_options(argc, argv);
>  
>  	if (check_privs())
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 09/33] rt-migrate-test: Initialize rt-util
  2021-03-20 18:38 ` [PATCH rt-tests v3 09/33] rt-migrate-test: " Daniel Wagner
@ 2021-05-07 16:31   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:31 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Allow rt-util make a copy of the command line.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/rt-migrate-test/rt-migrate-test.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
> index 56b7b66ccdf4..daa876d3e2b2 100644
> --- a/src/rt-migrate-test/rt-migrate-test.c
> +++ b/src/rt-migrate-test/rt-migrate-test.c
> @@ -535,6 +535,7 @@ int main (int argc, char **argv)
>  	struct timespec intv;
>  	struct sched_param param;
>  
> +	rt_init(argc, argv);
>  	parse_options(argc, argv);
>  
>  	signal(SIGINT, stop_log);
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 10/33] cyclicdeadline: Initialize rt-util
  2021-03-20 18:38 ` [PATCH rt-tests v3 10/33] cyclicdeadline: " Daniel Wagner
@ 2021-05-07 16:31   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:31 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Allow rt-util make a copy of the command line.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/sched_deadline/cyclicdeadline.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
> index d7aa9bb5d269..13a1812c13b3 100644
> --- a/src/sched_deadline/cyclicdeadline.c
> +++ b/src/sched_deadline/cyclicdeadline.c
> @@ -1009,6 +1009,8 @@ int main(int argc, char **argv)
>  	int i;
>  	int c;
>  
> +	rt_init(argc, argv);
> +
>  	cpu_count = sysconf(_SC_NPROCESSORS_CONF);
>  	if (cpu_count < 1)
>  		err_quit("Can not calculate number of CPUS\n");
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 11/33] signaltest: Initialize rt-util
  2021-03-20 18:38 ` [PATCH rt-tests v3 11/33] signaltest: " Daniel Wagner
@ 2021-05-07 16:32   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:32 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Allow rt-util make a copy of the command line.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/signaltest/signaltest.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
> index e2ffc0bb8693..4da8436e4296 100644
> --- a/src/signaltest/signaltest.c
> +++ b/src/signaltest/signaltest.c
> @@ -414,6 +414,7 @@ int main(int argc, char **argv)
>  	int status, cpu;
>  	int max_cpus = sysconf(_SC_NPROCESSORS_ONLN);
>  
> +	rt_init(argc, argv);
>  	process_options(argc, argv, max_cpus);
>  
>  	if (check_privs())
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 12/33] sigwaittest: Initialize rt-util
  2021-03-20 18:38 ` [PATCH rt-tests v3 12/33] sigwaittest: " Daniel Wagner
@ 2021-05-07 16:33   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:33 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Allow rt-util make a copy of the command line.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/sigwaittest/sigwaittest.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/sigwaittest/sigwaittest.c b/src/sigwaittest/sigwaittest.c
> index 0cdf30a6a769..a1808409730a 100644
> --- a/src/sigwaittest/sigwaittest.c
> +++ b/src/sigwaittest/sigwaittest.c
> @@ -473,6 +473,7 @@ int main(int argc, char *argv[])
>  	char f_opt[14];
>  	struct timespec launchdelay, maindelay;
>  
> +	rt_init(argc, argv);
>  	process_options(argc, argv);
>  
>  	if (check_privs())
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 13/33] svematest: Initialize rt-util
  2021-03-20 18:38 ` [PATCH rt-tests v3 13/33] svematest: " Daniel Wagner
@ 2021-05-07 16:34   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:34 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Allow rt-util make a copy of the command line.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/svsematest/svsematest.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/svsematest/svsematest.c b/src/svsematest/svsematest.c
> index 23f84bcbd3dc..24e5e7adf494 100644
> --- a/src/svsematest/svsematest.c
> +++ b/src/svsematest/svsematest.c
> @@ -514,6 +514,7 @@ int main(int argc, char *argv[])
>  	if (myfile == NULL)
>  		myfile = argv[0];
>  
> +	rt_init(argc, argv);
>  	process_options(argc, argv);
>  
>  	if (check_privs())
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 14/33] rt-util: Remove superfluous arguments from rt_write_json
  2021-03-20 18:38 ` [PATCH rt-tests v3 14/33] rt-util: Remove superfluous arguments from rt_write_json Daniel Wagner
@ 2021-05-07 16:36   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:36 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> We copy the command line via the rt_init() API and don't need
> the argc, argv arguments for rt_write_json. Remove them.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/cyclictest/cyclictest.c           |  2 +-
>  src/include/rt-utils.h                |  2 +-
>  src/lib/rt-utils.c                    | 41 ++-------------------------
>  src/oslat/oslat.c                     |  3 +-
>  src/pmqtest/pmqtest.c                 |  2 +-
>  src/ptsematest/ptsematest.c           |  2 +-
>  src/rt-migrate-test/rt-migrate-test.c |  2 +-
>  src/sched_deadline/cyclicdeadline.c   |  2 +-
>  src/signaltest/signaltest.c           |  2 +-
>  src/sigwaittest/sigwaittest.c         |  2 +-
>  src/svsematest/svsematest.c           |  2 +-
>  11 files changed, 12 insertions(+), 50 deletions(-)
> 
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index e817af217952..3f3b91bab53b 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -2134,7 +2134,7 @@ int main(int argc, char **argv)
>  		printf("\033[%dB", num_threads + 2);
>  
>  	if (strlen(outfile) != 0)
> -		rt_write_json(outfile, argc, argv, write_stats, NULL);
> +		rt_write_json(outfile, write_stats, NULL);
>  
>  	if (quiet)
>  		quiet = 2;
> diff --git a/src/include/rt-utils.h b/src/include/rt-utils.h
> index 1dbd3f1dd8e3..115791c55185 100644
> --- a/src/include/rt-utils.h
> +++ b/src/include/rt-utils.h
> @@ -82,7 +82,7 @@ static inline int64_t calctime(struct timespec t)
>  
>  void rt_init(int argc, char *argv[]);
>  
> -void rt_write_json(const char *filename, int argc, char *argv[],
> +void rt_write_json(const char *filename,
>  		   void (*cb)(FILE *, void *),
>  		   void *data);
>  
> diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
> index 8f0e0943b137..f736a3449bf7 100644
> --- a/src/lib/rt-utils.c
> +++ b/src/lib/rt-utils.c
> @@ -37,7 +37,6 @@ static int trace_fd = -1;
>  static int tracemark_fd = -1;
>  static __thread char tracebuf[TRACEBUFSIZ];
>  static char test_cmdline[MAX_COMMAND_LINE];
> -static int rt_init_run;
>  
>  /*
>   * Finds the tracing directory in a mounted debugfs
> @@ -513,35 +512,9 @@ void rt_init(int argc, char *argv[])
>  
>  		offset += len + 1;
>  	}
> -
> -	rt_init_run = 1;
> -}
> -
> -static char *get_cmdline(int argc, char *argv[])
> -{
> -	char *cmdline;
> -	int len, i;
> -
> -	len = 0;
> -	for (i = 0; i < argc; i++)
> -		len += strlen(argv[i]) + 1;
> -
> -	cmdline = malloc(len);
> -	if (!cmdline)
> -		err_exit(ENOMEM, "Could not copy cmdline");
> -
> -	memset(cmdline, 0, len);
> -	for (i = 0; i < argc;) {
> -		cmdline = strcat(cmdline, argv[i]);
> -		i++;
> -		if (i < argc)
> -			cmdline = strcat(cmdline, " ");
> -	}
> -
> -	return cmdline;
>  }
>  
> -void rt_write_json(const char *filename, int argc, char *argv[],
> +void rt_write_json(const char *filename,
>  		  void (*cb)(FILE *, void *),
>  		  void *data)
>  {
> @@ -550,7 +523,6 @@ void rt_write_json(const char *filename, int argc, char *argv[],
>  	struct timeval tv;
>  	char tsbuf[64];
>  	struct tm *tm;
> -	char *cmdline = NULL;
>  	FILE *f, *s;
>  	time_t t;
>  	size_t n;
> @@ -564,12 +536,6 @@ void rt_write_json(const char *filename, int argc, char *argv[],
>  			err_exit(errno, "Failed to open '%s'\n", filename);
>  	}
>  
> -	if (!rt_init_run) {
> -		cmdline = get_cmdline(argc, argv);
> -		if (!cmdline)
> -			err_exit(ENOMEM, "get_cmdline()");
> -	}
> -
>  	gettimeofday(&tv, NULL);
>  	t = tv.tv_sec;
>  	tm = localtime(&t);
> @@ -589,7 +555,7 @@ void rt_write_json(const char *filename, int argc, char *argv[],
>  
>  	fprintf(f, "{\n");
>  	fprintf(f, "  \"file_version\": 1,\n");
> -	fprintf(f, "  \"cmdline:\": \"%s\",\n", rt_init_run? test_cmdline : cmdline);
> +	fprintf(f, "  \"cmdline:\": \"%s\",\n", test_cmdline);
>  	fprintf(f, "  \"rt_test_version:\": \"%1.2f\",\n", VERSION);
>  	fprintf(f, "  \"finished\": \"%s\",\n", tsbuf);
>  	fprintf(f, "  \"sysinfo\": {\n");
> @@ -605,9 +571,6 @@ void rt_write_json(const char *filename, int argc, char *argv[],
>  
>  	fprintf(f, "}\n");
>  
> -	if (!rt_init_run)
> -		free(cmdline);
> -
>  	if (!filename || strcmp("-", filename))
>  		fclose(f);
>  }
> diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
> index da7b25d48384..ac54d05697ef 100644
> --- a/src/oslat/oslat.c
> +++ b/src/oslat/oslat.c
> @@ -862,8 +862,7 @@ int main(int argc, char *argv[])
>  	write_summary(threads);
>  
>  	if (strlen(g.outfile) != 0)
> -		rt_write_json(g.outfile, argc, argv,
> -			write_summary_json, threads);
> +		rt_write_json(g.outfile, write_summary_json, threads);
>  
>  	if (g.cpu_list) {
>  		free(g.cpu_list);
> diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
> index aae3c78f8a0a..f96b3d0bf400 100644
> --- a/src/pmqtest/pmqtest.c
> +++ b/src/pmqtest/pmqtest.c
> @@ -651,7 +651,7 @@ int main(int argc, char *argv[])
>  			.receiver = receiver,
>  			.sender = sender,
>  		};
> -		rt_write_json(outfile, argc, argv, write_stats, &ps);
> +		rt_write_json(outfile, write_stats, &ps);
>  	}
>  
>  nomem:
> diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
> index eb7ac4ccc823..a32bfc1698f0 100644
> --- a/src/ptsematest/ptsematest.c
> +++ b/src/ptsematest/ptsematest.c
> @@ -519,7 +519,7 @@ int main(int argc, char *argv[])
>  			.receiver = receiver,
>  			.sender = sender,
>  		};
> -		rt_write_json(outfile, argc, argv, write_stats, &ps);
> +		rt_write_json(outfile, write_stats, &ps);
>  	}
>  
>  nomem:
> diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
> index daa876d3e2b2..cdfbfafb200b 100644
> --- a/src/rt-migrate-test/rt-migrate-test.c
> +++ b/src/rt-migrate-test/rt-migrate-test.c
> @@ -663,7 +663,7 @@ int main (int argc, char **argv)
>  	print_results();
>  
>  	if (strlen(outfile) != 0)
> -		rt_write_json(outfile, argc, argv, write_stats, NULL);
> +		rt_write_json(outfile, write_stats, NULL);
>  
>  	if (stop) {
>  		/*
> diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
> index 13a1812c13b3..e6811838b62d 100644
> --- a/src/sched_deadline/cyclicdeadline.c
> +++ b/src/sched_deadline/cyclicdeadline.c
> @@ -1227,7 +1227,7 @@ int main(int argc, char **argv)
>  	}
>  
>  	if (strlen(outfile) != 0)
> -		rt_write_json(outfile, argc, argv, write_stats, sched_data);
> +		rt_write_json(outfile, write_stats, sched_data);
>  
>  	if (setcpu_buf)
>  		free(setcpu_buf);
> diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
> index 4da8436e4296..6abf38b7821c 100644
> --- a/src/signaltest/signaltest.c
> +++ b/src/signaltest/signaltest.c
> @@ -558,7 +558,7 @@ int main(int argc, char **argv)
>  			free(stat[i].values);
>  	}
>  	if (strlen(outfile) != 0)
> -		rt_write_json(outfile, argc, argv, write_stats, par);
> +		rt_write_json(outfile, write_stats, par);
>  
>  	free(stat);
>   outpar:
> diff --git a/src/sigwaittest/sigwaittest.c b/src/sigwaittest/sigwaittest.c
> index a1808409730a..142419f9e315 100644
> --- a/src/sigwaittest/sigwaittest.c
> +++ b/src/sigwaittest/sigwaittest.c
> @@ -706,7 +706,7 @@ int main(int argc, char *argv[])
>  			.receiver = receiver,
>  			.sender = sender,
>  		};
> -		rt_write_json(outfile, argc, argv, write_stats, &ps);
> +		rt_write_json(outfile, write_stats, &ps);
>  	}
>  
>  nomem:
> diff --git a/src/svsematest/svsematest.c b/src/svsematest/svsematest.c
> index 24e5e7adf494..7c9d21edbab2 100644
> --- a/src/svsematest/svsematest.c
> +++ b/src/svsematest/svsematest.c
> @@ -778,7 +778,7 @@ int main(int argc, char *argv[])
>  			.receiver = receiver,
>  			.sender = sender,
>  		};
> -		rt_write_json(outfile, argc, argv, write_stats, &ps);
> +		rt_write_json(outfile, write_stats, &ps);
>  	}
>  
>  nosem:
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 15/33] rt-util: Introduce rt_test_start()
  2021-03-20 18:38 ` [PATCH rt-tests v3 15/33] rt-util: Introduce rt_test_start() Daniel Wagner
@ 2021-05-07 16:40   ` John Kacur
  2021-05-12  7:33     ` Daniel Wagner
  0 siblings, 1 reply; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:40 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> For the JSON output records a timestamp when the test ended.
> Let's introduce a new API to record a timestamp when the test
> starts. We could put this into rt_init() but in this case we
> would meassure also the time test needs to setup or warm up.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/include/rt-utils.h |  2 ++
>  src/lib/rt-utils.c     | 34 ++++++++++++++++++++++++----------
>  2 files changed, 26 insertions(+), 10 deletions(-)
> 
> diff --git a/src/include/rt-utils.h b/src/include/rt-utils.h
> index 115791c55185..42c2772262db 100644
> --- a/src/include/rt-utils.h
> +++ b/src/include/rt-utils.h
> @@ -82,6 +82,8 @@ static inline int64_t calctime(struct timespec t)
>  
>  void rt_init(int argc, char *argv[]);
>  
> +void rt_test_start(void);
> +
>  void rt_write_json(const char *filename,
>  		   void (*cb)(FILE *, void *),
>  		   void *data);
> diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
> index f736a3449bf7..efb5d1d9e866 100644
> --- a/src/lib/rt-utils.c
> +++ b/src/lib/rt-utils.c
> @@ -30,6 +30,7 @@
>  
>  #define  TRACEBUFSIZ  1024
>  #define  MAX_COMMAND_LINE 4096
> +#define  MAX_TS_SIZE 64
>  
>  static char debugfileprefix[MAX_PATH];
>  static char *fileprefix;
> @@ -37,6 +38,7 @@ static int trace_fd = -1;
>  static int tracemark_fd = -1;
>  static __thread char tracebuf[TRACEBUFSIZ];
>  static char test_cmdline[MAX_COMMAND_LINE];
> +static char ts_start[MAX_TS_SIZE];
>  
>  /*
>   * Finds the tracing directory in a mounted debugfs
> @@ -514,17 +516,32 @@ void rt_init(int argc, char *argv[])
>  	}
>  }
>  
> +static void get_timestamp(char *tsbuf)
> +{
> +	struct timeval tv;
> +	struct tm *tm;
> +	time_t t;
> +
> +	gettimeofday(&tv, NULL);
> +	t = tv.tv_sec;
> +	tm = localtime(&t);
> +	/* RFC 2822-compliant date format */
> +	strftime(tsbuf, MAX_TS_SIZE, "%a, %d %b %Y %T %z", tm);
> +}
> +
> +void rt_test_start(void)
> +{
> +	get_timestamp(ts_start);
> +}
> +
>  void rt_write_json(const char *filename,
>  		  void (*cb)(FILE *, void *),
>  		  void *data)
>  {
>  	unsigned char buf[1];
>  	struct utsname uts;
> -	struct timeval tv;
> -	char tsbuf[64];
> -	struct tm *tm;
> +	char ts_end[MAX_TS_SIZE];
>  	FILE *f, *s;
> -	time_t t;
>  	size_t n;
>  	int rt = 0;
>  
> @@ -536,11 +553,7 @@ void rt_write_json(const char *filename,
>  			err_exit(errno, "Failed to open '%s'\n", filename);
>  	}
>  
> -	gettimeofday(&tv, NULL);
> -	t = tv.tv_sec;
> -	tm = localtime(&t);
> -	/* RFC 2822-compliant date format */
> -	strftime(tsbuf, sizeof(tsbuf), "%a, %d %b %Y %T %z", tm);
> +	get_timestamp(ts_end);
>  
>  	s = fopen("/sys/kernel/realtime", "r");
>  	if (s) {
> @@ -557,7 +570,8 @@ void rt_write_json(const char *filename,
>  	fprintf(f, "  \"file_version\": 1,\n");
>  	fprintf(f, "  \"cmdline:\": \"%s\",\n", test_cmdline);
>  	fprintf(f, "  \"rt_test_version:\": \"%1.2f\",\n", VERSION);
> -	fprintf(f, "  \"finished\": \"%s\",\n", tsbuf);
> +	fprintf(f, "  \"start_time\": \"%s\",\n", ts_start);
> +	fprintf(f, "  \"end_time\": \"%s\",\n", ts_end);
>  	fprintf(f, "  \"sysinfo\": {\n");
>  	fprintf(f, "    \"sysname\": \"%s\",\n", uts.sysname);
>  	fprintf(f, "    \"nodename\": \"%s\",\n", uts.nodename);
> -- 
> 2.30.2
> 
> 

I don't really like this. I think it looks "good" in the json output, but
I don't think it is providing any kind of meaningful data. My fear is that 
users will try to assign some kind of significance to these numbers in 
relation to the tests.

I'm letting it in anyway, maybe people will tell me I'm wrong and they 
like it, but recording my objection for now anyway.

Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 16/33] cyclictest: Record start of test execution
  2021-03-20 18:38 ` [PATCH rt-tests v3 16/33] cyclictest: Record start of test execution Daniel Wagner
@ 2021-05-07 16:41   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:41 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Use rt_test_start() to record a timestamp when the test starts.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/cyclictest/cyclictest.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index 3f3b91bab53b..033b95a3a19a 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -615,6 +615,7 @@ static void *timerthread(void *param)
>  		setitimer(ITIMER_REAL, &itimer, NULL);
>  	}
>  
> +	rt_test_start();
>  	stat->threadstarted++;
>  
>  	while (!shutdown) {
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacaur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 17/33] oslat: Record start of test execution
  2021-03-20 18:38 ` [PATCH rt-tests v3 17/33] oslat: " Daniel Wagner
@ 2021-05-07 16:41   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:41 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Use rt_test_start() to record a timestamp when the test starts.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/oslat/oslat.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
> index ac54d05697ef..2f02f5399405 100644
> --- a/src/oslat/oslat.c
> +++ b/src/oslat/oslat.c
> @@ -854,6 +854,7 @@ int main(int argc, char *argv[])
>  		printf("Test starts...\n");
>  	/* Reset n_threads to always run on all the cores */
>  	g.n_threads = g.n_threads_total;
> +	rt_test_start();
>  	run_expt(threads, g.runtime);
>  
>  	if (!g.quiet)
> -- 
> 2.30.2
> 
> 

Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 18/33] pmqtest: Record start of test execution
  2021-03-20 18:38 ` [PATCH rt-tests v3 18/33] pmqtest: " Daniel Wagner
@ 2021-05-07 16:43   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:43 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Use rt_test_start() to record a timestamp when the test starts.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/pmqtest/pmqtest.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
> index f96b3d0bf400..adf72c10ce83 100644
> --- a/src/pmqtest/pmqtest.c
> +++ b/src/pmqtest/pmqtest.c
> @@ -583,6 +583,7 @@ int main(int argc, char *argv[])
>  	sigemptyset(&sigset);
>  	pthread_sigmask(SIG_SETMASK, &sigset, NULL);
>  
> +	rt_test_start();
>  	do {
>  		int newsamples = 0, newtimeoutcount = 0;
>  		int minsamples = INT_MAX;
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 19/33] ptesematest: Record start of test execution
  2021-03-20 18:38 ` [PATCH rt-tests v3 19/33] ptesematest: " Daniel Wagner
@ 2021-05-07 16:43   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:43 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Use rt_test_start() to record a timestamp when the test starts.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/ptsematest/ptsematest.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
> index a32bfc1698f0..471f1b307c14 100644
> --- a/src/ptsematest/ptsematest.c
> +++ b/src/ptsematest/ptsematest.c
> @@ -468,6 +468,7 @@ int main(int argc, char *argv[])
>  	maindelay.tv_sec = 0;
>  	maindelay.tv_nsec = 50000000; /* 50 ms */
>  
> +	rt_test_start();
>  	while (!shutdown) {
>  		for (i = 0; i < num_threads; i++)
>  			shutdown |= receiver[i].shutdown | sender[i].shutdown;
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 20/33] rt-migrate-test: Record start of test execution
  2021-03-20 18:38 ` [PATCH rt-tests v3 20/33] rt-migrate-test: " Daniel Wagner
@ 2021-05-07 16:44   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:44 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Use rt_test_start() to record a timestamp when the test starts.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/rt-migrate-test/rt-migrate-test.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
> index cdfbfafb200b..8f628d347a23 100644
> --- a/src/rt-migrate-test/rt-migrate-test.c
> +++ b/src/rt-migrate-test/rt-migrate-test.c
> @@ -621,6 +621,7 @@ int main (int argc, char **argv)
>  
>  	setup_ftrace_marker();
>  
> +	rt_test_start();
>  	for (loop=0; loop < nr_runs; loop++) {
>  		unsigned long long end;
>  
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 21/33] cyclicdeadline: Record start of test execution
  2021-03-20 18:38 ` [PATCH rt-tests v3 21/33] cyclicdeadline: " Daniel Wagner
@ 2021-05-07 16:45   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:45 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Use rt_test_start() to record a timestamp when the test starts.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/sched_deadline/cyclicdeadline.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
> index e6811838b62d..a649e5a0fe5e 100644
> --- a/src/sched_deadline/cyclicdeadline.c
> +++ b/src/sched_deadline/cyclicdeadline.c
> @@ -1213,6 +1213,7 @@ int main(int argc, char **argv)
>  	if (duration)
>  		alarm(duration);
>  
> +	rt_test_start();
>  	loop(sched_data, nr_threads);
>  
>  	for (i = 0; i < nr_threads; i++) {
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 22/33] signaltest: Record start of test execution
  2021-03-20 18:38 ` [PATCH rt-tests v3 22/33] signaltest: " Daniel Wagner
@ 2021-05-07 16:45   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:45 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Use rt_test_start() to record a timestamp when the test starts.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/signaltest/signaltest.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
> index 6abf38b7821c..7327d0d0144d 100644
> --- a/src/signaltest/signaltest.c
> +++ b/src/signaltest/signaltest.c
> @@ -500,6 +500,7 @@ int main(int argc, char **argv)
>  			      strerror(status));
>  	}
>  
> +	rt_test_start();
>  	while (!shutdown) {
>  		int allstarted = 1;
>  
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 23/33] sigwaittest: Record start of test execution
  2021-03-20 18:38 ` [PATCH rt-tests v3 23/33] sigwaittest: " Daniel Wagner
@ 2021-05-07 16:46   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:46 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Use rt_test_start() to record a timestamp when the test starts.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/sigwaittest/sigwaittest.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/sigwaittest/sigwaittest.c b/src/sigwaittest/sigwaittest.c
> index 142419f9e315..6e8bc7b50d5f 100644
> --- a/src/sigwaittest/sigwaittest.c
> +++ b/src/sigwaittest/sigwaittest.c
> @@ -652,6 +652,7 @@ int main(int argc, char *argv[])
>  			    &sender[i]);
>  	}
>  
> +	rt_test_start();
>  	while (!mustshutdown) {
>  		for (i = 0; i < num_threads; i++)
>  			mustshutdown |= receiver[i].shutdown |
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur@redhat.com>

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

* Re: [PATCH rt-tests v3 24/33] svsematest: Record start of test execution
  2021-03-20 18:38 ` [PATCH rt-tests v3 24/33] svsematest: " Daniel Wagner
@ 2021-05-07 16:46   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:46 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Use rt_test_start() to record a timestamp when the test starts.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/svsematest/svsematest.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/svsematest/svsematest.c b/src/svsematest/svsematest.c
> index 7c9d21edbab2..7533b1b569cc 100644
> --- a/src/svsematest/svsematest.c
> +++ b/src/svsematest/svsematest.c
> @@ -724,6 +724,7 @@ int main(int argc, char *argv[])
>  			    &sender[i]);
>  	}
>  
> +	rt_test_start();
>  	while (!mustshutdown) {
>  		for (i = 0; i < num_threads; i++)
>  			mustshutdown |= receiver[i].shutdown |
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 25/33] rt-util: Add return_code to common section of JSON output
  2021-03-20 18:38 ` [PATCH rt-tests v3 25/33] rt-util: Add return_code to common section of JSON output Daniel Wagner
@ 2021-05-07 16:49   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:49 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Many rt-tests return an error code if the test fails. Let's add
> this information to the common section.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/cyclictest/cyclictest.c           |  2 +-
>  src/include/rt-utils.h                |  2 +-
>  src/lib/rt-utils.c                    | 11 ++++++++---
>  src/oslat/oslat.c                     |  2 +-
>  src/pmqtest/pmqtest.c                 |  2 +-
>  src/ptsematest/ptsematest.c           |  2 +-
>  src/rt-migrate-test/rt-migrate-test.c |  2 +-
>  src/sched_deadline/cyclicdeadline.c   |  2 +-
>  src/signaltest/signaltest.c           |  2 +-
>  src/sigwaittest/sigwaittest.c         |  2 +-
>  src/svsematest/svsematest.c           |  2 +-
>  11 files changed, 18 insertions(+), 13 deletions(-)
> 
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index 033b95a3a19a..59dda1973b1a 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -2135,7 +2135,7 @@ int main(int argc, char **argv)
>  		printf("\033[%dB", num_threads + 2);
>  
>  	if (strlen(outfile) != 0)
> -		rt_write_json(outfile, write_stats, NULL);
> +		rt_write_json(outfile, ret, write_stats, NULL);
>  
>  	if (quiet)
>  		quiet = 2;
> diff --git a/src/include/rt-utils.h b/src/include/rt-utils.h
> index 42c2772262db..f07b57d5f7c1 100644
> --- a/src/include/rt-utils.h
> +++ b/src/include/rt-utils.h
> @@ -84,7 +84,7 @@ void rt_init(int argc, char *argv[]);
>  
>  void rt_test_start(void);
>  
> -void rt_write_json(const char *filename,
> +void rt_write_json(const char *filename, int return_code,
>  		   void (*cb)(FILE *, void *),
>  		   void *data);
>  
> diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
> index efb5d1d9e866..d264c348ad42 100644
> --- a/src/lib/rt-utils.c
> +++ b/src/lib/rt-utils.c
> @@ -534,7 +534,7 @@ void rt_test_start(void)
>  	get_timestamp(ts_start);
>  }
>  
> -void rt_write_json(const char *filename,
> +void rt_write_json(const char *filename, int return_code,
>  		  void (*cb)(FILE *, void *),
>  		  void *data)
>  {
> @@ -572,6 +572,7 @@ void rt_write_json(const char *filename,
>  	fprintf(f, "  \"rt_test_version:\": \"%1.2f\",\n", VERSION);
>  	fprintf(f, "  \"start_time\": \"%s\",\n", ts_start);
>  	fprintf(f, "  \"end_time\": \"%s\",\n", ts_end);
> +	fprintf(f, "  \"return_code\": %d,\n", return_code);
>  	fprintf(f, "  \"sysinfo\": {\n");
>  	fprintf(f, "    \"sysname\": \"%s\",\n", uts.sysname);
>  	fprintf(f, "    \"nodename\": \"%s\",\n", uts.nodename);
> @@ -579,9 +580,13 @@ void rt_write_json(const char *filename,
>  	fprintf(f, "    \"version\": \"%s\",\n", uts.version);
>  	fprintf(f, "    \"machine\": \"%s\",\n", uts.machine);
>  	fprintf(f, "    \"realtime\": %d\n", rt);
> -	fprintf(f, "  },\n");
>  
> -	(cb)(f, data);
> +	if (cb) {
> +		fprintf(f, "  },\n");
> +		(cb)(f, data);
> +	} else {
> +		fprintf(f, "  }\n");
> +	}
>  
>  	fprintf(f, "}\n");
>  
> diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
> index 2f02f5399405..37d528f0f7ff 100644
> --- a/src/oslat/oslat.c
> +++ b/src/oslat/oslat.c
> @@ -863,7 +863,7 @@ int main(int argc, char *argv[])
>  	write_summary(threads);
>  
>  	if (strlen(g.outfile) != 0)
> -		rt_write_json(g.outfile, write_summary_json, threads);
> +		rt_write_json(g.outfile, 0, write_summary_json, threads);
>  
>  	if (g.cpu_list) {
>  		free(g.cpu_list);
> diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
> index adf72c10ce83..af10b416600c 100644
> --- a/src/pmqtest/pmqtest.c
> +++ b/src/pmqtest/pmqtest.c
> @@ -652,7 +652,7 @@ int main(int argc, char *argv[])
>  			.receiver = receiver,
>  			.sender = sender,
>  		};
> -		rt_write_json(outfile, write_stats, &ps);
> +		rt_write_json(outfile, 0, write_stats, &ps);
>  	}
>  
>  nomem:
> diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
> index 471f1b307c14..70eb79e89635 100644
> --- a/src/ptsematest/ptsematest.c
> +++ b/src/ptsematest/ptsematest.c
> @@ -520,7 +520,7 @@ int main(int argc, char *argv[])
>  			.receiver = receiver,
>  			.sender = sender,
>  		};
> -		rt_write_json(outfile, write_stats, &ps);
> +		rt_write_json(outfile, 0, write_stats, &ps);
>  	}
>  
>  nomem:
> diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
> index 8f628d347a23..1e0abdd6c0fa 100644
> --- a/src/rt-migrate-test/rt-migrate-test.c
> +++ b/src/rt-migrate-test/rt-migrate-test.c
> @@ -664,7 +664,7 @@ int main (int argc, char **argv)
>  	print_results();
>  
>  	if (strlen(outfile) != 0)
> -		rt_write_json(outfile, write_stats, NULL);
> +		rt_write_json(outfile, check < 0, write_stats, NULL);
>  
>  	if (stop) {
>  		/*
> diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
> index a649e5a0fe5e..8d801b4c154a 100644
> --- a/src/sched_deadline/cyclicdeadline.c
> +++ b/src/sched_deadline/cyclicdeadline.c
> @@ -1228,7 +1228,7 @@ int main(int argc, char **argv)
>  	}
>  
>  	if (strlen(outfile) != 0)
> -		rt_write_json(outfile, write_stats, sched_data);
> +		rt_write_json(outfile, 0, write_stats, sched_data);
>  
>  	if (setcpu_buf)
>  		free(setcpu_buf);
> diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
> index 7327d0d0144d..f43920e1a853 100644
> --- a/src/signaltest/signaltest.c
> +++ b/src/signaltest/signaltest.c
> @@ -559,7 +559,7 @@ int main(int argc, char **argv)
>  			free(stat[i].values);
>  	}
>  	if (strlen(outfile) != 0)
> -		rt_write_json(outfile, write_stats, par);
> +		rt_write_json(outfile, ret, write_stats, par);
>  
>  	free(stat);
>   outpar:
> diff --git a/src/sigwaittest/sigwaittest.c b/src/sigwaittest/sigwaittest.c
> index 6e8bc7b50d5f..fda44724dd62 100644
> --- a/src/sigwaittest/sigwaittest.c
> +++ b/src/sigwaittest/sigwaittest.c
> @@ -707,7 +707,7 @@ int main(int argc, char *argv[])
>  			.receiver = receiver,
>  			.sender = sender,
>  		};
> -		rt_write_json(outfile, write_stats, &ps);
> +		rt_write_json(outfile, 0, write_stats, &ps);
>  	}
>  
>  nomem:
> diff --git a/src/svsematest/svsematest.c b/src/svsematest/svsematest.c
> index 7533b1b569cc..9485ab6d95c8 100644
> --- a/src/svsematest/svsematest.c
> +++ b/src/svsematest/svsematest.c
> @@ -779,7 +779,7 @@ int main(int argc, char *argv[])
>  			.receiver = receiver,
>  			.sender = sender,
>  		};
> -		rt_write_json(outfile, write_stats, &ps);
> +		rt_write_json(outfile, 0, write_stats, &ps);
>  	}
>  
>  nosem:
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 27/33] pip_stress: Return failure code if test fails
  2021-03-20 18:38 ` [PATCH rt-tests v3 27/33] pip_stress: Return failure code if test fails Daniel Wagner
@ 2021-05-07 16:54   ` John Kacur
  2021-05-12  7:35     ` Daniel Wagner
  0 siblings, 1 reply; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:54 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Let the test return a failure code when the test fails.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/pi_tests/pip_stress.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/pi_tests/pip_stress.c b/src/pi_tests/pip_stress.c
> index 2c3288984202..ed034799da66 100644
> --- a/src/pi_tests/pip_stress.c
> +++ b/src/pi_tests/pip_stress.c
> @@ -160,11 +160,11 @@ int main(int argc, char *argv[])
>  		}
>  	}
>  
> -	if (statep->inversion)
> -		printf("Successfully used priority inheritance to handle an inversion\n");
> -	else
> +	if (!statep->inversion) {
>  		printf("No inversion incurred\n");
> -
> +		exit(1);
> +	}
> +	printf("Successfully used priority inheritance to handle an inversion\n");
>  	exit(0);
>  }
>  
> -- 
> 2.30.2
> 
> 

It isn't really an error if no priority inheritance occurs.
An error from this program would be something like mmap returning an error 
code.

I'm not sure this one is suitable for the json treatment, it's more of a 
demonstration of how to use priority inheritance with processes instead of 
threads. Thomas told me this was possible and I was curious to see if this 
was true, so I scratched that itch. Not sure if it is useful as a test.

Let's leave pip_stress alone for now please

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

* Re: [PATCH rt-tests v3 26/33] pip_stress: Move test result output to main
  2021-03-20 18:38 ` [PATCH rt-tests v3 26/33] pip_stress: Move test result output to main Daniel Wagner
@ 2021-05-07 16:55   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:55 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Instead printing the result high() close directly move it to main()
> function to simplify the return code if the test fails.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/pi_tests/pip_stress.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/src/pi_tests/pip_stress.c b/src/pi_tests/pip_stress.c
> index 8b91578f9ab8..2c3288984202 100644
> --- a/src/pi_tests/pip_stress.c
> +++ b/src/pi_tests/pip_stress.c
> @@ -146,6 +146,7 @@ int main(int argc, char *argv[])
>  		exit(1);
>  	} else if (pid1 != 0) {		/* parent code */
>  		low(pid1);
> +		exit(0);
>  	} else {			/* child code */
>  		pid2 = fork();		/* parent code */
>  		if (pid2 == -1) {
> @@ -155,9 +156,15 @@ int main(int argc, char *argv[])
>  			high(pid2);
>  		} else {			/* child code */
>  			medium();
> +			exit(0);
>  		}
>  	}
>  
> +	if (statep->inversion)
> +		printf("Successfully used priority inheritance to handle an inversion\n");
> +	else
> +		printf("No inversion incurred\n");
> +
>  	exit(0);
>  }
>  
> @@ -222,14 +229,6 @@ void high(pid_t pid)
>  	Pthread_mutex_unlock(resource);
>  	kill(pid, SIGKILL);	/* kill the medium thread */
>  	waitpid(pid, &status, 0);
> -
> -	Pthread_mutex_lock(statep->mutex);
> -
> -	if (statep->inversion)
> -		printf("Successfully used priority inheritance to handle an inversion\n");
> -	else
> -		printf("No inversion incurred\n");
> -	Pthread_mutex_unlock(statep->mutex);
>  }
>  
>  /* mmap a page of anonymous shared memory */
> -- 
> 2.30.2
> 
> 
NAK, see comments in the next patch

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

* Re: [PATCH rt-tests v3 28/33] pip_stress: Prepare arg parser to accept only long options
  2021-03-20 18:38 ` [PATCH rt-tests v3 28/33] pip_stress: Prepare arg parser to accept only long options Daniel Wagner
@ 2021-05-07 16:55   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:55 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Introduce the option value enums to be able to parse only long
> options.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/pi_tests/pip_stress.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/src/pi_tests/pip_stress.c b/src/pi_tests/pip_stress.c
> index ed034799da66..0831f698ff1d 100644
> --- a/src/pi_tests/pip_stress.c
> +++ b/src/pi_tests/pip_stress.c
> @@ -77,6 +77,10 @@ static void usage(int error)
>  	exit(error);
>  }
>  
> +enum option_values {
> +	OPT_HELP=1
> +};
> +
>  int main(int argc, char *argv[])
>  {
>  	void *mptr;	/* memory pointer */
> @@ -87,14 +91,15 @@ int main(int argc, char *argv[])
>  
>  	for (;;) {
>  		struct option long_options[] = {
> -			{ "help",	no_argument,		NULL,	'h' },
> -			{ NULL,		0,			NULL,	0 },
> +			{"help",	no_argument,		NULL, OPT_HELP},
> +			{NULL,		0,			NULL, 0}
>  		};
>  
> -		int c = getopt_long(argc, argv, "s:h", long_options, NULL);
> +		int c = getopt_long(argc, argv, "h", long_options, NULL);
>  		if (c == -1)
>  			break;
>  		switch (c) {
> +		case OPT_HELP:
>  		case 'h':
>  			usage(0);
>  			break;
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 29/33] pip_stress: Add JSON output feature
  2021-03-20 18:38 ` [PATCH rt-tests v3 29/33] pip_stress: Add JSON output feature Daniel Wagner
@ 2021-05-07 16:58   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:58 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Write the test results as JSON output to a file. This allows to
> simplifies any parsing later on.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/pi_tests/pip_stress.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/src/pi_tests/pip_stress.c b/src/pi_tests/pip_stress.c
> index 0831f698ff1d..f6096a2de273 100644
> --- a/src/pi_tests/pip_stress.c
> +++ b/src/pi_tests/pip_stress.c
> @@ -67,18 +67,21 @@ struct State *statep;
>  const int policy = SCHED_FIFO;
>  static int prio_min;	/* Initialized for the minimum priority of policy */
>  
> +static char outfile[MAX_PATH];
> +
>  static void usage(int error)
>  {
>  	printf("pip_stress V %1.2f\n", VERSION);
>  	printf("Usage:\n"
>  	       "pip_stress <options>\n"\
> -	       "-h	--help                  Show this help menu.\n"
> +	       "-h	 --help            Show this help menu.\n"
> +	       "         --output=FILENAME write final results into FILENAME, JSON formatted\n"
>  	       );
>  	exit(error);
>  }
>  
>  enum option_values {
> -	OPT_HELP=1
> +	OPT_HELP=1, OPT_OUTPUT,
>  };
>  
>  int main(int argc, char *argv[])
> @@ -89,9 +92,11 @@ int main(int argc, char *argv[])
>  	int res;
>  	int *minimum_priority = (int*)&prio_min;
>  
> +	rt_init(argc, argv);
>  	for (;;) {
>  		struct option long_options[] = {
>  			{"help",	no_argument,		NULL, OPT_HELP},
> +			{"output",	required_argument,	NULL, OPT_OUTPUT },
>  			{NULL,		0,			NULL, 0}
>  		};
>  
> @@ -103,6 +108,9 @@ int main(int argc, char *argv[])
>  		case 'h':
>  			usage(0);
>  			break;
> +		case OPT_OUTPUT:
> +			strncpy(outfile, optarg, strnlen(optarg, MAX_PATH-1));
> +			break;
>  		default:
>  			usage(1);
>  			break;
> @@ -145,6 +153,7 @@ int main(int argc, char *argv[])
>  		err_exit(err, NULL);
>  	}
>  
> +	rt_test_start();
>  	pid1 = fork();
>  	if (pid1 == -1) {
>  		perror("fork");
> @@ -165,6 +174,9 @@ int main(int argc, char *argv[])
>  		}
>  	}
>  
> +	if (strlen(outfile) != 0)
> +		rt_write_json(outfile, !statep->inversion, NULL, NULL);
> +
>  	if (!statep->inversion) {
>  		printf("No inversion incurred\n");
>  		exit(1);
> -- 
> 2.30.2
> 
> 

I'm not opposed to json in this test in general, but need to think more 
about how this should look. Omiting for now, but I might be amendable in 
the future.

thanks

John

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

* Re: [PATCH rt-tests v3 30/33] pi_stress: Prepare command line parser for long options only
  2021-03-20 18:38 ` [PATCH rt-tests v3 30/33] pi_stress: Prepare command line parser for long options only Daniel Wagner
@ 2021-05-07 16:58   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:58 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Introduce option value enums in order to be able to parse long options
> only.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/pi_tests/pi_stress.c | 45 ++++++++++++++++++++++++++++------------
>  1 file changed, 32 insertions(+), 13 deletions(-)
> 
> diff --git a/src/pi_tests/pi_stress.c b/src/pi_tests/pi_stress.c
> index 49f89b7b0136..73f0e6a402e3 100644
> --- a/src/pi_tests/pi_stress.c
> +++ b/src/pi_tests/pi_stress.c
> @@ -1274,23 +1274,29 @@ int process_sched_line(const char *arg)
>  	return retval;
>  }
>  
> +enum option_values {
> +	OPT_DEBUG=1, OPT_DURATION, OPT_GROUPS, OPT_HELP, OPT_INVERSIONS,
> +	OPT_MLOCKALL, OPT_PROMPT, OPT_QUIET, OPT_RR, OPT_SCHED,
> +	OPT_UNIPROCESSOR, OPT_VERBOSE, OPT_VERSION,
> +};
> +
>  void process_command_line(int argc, char **argv)
>  {
>  	for (;;) {
>  		struct option options[] = {
> -			{"debug",		no_argument,		NULL, 'd'},
> -			{"duration",		required_argument,	NULL, 'D'},
> -			{"groups",		required_argument,	NULL, 'g'},
> -			{"help",		no_argument,		NULL, 'h'},
> -			{"inversions",		required_argument,	NULL, 'i'},
> -			{"mlockall",		no_argument,		NULL, 'm'},
> -			{"prompt",		no_argument,		NULL, 'p'},
> -			{"quiet",		no_argument,		NULL, 'q'},
> -			{"rr",			no_argument,		NULL, 'r'},
> -			{"sched",		required_argument,	NULL, 's'},
> -			{"uniprocessor",	no_argument,		NULL, 'u'},
> -			{"verbose",		no_argument,		NULL, 'v'},
> -			{"version",		no_argument,		NULL, 'V'},
> +			{"debug",		no_argument,		NULL, OPT_DEBUG},
> +			{"duration",		required_argument,	NULL, OPT_DURATION},
> +			{"groups",		required_argument,	NULL, OPT_GROUPS},
> +			{"help",		no_argument,		NULL, OPT_HELP},
> +			{"inversions",		required_argument,	NULL, OPT_INVERSIONS},
> +			{"mlockall",		no_argument,		NULL, OPT_MLOCKALL},
> +			{"prompt",		no_argument,		NULL, OPT_PROMPT},
> +			{"quiet",		no_argument,		NULL, OPT_QUIET},
> +			{"rr",			no_argument,		NULL, OPT_RR},
> +			{"sched",		required_argument,	NULL, OPT_SCHED},
> +			{"uniprocessor",	no_argument,		NULL, OPT_UNIPROCESSOR},
> +			{"verbose",		no_argument,		NULL, OPT_VERBOSE},
> +			{"version",		no_argument,		NULL, OPT_VERSION},
>  			{NULL, 0, NULL, 0},
>  		};
>  
> @@ -1298,12 +1304,15 @@ void process_command_line(int argc, char **argv)
>  		if (c == -1)
>  			break;
>  		switch (c) {
> +		case OPT_DEBUG:
>  		case 'd':
>  			debugging = 1;
>  			break;
> +		case OPT_DURATION:
>  		case 'D':
>  			duration = parse_time_string(optarg);
>  			break;
> +		case OPT_GROUPS:
>  		case 'g':
>  			ngroups = strtol(optarg, NULL, 10);
>  			if (ngroups > num_processors) {
> @@ -1314,37 +1323,47 @@ void process_command_line(int argc, char **argv)
>  			}
>  			pi_info("number of groups set to %d\n", ngroups);
>  			break;
> +		case OPT_HELP:
>  		case 'h':
>  			usage(0);
>  			break;
> +		case OPT_INVERSIONS:
>  		case 'i':
>  			inversions = strtol(optarg, NULL, 10);
>  			pi_info("doing %d inversion per group\n", inversions);
>  			break;
> +		case OPT_MLOCKALL:
>  		case 'm':
>  			lockall = 1;
>  			break;
> +		case OPT_PROMPT:
>  		case 'p':
>  			prompt = 1;
>  			break;
> +		case OPT_QUIET:
>  		case 'q':
>  			verbose = 0;
>  			quiet = 1;
>  			break;
> +		case OPT_RR:
>  		case 'r':
>  			policy = SCHED_RR;
>  			break;
> +		case OPT_SCHED:
>  		case 's':
>  			if (process_sched_line(optarg))
>  				pi_error("ignoring invalid options '%s'\n", optarg);
>  			break;
> +		case OPT_UNIPROCESSOR:
>  		case 'u':
>  			uniprocessor = 1;
>  			break;
> +		case OPT_VERBOSE:
>  		case 'v':
>  			verbose = 1;
>  			quiet = 0;
>  			break;
> +		case OPT_VERSION:
>  		case 'V':
>  			printf("pi_stress v%1.2f ", VERSION);
>  			exit(0);
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 31/33] pi_stress: Add JSON output feature
  2021-03-20 18:38 ` [PATCH rt-tests v3 31/33] pi_stress: Add JSON output feature Daniel Wagner
@ 2021-05-07 16:59   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 16:59 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Write the test results as JSON output to a file. This allows to
> simplifies any parsing later on.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/pi_tests/pi_stress.c | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/src/pi_tests/pi_stress.c b/src/pi_tests/pi_stress.c
> index 73f0e6a402e3..3f93d4aadd53 100644
> --- a/src/pi_tests/pi_stress.c
> +++ b/src/pi_tests/pi_stress.c
> @@ -99,6 +99,9 @@ int debugging = 0;
>  
>  int quiet = 0;	/* turn off all prints, default = 0 (off) */
>  
> +/* filename for JSON output */
> +char outfile[MAX_PATH];
> +
>  /* prompt to start test */
>  int prompt = 0;
>  
> @@ -209,6 +212,7 @@ int create_group(struct group_parameters *group);
>  unsigned long total_inversions(void);
>  void banner(void);
>  void summary(void);
> +void write_stats(FILE *f, void *data);
>  void wait_for_termination(void);
>  int barrier_init(pthread_barrier_t *b, const pthread_barrierattr_t *attr,
>  		 unsigned int count, const char *name);
> @@ -235,6 +239,7 @@ int main(int argc, char **argv)
>  
>  
>  	/* process command line arguments */
> +	rt_init(argc, argv);
>  	process_command_line(argc, argv);
>  
>  	/* set default sched attributes */
> @@ -299,6 +304,7 @@ int main(int argc, char **argv)
>  	}
>  	/* report */
>  	banner();
> +	rt_test_start();
>  	start = time(NULL);
>  
>  	/* turn loose the threads */
> @@ -335,6 +341,10 @@ int main(int argc, char **argv)
>  		kill(0, SIGTERM);
>  	finish = time(NULL);
>  	summary();
> +
> +	if (strlen(outfile) != 0)
> +		rt_write_json(outfile, retval, write_stats, NULL);
> +
>  	if (lockall)
>  		munlockall();
>  	exit(retval);
> @@ -983,6 +993,7 @@ void usage(int error)
>  	       "-h       --help            print this message\n"
>  	       "-i INV   --inversions=INV  number of inversions per group (default is infinite)\n"
>  	       "-m       --mlockall        lock current and future memory\n"
> +	       "         --output=FILENAME write final results into FILENAME, JSON formatted\n"
>  	       "-p       --prompt          prompt before starting the test\n"
>  	       "-q       --quiet           suppress running output\n"
>  	       "-r       --rr              use SCHED_RR for test threads [SCHED_FIFO]\n"
> @@ -1276,7 +1287,7 @@ int process_sched_line(const char *arg)
>  
>  enum option_values {
>  	OPT_DEBUG=1, OPT_DURATION, OPT_GROUPS, OPT_HELP, OPT_INVERSIONS,
> -	OPT_MLOCKALL, OPT_PROMPT, OPT_QUIET, OPT_RR, OPT_SCHED,
> +	OPT_MLOCKALL, OPT_OUTPUT, OPT_PROMPT, OPT_QUIET, OPT_RR, OPT_SCHED,
>  	OPT_UNIPROCESSOR, OPT_VERBOSE, OPT_VERSION,
>  };
>  
> @@ -1290,6 +1301,7 @@ void process_command_line(int argc, char **argv)
>  			{"help",		no_argument,		NULL, OPT_HELP},
>  			{"inversions",		required_argument,	NULL, OPT_INVERSIONS},
>  			{"mlockall",		no_argument,		NULL, OPT_MLOCKALL},
> +			{"output",		required_argument,	NULL, OPT_OUTPUT},
>  			{"prompt",		no_argument,		NULL, OPT_PROMPT},
>  			{"quiet",		no_argument,		NULL, OPT_QUIET},
>  			{"rr",			no_argument,		NULL, OPT_RR},
> @@ -1336,6 +1348,9 @@ void process_command_line(int argc, char **argv)
>  		case 'm':
>  			lockall = 1;
>  			break;
> +		case OPT_OUTPUT:
> +			strncpy(outfile, optarg, strnlen(optarg, MAX_PATH-1));
> +			break;
>  		case OPT_PROMPT:
>  		case 'p':
>  			prompt = 1;
> @@ -1439,6 +1454,11 @@ void summary(void)
>  	       t->tm_yday, t->tm_hour, t->tm_min, t->tm_sec);
>  }
>  
> +void write_stats(FILE *f, void *data)
> +{
> +	fprintf(f, "  \"inversion\": %lu\n", total_inversions());
> +}
> +
>  int
>  barrier_init(pthread_barrier_t *b, const pthread_barrierattr_t *attr,
>  	     unsigned int count, const char *name)
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 32/33] ssdd: Add quiet command line option
  2021-03-20 18:38 ` [PATCH rt-tests v3 32/33] ssdd: Add quiet command line option Daniel Wagner
@ 2021-05-07 17:00   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 17:00 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> The quiet option is useful for automated test setups where
> only the final result of the run is interesting.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/ssdd/ssdd.c | 29 ++++++++++++++++++++---------
>  1 file changed, 20 insertions(+), 9 deletions(-)
> 
> diff --git a/src/ssdd/ssdd.c b/src/ssdd/ssdd.c
> index 9fa61f39f6e3..50bec824b2e8 100644
> --- a/src/ssdd/ssdd.c
> +++ b/src/ssdd/ssdd.c
> @@ -64,9 +64,11 @@ static const char *get_state_name(int state)
>  
>  #define unused __attribute__((unused))
>  
> +static int quiet;
> +
>  static int got_sigchld;
>  
> -enum option_value { OPT_NFORKS=1, OPT_NITERS, OPT_HELP };
> +enum option_value { OPT_NFORKS=1, OPT_NITERS, OPT_HELP, OPT_QUIET };
>  
>  static void usage(int error)
>  {
> @@ -75,6 +77,7 @@ static void usage(int error)
>  	       "ssdd <options>\n\n"
>  	       "-f       --forks=NUM       number of forks\n"
>  	       "-h       --help            print this message\n"
> +	       "-q       --quiet           suppress running output\n"
>  	       "-i       --iters=NUM       number of iterations\n"
>  	       );
>  	exit(error);
> @@ -176,7 +179,8 @@ static int forktests(int testid)
>  	if (!child)
>  		child_process();
>  
> -	printf("forktest#%d/%d/%d: STARTING\n", testid, parent, child);
> +	if (!quiet)
> +		printf("forktest#%d/%d/%d: STARTING\n", testid, parent, child);
>  
>  	act.sa_sigaction = sigchld;
>  	sigemptyset(&act.sa_mask);
> @@ -278,8 +282,8 @@ static int forktests(int testid)
>  	/* There is no need for the tracer to kill the tracee. It will
>  	 * automatically exit when its owner, ie, us, exits.
>  	 */
> -
> -	printf("forktest#%d/%d: EXITING, no error\n", testid, parent);
> +	if (!quiet)
> +		printf("forktest#%d/%d: EXITING, no error\n", testid, parent);
>  	exit(0);
>  }
>  
> @@ -297,10 +301,11 @@ int main(int argc, char **argv)
>  		static struct option long_options[] = {
>  			{"forks",		required_argument,	NULL, OPT_NFORKS},
>  			{"help",		no_argument,		NULL, OPT_HELP},
> +			{"quiet",		no_argument,		NULL, OPT_QUIET},
>  			{"iters",		required_argument,	NULL, OPT_NITERS},
>  			{NULL, 0, NULL, 0},
>  		};
> -		int c = getopt_long(argc, argv, "f:hi:", long_options, &option_index);
> +		int c = getopt_long(argc, argv, "f:hqi:", long_options, &option_index);
>  		if (c == -1)
>  			break;
>  		switch(c) {
> @@ -312,6 +317,10 @@ int main(int argc, char **argv)
>  		case OPT_HELP:
>  			usage(0);
>  			break;
> +		case OPT_QUIET:
> +		case 'q':
> +			quiet = 1;
> +			break;
>  		case 'i':
>  		case OPT_NITERS:
>  			nsteps = atoi(optarg);
> @@ -322,10 +331,12 @@ int main(int argc, char **argv)
>  		}
>  	}
>  
> -	printf("#main : %d\n", getpid());
> -	printf("#forks: %d\n", nforks);
> -	printf("#steps: %d\n", nsteps);
> -	printf("\n");
> +	if (!quiet) {
> +		printf("#main : %d\n", getpid());
> +		printf("#forks: %d\n", nforks);
> +		printf("#steps: %d\n", nsteps);
> +		printf("\n");
> +	}
>  
>  	for (i = 0; i < nforks; i++) {
>  		child = fork();
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 33/33] ssdd: Add JSON output feature
  2021-03-20 18:38 ` [PATCH rt-tests v3 33/33] ssdd: Add JSON output feature Daniel Wagner
@ 2021-05-07 17:00   ` John Kacur
  0 siblings, 0 replies; 73+ messages in thread
From: John Kacur @ 2021-05-07 17:00 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Clark Williams, linux-rt-users



On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Write the test results as JSON output to a file. This allows to
> simplifies any parsing later on.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/ssdd/ssdd.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/src/ssdd/ssdd.c b/src/ssdd/ssdd.c
> index 50bec824b2e8..3ead14d0127e 100644
> --- a/src/ssdd/ssdd.c
> +++ b/src/ssdd/ssdd.c
> @@ -36,6 +36,8 @@
>  #include <sys/wait.h>
>  #include <sys/ptrace.h>
>  
> +#include "rt-utils.h"
> +
>  /* do_wait return values */
>  #define STATE_EXITED	1
>  #define STATE_STOPPED	2
> @@ -65,10 +67,11 @@ static const char *get_state_name(int state)
>  #define unused __attribute__((unused))
>  
>  static int quiet;
> +static char outfile[MAX_PATH];
>  
>  static int got_sigchld;
>  
> -enum option_value { OPT_NFORKS=1, OPT_NITERS, OPT_HELP, OPT_QUIET };
> +enum option_value { OPT_NFORKS=1, OPT_NITERS, OPT_HELP, OPT_OUTPUT, OPT_QUIET };
>  
>  static void usage(int error)
>  {
> @@ -77,6 +80,7 @@ static void usage(int error)
>  	       "ssdd <options>\n\n"
>  	       "-f       --forks=NUM       number of forks\n"
>  	       "-h       --help            print this message\n"
> +	       "         --output=FILENAME write final results into FILENAME, JSON formatted\n"
>  	       "-q       --quiet           suppress running output\n"
>  	       "-i       --iters=NUM       number of iterations\n"
>  	       );
> @@ -295,12 +299,14 @@ int main(int argc, char **argv)
>  
>  	setbuf(stdout, NULL);
>  
> +	rt_init(argc, argv);
>  	for (;;) {
>  		int option_index = 0;
>  
>  		static struct option long_options[] = {
>  			{"forks",		required_argument,	NULL, OPT_NFORKS},
>  			{"help",		no_argument,		NULL, OPT_HELP},
> +			{"output",		required_argument,	NULL, OPT_OUTPUT},
>  			{"quiet",		no_argument,		NULL, OPT_QUIET},
>  			{"iters",		required_argument,	NULL, OPT_NITERS},
>  			{NULL, 0, NULL, 0},
> @@ -317,6 +323,9 @@ int main(int argc, char **argv)
>  		case OPT_HELP:
>  			usage(0);
>  			break;
> +		case OPT_OUTPUT:
> +			strncpy(outfile, optarg, strnlen(optarg, MAX_PATH-1));
> +			break;
>  		case OPT_QUIET:
>  		case 'q':
>  			quiet = 1;
> @@ -348,6 +357,7 @@ int main(int argc, char **argv)
>  			forktests(i);
>  	}
>  
> +	rt_test_start();
>  	for (i = 0; i < nforks; i++) {
>  		status = do_wait(&wait_pid, &ret_sig);
>  		if (status != STATE_EXITED) {
> @@ -363,5 +373,9 @@ int main(int argc, char **argv)
>  	printf("%s.\n", error ?
>  		"One or more tests FAILED" :
>  		"All tests PASSED");
> +
> +	if (strlen(outfile) != 0)
> +		rt_write_json(outfile, error, NULL, NULL);
> +
>  	exit(error);
>  }
> -- 
> 2.30.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

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

* Re: [PATCH rt-tests v3 04/33] rt-util: Add rt_init function
  2021-05-07 16:27   ` John Kacur
@ 2021-05-12  7:30     ` Daniel Wagner
  0 siblings, 0 replies; 73+ messages in thread
From: Daniel Wagner @ 2021-05-12  7:30 UTC (permalink / raw)
  To: John Kacur; +Cc: Daniel Wagner, Clark Williams, linux-rt-users

On Fri, May 07, 2021 at 12:27:53PM -0400, John Kacur wrote:
> But I don't like the name, it's not initing any test state, it's copying 
> the command line, and the name should reflect that.

I went for rt_init() because rt_test_start() code was part of
it. But without this part we could name it something like:

   rt_{copy|save|store}_{cmdline|args}

What's your preference?

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

* Re: [PATCH rt-tests v3 15/33] rt-util: Introduce rt_test_start()
  2021-05-07 16:40   ` John Kacur
@ 2021-05-12  7:33     ` Daniel Wagner
  0 siblings, 0 replies; 73+ messages in thread
From: Daniel Wagner @ 2021-05-12  7:33 UTC (permalink / raw)
  To: John Kacur; +Cc: Daniel Wagner, Clark Williams, linux-rt-users

On Fri, May 07, 2021 at 12:40:20PM -0400, John Kacur wrote:
> I don't really like this. I think it looks "good" in the json output, but
> I don't think it is providing any kind of meaningful data. My fear is that 
> users will try to assign some kind of significance to these numbers in 
> relation to the tests.

The idea is that you are able to compare timestamps in the further logs
and see if anything is out of the ordinary is logged when the test was
executed.

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

* Re: [PATCH rt-tests v3 27/33] pip_stress: Return failure code if test fails
  2021-05-07 16:54   ` John Kacur
@ 2021-05-12  7:35     ` Daniel Wagner
  2021-05-13 19:27       ` John Kacur
  0 siblings, 1 reply; 73+ messages in thread
From: Daniel Wagner @ 2021-05-12  7:35 UTC (permalink / raw)
  To: John Kacur; +Cc: Daniel Wagner, Clark Williams, linux-rt-users

> It isn't really an error if no priority inheritance occurs.
> An error from this program would be something like mmap returning an error 
> code.
> 
> I'm not sure this one is suitable for the json treatment, it's more of a 
> demonstration of how to use priority inheritance with processes instead of 
> threads. Thomas told me this was possible and I was curious to see if this 
> was true, so I scratched that itch. Not sure if it is useful as a test.
> 
> Let's leave pip_stress alone for now please

If it's a for demonstration purposes only, could we remove it from the
source tree? I don't think it should be left there if it's not
considered a proper test.

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

* Re: [PATCH rt-tests v3 27/33] pip_stress: Return failure code if test fails
  2021-05-12  7:35     ` Daniel Wagner
@ 2021-05-13 19:27       ` John Kacur
  2021-05-14  6:58         ` Daniel Wagner
  0 siblings, 1 reply; 73+ messages in thread
From: John Kacur @ 2021-05-13 19:27 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: Daniel Wagner, Clark Williams, linux-rt-users

On Wed, May 12, 2021 at 3:36 AM Daniel Wagner <wagi@monom.org> wrote:
>
> > It isn't really an error if no priority inheritance occurs.
> > An error from this program would be something like mmap returning an error
> > code.
> >
> > I'm not sure this one is suitable for the json treatment, it's more of a
> > demonstration of how to use priority inheritance with processes instead of
> > threads. Thomas told me this was possible and I was curious to see if this
> > was true, so I scratched that itch. Not sure if it is useful as a test.
> >
> > Let's leave pip_stress alone for now please
>
> If it's a for demonstration purposes only, could we remove it from the
> source tree? I don't think it should be left there if it's not
> considered a proper test.
>

I suppose this is a fair question, although another question would be
is it useful in the rt-tests suites for other reasons?
It could be used as the "engine" of a test that would be similar to
pi_stress, with a different kind of mechanism.

So then the question would be, is there a value in another pi_stress
like test that avoids pthreads?
If so, I could work it up into a test.

John


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

* Re: [PATCH rt-tests v3 27/33] pip_stress: Return failure code if test fails
  2021-05-13 19:27       ` John Kacur
@ 2021-05-14  6:58         ` Daniel Wagner
  0 siblings, 0 replies; 73+ messages in thread
From: Daniel Wagner @ 2021-05-14  6:58 UTC (permalink / raw)
  To: John Kacur; +Cc: Daniel Wagner, Clark Williams, linux-rt-users

On Thu, May 13, 2021 at 03:27:31PM -0400, John Kacur wrote:
> I suppose this is a fair question, although another question would be
> is it useful in the rt-tests suites for other reasons?
> It could be used as the "engine" of a test that would be similar to
> pi_stress, with a different kind of mechanism.

If there is clear indication which code is provided as coding example
and which is a RT test it would already help. I was under the impression
pi_stress tries to test RT behavior. Maybe moving pi_stress to
'examples' would already be enough.

> So then the question would be, is there a value in another pi_stress
> like test that avoids pthreads?
>
> If so, I could work it up into a test.

I suppose having more RT tests is good thing. IIRC there are more RT
tests available, e.g. in LTP. So not sure if this is not already covered
somewhere else.

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

end of thread, back to index

Thread overview: 73+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-20 18:37 [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated Daniel Wagner
2021-03-20 18:37 ` [PATCH rt-tests v3 01/33] cyclictest: Remove unused include header Daniel Wagner
2021-05-07 16:17   ` John Kacur
2021-03-20 18:37 ` [PATCH rt-tests v3 02/33] cyclicdeadline: " Daniel Wagner
2021-05-07 16:19   ` John Kacur
2021-03-20 18:37 ` [PATCH rt-tests v3 03/33] signaltest: Add missing --output usage info Daniel Wagner
2021-05-07 16:26   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 04/33] rt-util: Add rt_init function Daniel Wagner
2021-05-07 16:27   ` John Kacur
2021-05-12  7:30     ` Daniel Wagner
2021-03-20 18:38 ` [PATCH rt-tests v3 05/33] cyclictest: Initialize rt-util Daniel Wagner
2021-05-07 16:28   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 06/33] oslat: " Daniel Wagner
2021-05-07 16:29   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 07/33] pmqtest: " Daniel Wagner
2021-05-07 16:29   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 08/33] ptsematest: " Daniel Wagner
2021-05-07 16:30   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 09/33] rt-migrate-test: " Daniel Wagner
2021-05-07 16:31   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 10/33] cyclicdeadline: " Daniel Wagner
2021-05-07 16:31   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 11/33] signaltest: " Daniel Wagner
2021-05-07 16:32   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 12/33] sigwaittest: " Daniel Wagner
2021-05-07 16:33   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 13/33] svematest: " Daniel Wagner
2021-05-07 16:34   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 14/33] rt-util: Remove superfluous arguments from rt_write_json Daniel Wagner
2021-05-07 16:36   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 15/33] rt-util: Introduce rt_test_start() Daniel Wagner
2021-05-07 16:40   ` John Kacur
2021-05-12  7:33     ` Daniel Wagner
2021-03-20 18:38 ` [PATCH rt-tests v3 16/33] cyclictest: Record start of test execution Daniel Wagner
2021-05-07 16:41   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 17/33] oslat: " Daniel Wagner
2021-05-07 16:41   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 18/33] pmqtest: " Daniel Wagner
2021-05-07 16:43   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 19/33] ptesematest: " Daniel Wagner
2021-05-07 16:43   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 20/33] rt-migrate-test: " Daniel Wagner
2021-05-07 16:44   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 21/33] cyclicdeadline: " Daniel Wagner
2021-05-07 16:45   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 22/33] signaltest: " Daniel Wagner
2021-05-07 16:45   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 23/33] sigwaittest: " Daniel Wagner
2021-05-07 16:46   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 24/33] svsematest: " Daniel Wagner
2021-05-07 16:46   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 25/33] rt-util: Add return_code to common section of JSON output Daniel Wagner
2021-05-07 16:49   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 26/33] pip_stress: Move test result output to main Daniel Wagner
2021-05-07 16:55   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 27/33] pip_stress: Return failure code if test fails Daniel Wagner
2021-05-07 16:54   ` John Kacur
2021-05-12  7:35     ` Daniel Wagner
2021-05-13 19:27       ` John Kacur
2021-05-14  6:58         ` Daniel Wagner
2021-03-20 18:38 ` [PATCH rt-tests v3 28/33] pip_stress: Prepare arg parser to accept only long options Daniel Wagner
2021-05-07 16:55   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 29/33] pip_stress: Add JSON output feature Daniel Wagner
2021-05-07 16:58   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 30/33] pi_stress: Prepare command line parser for long options only Daniel Wagner
2021-05-07 16:58   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 31/33] pi_stress: Add JSON output feature Daniel Wagner
2021-05-07 16:59   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 32/33] ssdd: Add quiet command line option Daniel Wagner
2021-05-07 17:00   ` John Kacur
2021-03-20 18:38 ` [PATCH rt-tests v3 33/33] ssdd: Add JSON output feature Daniel Wagner
2021-05-07 17:00   ` John Kacur
2021-03-22 15:50 ` [PATCH rt-tests v3 00/33] JSON cleanups and more tests updated John Kacur

Linux-rt-users Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rt-users/0 linux-rt-users/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rt-users linux-rt-users/ https://lore.kernel.org/linux-rt-users \
		linux-rt-users@vger.kernel.org
	public-inbox-index linux-rt-users

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rt-users


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git