Skip to content

Commit aff25ba

Browse files
Try to Fix Issues in ACE/TAO Scoreboard
See DOCGroup/scoreboard#8 These changes fix the parsing in the integrated page generator and try to make matrix.py more robust by inserting skipped tests when builds or test results cause an error instead of crashing.
1 parent 1771cd6 commit aff25ba

File tree

2 files changed

+36
-14
lines changed

2 files changed

+36
-14
lines changed

common/integratedparser.pm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use warnings;
66

77
use FileHandle;
88

9+
use common::utility;
10+
911
###############################################################################
1012
# Constructor
1113

@@ -95,6 +97,8 @@ sub Parse ($\@)
9597
# Make the global name null
9698
$global_build_name = '';
9799
}
100+
elsif (utility::parse_prop ($_, {})) { # NOP, just parse it
101+
}
98102
elsif (m/^\s*<group>\s*$/i) {
99103
$state = 'group';
100104
}
@@ -181,6 +185,8 @@ sub Parse ($\@)
181185
elsif (m/^\s*<html>(.*)<\/html>\s*$/i) {
182186
$build_info{HTML} = $1;
183187
}
188+
elsif (utility::parse_prop ($_, {})) { # NOP, just parse it
189+
}
184190
else {
185191
print STDERR "Error: Unexpected in state <$state>: $_\n";
186192
return 0;

testmatrix/matrix.py

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from datetime import timedelta
66
from pathlib import Path
77
from urllib.request import urlopen
8+
from traceback import print_exception
89

910

1011
use_ansi = os.name != 'nt' and sys.stdout.isatty()
@@ -159,16 +160,26 @@ def __str__(self):
159160
return f'{self.name}: time={self.time_str()} result={self.result}'
160161

161162

163+
def print_error(exc, context):
164+
exc.add_note(context)
165+
print_exception(exc)
166+
167+
162168
class Build:
163169
def __init__(self, name, builds_dir, misc=None):
164-
if misc is None:
165-
misc = {}
166170
self.name = name
167171
self.dir = builds_dir / name
168-
self.misc = misc
172+
self.misc = misc or {}
173+
self.basename = self.misc.get('basename')
174+
self.props = self.misc.get('props', {})
175+
self.tests = {}
169176
self.stats = TestStats()
170-
self.basename = misc['basename']
171-
self.props = misc.get('props', {})
177+
178+
if misc is None:
179+
return
180+
181+
if self.basename is None:
182+
raise ValueError(f'Build {name!r} is missing a basename, probably a missing latest.txt')
172183

173184
# Get build.json. It should either exist locally or can be downloaded.
174185
build_json_name = self.basename + '.build.json'
@@ -182,15 +193,20 @@ def __init__(self, name, builds_dir, misc=None):
182193
with urlopen(url) as f:
183194
data = json.load(f)
184195
else:
185-
raise ValueError(f'Can not get {build_json_name} for {name}')
196+
raise ValueError(f'Can not get {build_json_name!r} for {name!r}')
186197

187-
self.tests = {}
188198
for t in data['tests']:
189-
test_run = TestRun(t['name'], int(t['result']), timedelta(seconds=int(t['time'])), t)
190-
self.stats.add(test_run.status, test_run.time)
191-
if test_run.name in self.tests:
192-
raise ValueError(f'Multiple {repr(test_run.name)} in {self.name}!')
193-
self.tests[test_run.name] = test_run
199+
try:
200+
self.add_test_run(t)
201+
except BaseException as e:
202+
print_error(e, f'Test {name!r} in build {name!r} caused this error')
203+
204+
def add_test_run(self, t):
205+
test_run = TestRun(t['name'], int(t['result']), timedelta(seconds=int(t['time'])), t)
206+
self.stats.add(test_run.status, test_run.time)
207+
if test_run.name in self.tests:
208+
raise ValueError(f'Multiple {repr(test_run.name)} in {self.name}!')
209+
self.tests[test_run.name] = test_run
194210

195211
def __iter__(self):
196212
return iter(self.tests.values())
@@ -245,8 +261,8 @@ def __init__(self, builds_dir: Path):
245261
try:
246262
build = Build(name, builds_dir, b)
247263
except BaseException as e:
248-
e.add_note(f'The build that caused an error was {name}')
249-
raise
264+
print_error(e, f'The build that caused this error was {name!r}')
265+
build = Build(name, builds_dir)
250266
self.builds[name] = build
251267

252268
# Collect all the tests

0 commit comments

Comments
 (0)