From 06a360462ab9f5206ff9d78be4095c629ca372ae Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Wed, 14 Feb 2024 00:25:10 -0600 Subject: [PATCH] Simplified test/bench suite finding logic in test.py/bench.py These just take normal paths now, we weren't even using the magic test/bench suite finding logic since it's easier to just pass everything explicitly in our Makefile. The original test/bench suite finding logic was a bad idea anyways. This is what globs are for, and having custom path chasing logic is inconsistent and risks confusion. --- scripts/bench.py | 18 ++---------------- scripts/test.py | 18 ++---------------- 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/scripts/bench.py b/scripts/bench.py index f5747ec9..32beba31 100755 --- a/scripts/bench.py +++ b/scripts/bench.py @@ -13,7 +13,6 @@ import collections as co import csv import errno import fnmatch -import glob import itertools as it import math as m import os @@ -260,20 +259,8 @@ class BenchSuite: def compile(bench_paths, **args): - # find .toml files - paths = [] - for path in bench_paths: - if os.path.isdir(path): - path = path + '/*.toml' - - if '*' in path: - for path in glob.glob(path): - paths.append(path) - else: - paths.append(path) - # load the suites - suites = [BenchSuite(path, args) for path in paths] + suites = [BenchSuite(path, args) for path in bench_paths] # sort suites by: # 1. topologically by "after" dependencies @@ -1624,8 +1611,7 @@ if __name__ == "__main__": comp_parser.add_argument( 'bench_paths', nargs='*', - help="Description of *.toml files to compile. May be a directory " - "or a list of paths.") + help="Set of *.toml files to compile.") comp_parser.add_argument( '-c', '--compile', action='store_true', diff --git a/scripts/test.py b/scripts/test.py index 20b49e46..9f8c20b2 100755 --- a/scripts/test.py +++ b/scripts/test.py @@ -13,7 +13,6 @@ import collections as co import csv import errno import fnmatch -import glob import itertools as it import math as m import os @@ -265,20 +264,8 @@ class TestSuite: def compile(test_paths, **args): - # find .toml files - paths = [] - for path in test_paths: - if os.path.isdir(path): - path = path + '/*.toml' - - if '*' in path: - for path in glob.glob(path): - paths.append(path) - else: - paths.append(path) - # load the suites - suites = [TestSuite(path, args) for path in paths] + suites = [TestSuite(path, args) for path in test_paths] # sort suites by: # 1. topologically by "after" dependencies @@ -1653,8 +1640,7 @@ if __name__ == "__main__": comp_parser.add_argument( 'test_paths', nargs='*', - help="Description of *.toml files to compile. May be a directory " - "or a list of paths.") + help="Set of *.toml files to compile.") comp_parser.add_argument( '-c', '--compile', action='store_true',