diff --git a/tools/donate-cpu-server.py b/tools/donate-cpu-server.py index 296281434e3..600f0eef91f 100755 --- a/tools/donate-cpu-server.py +++ b/tools/donate-cpu-server.py @@ -25,7 +25,7 @@ # Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/ # Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic # changes) -SERVER_VERSION = "1.3.27" +SERVER_VERSION = "1.3.28" OLD_VERSION = '2.9' @@ -78,11 +78,12 @@ def overviewReport() -> str: html += 'Time report (improved)
\n' html += 'Time report (regressed)
\n' html += 'Time report (slowest)
\n' + html += '
\n' + html += '--check-library:
\n' html += 'checkLibraryFunction report
\n' html += 'checkLibraryNoReturn report
\n' html += 'checkLibraryUseIgnore report
\n' - # TODO: how to get these messages? - #html += 'checkLibraryCheckType report
\n' + html += 'checkLibraryCheckType report
\n' html += '
\n' html += 'Debug warnings:
\n' html += 'debug
\n' @@ -812,20 +813,26 @@ def timeReportSlow(resultPath: str) -> str: def check_library_report(result_path: str, message_id: str) -> str: - if message_id not in ('checkLibraryNoReturn', 'checkLibraryFunction', 'checkLibraryUseIgnore'): + if message_id not in ('checkLibraryNoReturn', 'checkLibraryFunction', 'checkLibraryUseIgnore', 'checkLibraryCheckType'): error_message = 'Invalid value ' + message_id + ' for message_id parameter.' print(error_message) return error_message - functions_shown_max = 50000 + if message_id == 'checkLibraryCheckType': + metric = 'types' + m_column = 'Type' + else: + metric = 'functions' + m_column = 'Function' + + functions_shown_max = 5000 html = '' + message_id + ' report\n' html += '

' + message_id + ' report

\n' - html += 'Top ' + str(functions_shown_max) + ' functions are shown.' + html += 'Top ' + str(functions_shown_max) + ' ' + metric + ' are shown.' html += '
\n'
     column_widths = [10, 100]
     html += ''
-    html += 'Count'.rjust(column_widths[0]) + ' ' + \
-            'Function'
+    html += 'Count'.rjust(column_widths[0]) + ' ' + m_column
     html += '\n'
 
     function_counts = {}
@@ -848,6 +855,8 @@ def check_library_report(result_path: str, message_id: str) -> str:
             if line.endswith('[' + message_id + ']\n'):
                 if message_id == 'checkLibraryFunction':
                     function_name = line[(line.find('for function ') + len('for function ')):line.rfind('[') - 1]
+                elif message_id == 'checkLibraryCheckType':
+                    function_name = line[(line.find('configuration for ') + len('configuration for ')):line.rfind('[') - 1]
                 else:
                     function_name = line[(line.find(': Function ') + len(': Function ')):line.rfind('should have') - 1]
                 function_counts[function_name] = function_counts.setdefault(function_name, 0) + 1
@@ -868,8 +877,11 @@ def check_library_report(result_path: str, message_id: str) -> str:
 
 # Lists all checkLibrary* messages regarding the given function name
 def check_library_function_name(result_path: str, function_name: str) -> str:
-    print('check_library_function_name')
     function_name = urllib.parse.unquote_plus(function_name)
+    if function_name.endswith('()'):
+        id = '[checkLibrary'
+    else:
+        id = '[checkLibraryCheckType]'
     output_lines_list = []
     for filename in glob.glob(result_path + '/*'):
         if not os.path.isfile(filename) or filename.endswith('.diff'):
@@ -886,8 +898,8 @@ def check_library_function_name(result_path: str, function_name: str) -> str:
                 info_messages = True
             if not info_messages:
                 continue
-            if '[checkLibrary' in line:
-                if (' ' + function_name) in line:
+            if id in line:
+                if (' ' + function_name + ' ') in line:
                     if url:
                         output_lines_list.append(url)
                         url = None
@@ -990,8 +1002,10 @@ def run(self):
             elif url == 'check_library_use_ignore_report.html':
                 text = check_library_report(self.resultPath + '/' + 'info_output', message_id='checkLibraryUseIgnore')
                 httpGetResponse(self.connection, text, 'text/html')
+            elif url == 'check_library_check_type_report.html':
+                text = check_library_report(self.resultPath + '/' + 'info_output', message_id='checkLibraryCheckType')
+                httpGetResponse(self.connection, text, 'text/html')
             elif url.startswith('check_library-'):
-                print('check library function !')
                 function_name = url[len('check_library-'):]
                 text = check_library_function_name(self.resultPath + '/' + 'info_output', function_name)
                 httpGetResponse(self.connection, text, 'text/plain')
@@ -1084,7 +1098,7 @@ def server(server_address_port: int, packages: list, packageIndex: int, resultPa
                         try:
                             text_received = bytes_received.decode('utf-8', 'ignore')
                         except UnicodeDecodeError as e:
-                            print('Error: Decoding failed: ' + str(e))
+                            print('Error: Decoding failed (write): ' + str(e))
                             data = ''
                             break
                         t = 0.0
@@ -1153,7 +1167,7 @@ def server(server_address_port: int, packages: list, packageIndex: int, resultPa
                         try:
                             text_received = bytes_received.decode('utf-8', 'ignore')
                         except UnicodeDecodeError as e:
-                            print('Error: Decoding failed: ' + str(e))
+                            print('Error: Decoding failed (write_info): ' + str(e))
                             data = ''
                             break
                         t = 0.0
diff --git a/tools/donate_cpu_lib.py b/tools/donate_cpu_lib.py
index 713dcf0ff12..ed4198fe945 100644
--- a/tools/donate_cpu_lib.py
+++ b/tools/donate_cpu_lib.py
@@ -15,7 +15,7 @@
 # Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/
 # Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic
 # changes)
-CLIENT_VERSION = "1.3.34"
+CLIENT_VERSION = "1.3.35"
 
 # Timeout for analysis with Cppcheck in seconds
 CPPCHECK_TIMEOUT = 30 * 60