Skip to content

Commit db3284e

Browse files
authored
donate-cpu-server.py: Fix #9192: Old results are shown in the reports (#1941)
Trac ticket: https://trac.cppcheck.net/ticket/9192 This commit also fixes that negative values of the elapsed time are used for calculating total times. These crashes and errors are now ignored in the time report since there is no useful timing information in that case. Tested with a local daca@home server with old and new results.
1 parent fd3e1ce commit db3284e

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

‎tools/donate-cpu-server.py‎

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/
1919
# Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic
2020
# changes)
21-
SERVER_VERSION = "1.1.2"
21+
SERVER_VERSION = "1.1.3"
2222

2323
OLD_VERSION = '1.88'
2424

@@ -150,6 +150,13 @@ def crashReport():
150150
datestr = ''
151151
for line in open(filename, 'rt'):
152152
line = line.strip()
153+
if line.startswith('cppcheck: '):
154+
if OLD_VERSION not in line:
155+
# Package results seem to be too old, skip
156+
break
157+
else:
158+
# Current package, parse on
159+
continue
153160
if line.startswith(str(current_year) + '-') or line.startswith(str(current_year - 1) + '-'):
154161
datestr = line
155162
if not line.startswith('count:'):
@@ -419,6 +426,13 @@ def headReport(resultsPath):
419426
firstLine = False
420427
continue
421428
line = line.strip()
429+
if line.startswith('cppcheck: '):
430+
if OLD_VERSION not in line:
431+
# Package results seem to be too old, skip
432+
break
433+
else:
434+
# Current package, parse on
435+
continue
422436
if line.startswith('head results:'):
423437
headResults = True
424438
continue
@@ -532,11 +546,21 @@ def timeReport(resultPath):
532546
if not os.path.isfile(filename):
533547
continue
534548
for line in open(filename, 'rt'):
549+
if line.startswith('cppcheck: '):
550+
if OLD_VERSION not in line:
551+
# Package results seem to be too old, skip
552+
break
553+
else:
554+
# Current package, parse on
555+
continue
535556
if not line.startswith('elapsed-time:'):
536557
continue
537558
split_line = line.strip().split()
538559
time_base = float(split_line[2])
539560
time_head = float(split_line[1])
561+
if time_base < 0.0 or time_head < 0.0:
562+
# ignore results with crashes / errors for the time report
563+
break
540564
total_time_base += time_base
541565
total_time_head += time_head
542566
suspicious_time_difference = False
@@ -596,6 +620,13 @@ def check_library_report(result_path, message_id):
596620
continue
597621
info_messages = False
598622
for line in open(filename, 'rt'):
623+
if line.startswith('cppcheck: '):
624+
if OLD_VERSION not in line:
625+
# Package results seem to be too old, skip
626+
break
627+
else:
628+
# Current package, parse on
629+
continue
599630
if line == 'info messages:\n':
600631
info_messages = True
601632
if not info_messages:

0 commit comments

Comments
 (0)