Allowed empty suites in test.py/bench.py

This happens when you need to comment out an entire suite due to
temporary changes.
This commit is contained in:
Christopher Haster
2023-02-20 13:43:30 -06:00
parent b887365fcb
commit a20625be7c
2 changed files with 47 additions and 45 deletions

View File

@@ -171,7 +171,7 @@ class BenchSuite:
# sort in case toml parsing did not retain order
case_linenos.sort()
cases = config.pop('cases')
cases = config.pop('cases', {})
for (lineno, name), (nlineno, _) in it.zip_longest(
case_linenos, case_linenos[1:],
fillvalue=(float('inf'), None)):
@@ -209,7 +209,7 @@ class BenchSuite:
args=args))
# combine per-case defines
self.defines = set.union(*(
self.defines = set.union(set(), *(
set(case.defines) for case in self.cases))
for k in config.keys():
@@ -425,6 +425,7 @@ def compile(bench_paths, **args):
f.writeln(4*' '+'},')
f.writeln(4*' '+'.define_count = '
'BENCH_IMPLICIT_DEFINE_COUNT+%d,' % len(suite.defines))
if suite.cases:
f.writeln(4*' '+'.cases = (const struct bench_case[]){')
for case in suite.cases:
# create case structs

View File

@@ -174,7 +174,7 @@ class TestSuite:
# sort in case toml parsing did not retain order
case_linenos.sort()
cases = config.pop('cases')
cases = config.pop('cases', {})
for (lineno, name), (nlineno, _) in it.zip_longest(
case_linenos, case_linenos[1:],
fillvalue=(float('inf'), None)):
@@ -214,7 +214,7 @@ class TestSuite:
args=args))
# combine per-case defines
self.defines = set.union(*(
self.defines = set.union(set(), *(
set(case.defines) for case in self.cases))
# combine other per-case things
@@ -436,6 +436,7 @@ def compile(test_paths, **args):
f.writeln(4*' '+'},')
f.writeln(4*' '+'.define_count = '
'TEST_IMPLICIT_DEFINE_COUNT+%d,' % len(suite.defines))
if suite.cases:
f.writeln(4*' '+'.cases = (const struct test_case[]){')
for case in suite.cases:
# create case structs