Skip to content

Commit 1771cd6

Browse files
Merge pull request #76 from iguessthislldo/igtd/test-matrix-fixes
Fixes Related to The Test Matrix
2 parents 609a44d + e65fec5 commit 1771cd6

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

scoreboard.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ ($$)
324324
print "Generating index page\n" if ($verbose);
325325

326326
unless ($indexhtml->open (">$filename")) {
327-
warn 'Could not create file: '.$filename." ".$_;
327+
warn "Could not create index page file $filename: $!";
328328
return;
329329
}
330330

@@ -858,6 +858,7 @@ ($)
858858
foreach my $file (@existing) {
859859
print " Removing $file files\n" if ($verbose);
860860
unlink $file . ".txt";
861+
unlink $file . ".build.json";
861862
unlink $file . "_Full.html";
862863
unlink $file . "_Brief.html";
863864
unlink $file . "_Totals.html";
@@ -1837,7 +1838,6 @@ sub write_builds_json
18371838

18381839
if (defined $opt_i){
18391840
$index = $opt_i;
1840-
load_build_list ($inp_file);
18411841
print 'Running Index Page Update at ' . get_time_str() . "\n" if ($verbose);
18421842
build_index_page ($dir, $index);
18431843
exit (0);

testmatrix/HTMLScoreboard.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ def write_simple(cls, page, title, cols, rows):
178178

179179

180180
def get_build_details_path(build, basename):
181+
build.dir.mkdir(parents=True, exist_ok=True)
181182
return build.dir / f'{basename}-build-details.html'
182183

183184

testmatrix/matrix.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ table.test_results td[test] a {
5959
td.test_name {
6060
font-family: monospace;
6161
text-align: left;
62-
overflow-x: scroll;
6362
white-space: nowrap;
6463
}
6564
td.txt {text-align: left;}

testmatrix/matrix.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import enum
55
from datetime import timedelta
66
from pathlib import Path
7+
from urllib.request import urlopen
78

89

910
use_ansi = os.name != 'nt' and sys.stdout.isatty()
@@ -30,6 +31,9 @@ def text(self):
3031
def timedelta_str(td):
3132
# str(td) would work, but it returns a string that's longer than it
3233
# needs to be.
34+
if td is None:
35+
return 'N/A'
36+
3337
days, rem_hours = divmod(round(td.total_seconds()), 24 * 60 * 60)
3438
hours, rem_mins = divmod(rem_hours, 60 * 60)
3539
mins, secs = divmod(rem_mins, 60)
@@ -166,9 +170,19 @@ def __init__(self, name, builds_dir, misc=None):
166170
self.basename = misc['basename']
167171
self.props = misc.get('props', {})
168172

169-
build_json = self.dir / (self.basename + '.build.json')
170-
with build_json.open('r') as f:
171-
data = json.load(f)
173+
# Get build.json. It should either exist locally or can be downloaded.
174+
build_json_name = self.basename + '.build.json'
175+
build_json = self.dir / build_json_name
176+
if build_json.is_file():
177+
with build_json.open('r') as f:
178+
data = json.load(f)
179+
elif 'url' in misc:
180+
url = misc['url'] + '/' + build_json_name
181+
print(f'{build_json} not found, downloading {url}...')
182+
with urlopen(url) as f:
183+
data = json.load(f)
184+
else:
185+
raise ValueError(f'Can not get {build_json_name} for {name}')
172186

173187
self.tests = {}
174188
for t in data['tests']:
@@ -228,7 +242,11 @@ def __init__(self, builds_dir: Path):
228242
self.builds = {}
229243
for b in data['builds']:
230244
name = b['name']
231-
build = Build(name, builds_dir, b)
245+
try:
246+
build = Build(name, builds_dir, b)
247+
except BaseException as e:
248+
e.add_note(f'The build that caused an error was {name}')
249+
raise
232250
self.builds[name] = build
233251

234252
# Collect all the tests

0 commit comments

Comments
 (0)