From 381389639e0b4b9956b65c53c6794c149cd99990 Mon Sep 17 00:00:00 2001 From: Rodrigo Reichert Date: Wed, 9 Jun 2021 08:21:57 +1000 Subject: [PATCH 1/3] SV4-144 update googleflags (#83) --- FindGFlags.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/FindGFlags.cmake b/FindGFlags.cmake index 5e6973a..557d98d 100644 --- a/FindGFlags.cmake +++ b/FindGFlags.cmake @@ -1,4 +1,5 @@ include("GenericFindDependency") +option(GFLAGS_STRIP_INTERNAL_FLAG_HELP "Hide help from GFLAGS modules" true) GenericFindDependency( TARGET gflags SOURCE_DIR "googleflags" From 2053cbd1ce36c1b33a6802550c40a23a41137d4e Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Mon, 21 Jun 2021 09:04:49 +0800 Subject: [PATCH 2/3] scripts: Fix flakes `sys` was unused. Also tabs were used in memcheck_xml2junit_converter.py --- scripts/memcheck_xml2junit_converter.py | 8 ++++---- scripts/parse_bloaty.py | 6 +++--- scripts/parse_heaptrack.py | 8 +++++--- scripts/parse_stackusage.py | 6 +++--- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/scripts/memcheck_xml2junit_converter.py b/scripts/memcheck_xml2junit_converter.py index 1abbcb2..3f8be09 100644 --- a/scripts/memcheck_xml2junit_converter.py +++ b/scripts/memcheck_xml2junit_converter.py @@ -26,11 +26,12 @@ # * -o, --output_directory: Defines the output folder where the converted JUnit # xml files are collected. # * -s, --skip_tests: Error elements in a Valgrind Memcheck xml file are -# replaced by a skipped message type in the converted +# replaced by a skipped message type in the converted # JUnit xml file. # +import argparse +import os import xml.etree.ElementTree as ET -import sys, os, argparse parser = argparse.ArgumentParser(description='Convert Valgrind Memcheck xml into JUnit xml format.') optional = parser._action_groups.pop() @@ -111,7 +112,7 @@ fn = frame.find('fn') fi = frame.find('file') li = frame.find('line') - if fn != None: + if fn != None: bodytext = fn.text else: bodytext = "unknown function name" @@ -126,4 +127,3 @@ out.write(' \n') out.write('\n') out.close() - diff --git a/scripts/parse_bloaty.py b/scripts/parse_bloaty.py index b33eb90..1326d9e 100644 --- a/scripts/parse_bloaty.py +++ b/scripts/parse_bloaty.py @@ -16,7 +16,8 @@ # * -o, --output_file: Sets the output file path. # * -m, --message: Adds a message to the reported memory usage. # -import sys, argparse +import argparse +import sys parser = argparse.ArgumentParser(description='Log total static memory size reported by Bloaty.') optional = parser._action_groups.pop() @@ -37,7 +38,7 @@ finput = open(args.input_file) foutput = open(args.output_file,"a") except IOError: - exit() + sys.exit() with finput: lines = finput.readlines() @@ -51,4 +52,3 @@ foutput.write(message) finput.close() foutput.close() - diff --git a/scripts/parse_heaptrack.py b/scripts/parse_heaptrack.py index 2e71c16..70362c8 100644 --- a/scripts/parse_heaptrack.py +++ b/scripts/parse_heaptrack.py @@ -18,7 +18,10 @@ # * -o, --output_file: Sets the output file path. # * -m, --message: Adds a message to the reported memory usage. # -import sys, subprocess, re, argparse +import argparse +import re +import subprocess +import sys parser = argparse.ArgumentParser(description='Log peak heap memory consumption reported by Heaptrack.') optional = parser._action_groups.pop() @@ -38,7 +41,7 @@ try: foutput = open(args.output_file,"a") except IOError: - exit() + sys.exit() p_heaptrack_print = subprocess.Popen(['which', 'heaptrack_print'], stdout=subprocess.PIPE) program_path = p_heaptrack_print.stdout.read().rstrip() @@ -57,4 +60,3 @@ break foutput.close() p.terminate() - diff --git a/scripts/parse_stackusage.py b/scripts/parse_stackusage.py index d71f136..fd9b2dd 100644 --- a/scripts/parse_stackusage.py +++ b/scripts/parse_stackusage.py @@ -16,7 +16,8 @@ # * -o, --output_file: Sets the output file path. # * -m, --message: Adds a message to the reported memory usage. # -import sys, argparse +import argparse +import sys parser = argparse.ArgumentParser(description='Log sum of the maximal used stack for all active threads reported by Stackusage.') optional = parser._action_groups.pop() @@ -37,7 +38,7 @@ finput = open(args.input_file) foutput = open(args.output_file,"a") except IOError: - exit() + sys.exit() with finput: lines = finput.readlines() @@ -52,4 +53,3 @@ foutput.write(message) finput.close() foutput.close() - From 373d4fcafbbc0c208dc9ecb278d36ed8c9448eda Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Mon, 21 Jun 2021 09:42:58 +0800 Subject: [PATCH 3/3] memcheck_xml2junit_converter.py: Remove redundancy SonarCloud complains about the repeated string. --- scripts/memcheck_xml2junit_converter.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/memcheck_xml2junit_converter.py b/scripts/memcheck_xml2junit_converter.py index 3f8be09..46250b0 100644 --- a/scripts/memcheck_xml2junit_converter.py +++ b/scripts/memcheck_xml2junit_converter.py @@ -33,6 +33,10 @@ import os import xml.etree.ElementTree as ET +def get_testcase_preamble(name, close=False): + return ' \n'.format(str(name), "/" if close else "") + + parser = argparse.ArgumentParser(description='Convert Valgrind Memcheck xml into JUnit xml format.') optional = parser._action_groups.pop() required = parser.add_argument_group('required arguments') @@ -79,7 +83,7 @@ out.write('\n') if len(errors) == 0: out.write('\n') - out.write(' \n') + out.write(get_testcase_preamble(filename, close=True)) else: out.write('\n') errorcount=0 @@ -101,9 +105,9 @@ break if fi != None and li != None: - out.write(' \n') + out.write(get_testcase_preamble("{} {} ({}, {}:{})".format(str(filename), errorcount, kind.text, fi.text, li.text))) else: - out.write(' \n') + out.write(get_testcase_preamble("{} {} ({})".format(str(filename), errorcount, kind.text))) out.write(' <'+test_type+' type="'+kind.text+'">\n') out.write(' '+what.text+'\n\n')