From e65fec5ac25b0903ca6f2b33e6d3e62d606e4ba9 Mon Sep 17 00:00:00 2001 From: Fred Hornsey Date: Fri, 17 Jan 2025 19:20:08 -0600 Subject: [PATCH] Fixes Related to The Test Matrix - `scoreboard.pl`: - Removed an what looks like an unused function call to fix https://github.com/DOCGroup/autobuild/issues/75. - Fix a warning - Clean up `*.build.json` files. - `matrix.py`: - Fixed a issue on Chromium browsers where the test names would always get a scroll bar that would about double the size of the rows and impact the usability of the matrix. Removed explicit overflow property to fix this. - Fixes so ACE/TAO scoreboard can use the test matrix: - Remove dependency on `scoreboard.pl -c` option, which creates the build directories and downloads the `*.build.json` files. - Fix a Python Type error for average test time when a matrix is empty. This is the case for ACE6 builds at the moment. --- scoreboard.pl | 4 ++-- testmatrix/HTMLScoreboard.py | 1 + testmatrix/matrix.css | 1 - testmatrix/matrix.py | 26 ++++++++++++++++++++++---- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/scoreboard.pl b/scoreboard.pl index b7858ed90..4650efd46 100755 --- a/scoreboard.pl +++ b/scoreboard.pl @@ -324,7 +324,7 @@ ($$) print "Generating index page\n" if ($verbose); unless ($indexhtml->open (">$filename")) { - warn 'Could not create file: '.$filename." ".$_; + warn "Could not create index page file $filename: $!"; return; } @@ -858,6 +858,7 @@ ($) foreach my $file (@existing) { print " Removing $file files\n" if ($verbose); unlink $file . ".txt"; + unlink $file . ".build.json"; unlink $file . "_Full.html"; unlink $file . "_Brief.html"; unlink $file . "_Totals.html"; @@ -1837,7 +1838,6 @@ sub write_builds_json if (defined $opt_i){ $index = $opt_i; - load_build_list ($inp_file); print 'Running Index Page Update at ' . get_time_str() . "\n" if ($verbose); build_index_page ($dir, $index); exit (0); diff --git a/testmatrix/HTMLScoreboard.py b/testmatrix/HTMLScoreboard.py index eac57dd0c..47f58ed5d 100644 --- a/testmatrix/HTMLScoreboard.py +++ b/testmatrix/HTMLScoreboard.py @@ -178,6 +178,7 @@ def write_simple(cls, page, title, cols, rows): def get_build_details_path(build, basename): + build.dir.mkdir(parents=True, exist_ok=True) return build.dir / f'{basename}-build-details.html' diff --git a/testmatrix/matrix.css b/testmatrix/matrix.css index 179c48201..ef2ea5cb2 100644 --- a/testmatrix/matrix.css +++ b/testmatrix/matrix.css @@ -59,7 +59,6 @@ table.test_results td[test] a { td.test_name { font-family: monospace; text-align: left; - overflow-x: scroll; white-space: nowrap; } td.txt {text-align: left;} diff --git a/testmatrix/matrix.py b/testmatrix/matrix.py index e06c9c562..07540c059 100644 --- a/testmatrix/matrix.py +++ b/testmatrix/matrix.py @@ -4,6 +4,7 @@ import enum from datetime import timedelta from pathlib import Path +from urllib.request import urlopen use_ansi = os.name != 'nt' and sys.stdout.isatty() @@ -30,6 +31,9 @@ def text(self): def timedelta_str(td): # str(td) would work, but it returns a string that's longer than it # needs to be. + if td is None: + return 'N/A' + days, rem_hours = divmod(round(td.total_seconds()), 24 * 60 * 60) hours, rem_mins = divmod(rem_hours, 60 * 60) mins, secs = divmod(rem_mins, 60) @@ -166,9 +170,19 @@ def __init__(self, name, builds_dir, misc=None): self.basename = misc['basename'] self.props = misc.get('props', {}) - build_json = self.dir / (self.basename + '.build.json') - with build_json.open('r') as f: - data = json.load(f) + # Get build.json. It should either exist locally or can be downloaded. + build_json_name = self.basename + '.build.json' + build_json = self.dir / build_json_name + if build_json.is_file(): + with build_json.open('r') as f: + data = json.load(f) + elif 'url' in misc: + url = misc['url'] + '/' + build_json_name + print(f'{build_json} not found, downloading {url}...') + with urlopen(url) as f: + data = json.load(f) + else: + raise ValueError(f'Can not get {build_json_name} for {name}') self.tests = {} for t in data['tests']: @@ -228,7 +242,11 @@ def __init__(self, builds_dir: Path): self.builds = {} for b in data['builds']: name = b['name'] - build = Build(name, builds_dir, b) + try: + build = Build(name, builds_dir, b) + except BaseException as e: + e.add_note(f'The build that caused an error was {name}') + raise self.builds[name] = build # Collect all the tests