diff mbox series

[2/2] auto-t: don't print valgrind log if there was no error

Message ID 20240724121443.1425256-2-prestwoj@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series [1/2] scan: fix invalid read when canceling an ongoing scan | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success

Commit Message

James Prestwood July 24, 2024, 12:14 p.m. UTC
If valgrind didn't report any issues, don't dump the logs. This
makes the test run a lot easier to look at without having to scroll
through pages of valgrind logs that provide no value.
---
 tools/run-tests | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/tools/run-tests b/tools/run-tests
index fdd0b989..e043965b 100755
--- a/tools/run-tests
+++ b/tools/run-tests
@@ -899,12 +899,18 @@  def post_test(ctx, to_copy):
 
 	if ctx.args.valgrind:
 		for f in os.listdir('/tmp'):
-			if f.startswith("valgrind.log."):
-				dbg(f)
-				with open('/tmp/' + f, 'r') as v:
-					dbg(v.read())
+			if not f.startswith("valgrind.log."):
+				continue
+
+			with open('/tmp/' + f, 'r') as v:
+				result = v.read()
+
+			# Don't print out the result if there were no issues
+			if "0 errors from 0 contexts" not in result:
+				dbg(result)
 				dbg("\n")
-				os.remove('/tmp/' + f)
+
+			os.remove('/tmp/' + f)
 
 	# Special case for when logging is enabled
 	if os.path.isfile('/tmp/iwd-tls-debug-server-cert.pem'):