iwd.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] test-runner: write out individual test results
@ 2022-09-30 23:28 James Prestwood
  2022-09-30 23:28 ` [PATCH 2/2] monitor: change Port ID to %u print James Prestwood
  2022-10-03 15:40 ` [PATCH 1/2] test-runner: write out individual test results Denis Kenzior
  0 siblings, 2 replies; 3+ messages in thread
From: James Prestwood @ 2022-09-30 23:28 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

The --results option only wrote PASS/FAIL for the entire run.
Instead write out each individual test result.
---
 tools/run-tests | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/tools/run-tests b/tools/run-tests
index 9620ed1f..32c09723 100755
--- a/tools/run-tests
+++ b/tools/run-tests
@@ -37,6 +37,14 @@ def dbg(*s, **kwargs):
 	'''
 	print(*s, **kwargs, file=sys.__stdout__)
 
+def write_results(file, results):
+	with open(file, 'w') as f:
+		for test, results in results.items():
+			if results.failures != 0 or results.errors != 0:
+				f.write('%s:FAIL\n' % test)
+			else:
+				f.write('%s:PASS\n' % test)
+
 def exit_vm():
 	if config:
 		for p in Process.get_all():
@@ -45,13 +53,9 @@ def exit_vm():
 
 		if config.ctx and config.ctx.results:
 			success = print_results(config.ctx.results)
-		else:
-			success = False
 
-		if config.ctx.args.result:
-			result = 'PASS' if success else 'FAIL'
-			with open(config.ctx.args.result, 'w') as f:
-				f.write(result)
+			if config.ctx.args.result:
+				write_results(config.ctx.args.result, config.ctx.results)
 
 	os.sync()
 
-- 
2.34.3


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

* [PATCH 2/2] monitor: change Port ID to %u print
  2022-09-30 23:28 [PATCH 1/2] test-runner: write out individual test results James Prestwood
@ 2022-09-30 23:28 ` James Prestwood
  2022-10-03 15:40 ` [PATCH 1/2] test-runner: write out individual test results Denis Kenzior
  1 sibling, 0 replies; 3+ messages in thread
From: James Prestwood @ 2022-09-30 23:28 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

The port ID is a u32 so print with %u rather than %d
---
 monitor/nlmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/monitor/nlmon.c b/monitor/nlmon.c
index 5ae014e4..2e232130 100644
--- a/monitor/nlmon.c
+++ b/monitor/nlmon.c
@@ -7952,7 +7952,7 @@ static void print_nlmsghdr(const struct timeval *tv,
 							nlmsg->nlmsg_flags);
 	print_field("Sequence number: %u (0x%08x)",
 					nlmsg->nlmsg_seq, nlmsg->nlmsg_seq);
-	print_field("Port ID: %d", nlmsg->nlmsg_pid);
+	print_field("Port ID: %u", nlmsg->nlmsg_pid);
 }
 
 static void print_nlmsg(const struct timeval *tv, const struct nlmsghdr *nlmsg)
-- 
2.34.3


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

* Re: [PATCH 1/2] test-runner: write out individual test results
  2022-09-30 23:28 [PATCH 1/2] test-runner: write out individual test results James Prestwood
  2022-09-30 23:28 ` [PATCH 2/2] monitor: change Port ID to %u print James Prestwood
@ 2022-10-03 15:40 ` Denis Kenzior
  1 sibling, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2022-10-03 15:40 UTC (permalink / raw)
  To: James Prestwood, iwd

Hi James,

On 9/30/22 18:28, James Prestwood wrote:
> The --results option only wrote PASS/FAIL for the entire run.
> Instead write out each individual test result.
> ---
>   tools/run-tests | 16 ++++++++++------
>   1 file changed, 10 insertions(+), 6 deletions(-)

Both applied, thanks.

Regards,
-Denis


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

end of thread, other threads:[~2022-10-03 15:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-30 23:28 [PATCH 1/2] test-runner: write out individual test results James Prestwood
2022-09-30 23:28 ` [PATCH 2/2] monitor: change Port ID to %u print James Prestwood
2022-10-03 15:40 ` [PATCH 1/2] test-runner: write out individual test results Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).