In test/bench.py, added "internal" flag

This marks internal tests/benches (case.in="lfs.c") with an otherwise-unused
flag that is printed during --summary/--list-*. This just helps identify which
tests/benches are internal.
This commit is contained in:
Christopher Haster
2023-06-01 17:13:51 -05:00
parent 82027f3d90
commit 07244fb2d4
6 changed files with 35 additions and 15 deletions

View File

@@ -61,6 +61,8 @@ class BenchCase:
self.in_ = config.pop('in',
config.pop('suite_in', None))
self.internal = bool(self.in_)
# figure out defines and build possible permutations
self.defines = set()
self.permutations = []
@@ -212,6 +214,9 @@ class BenchSuite:
self.defines = set.union(set(), *(
set(case.defines) for case in self.cases))
# combine other per-case things
self.internal = any(case.internal for case in self.cases)
for k in config.keys():
print('%swarning:%s in %s, found unused key %r' % (
'\x1b[01;33m' if args['color'] else '',
@@ -418,7 +423,10 @@ def compile(bench_paths, **args):
% suite.name)
f.writeln(4*' '+'.name = "%s",' % suite.name)
f.writeln(4*' '+'.path = "%s",' % suite.path)
f.writeln(4*' '+'.flags = 0,')
f.writeln(4*' '+'.flags = %s,'
% (' | '.join(filter(None, [
'BENCH_INTERNAL' if suite.internal else None]))
or 0))
if suite.defines:
# create suite define names
f.writeln(4*' '+'.define_names = (const char *const['
@@ -437,7 +445,10 @@ def compile(bench_paths, **args):
f.writeln(8*' '+'{')
f.writeln(12*' '+'.name = "%s",' % case.name)
f.writeln(12*' '+'.path = "%s",' % case.path)
f.writeln(12*' '+'.flags = 0,')
f.writeln(12*' '+'.flags = %s,'
% (' | '.join(filter(None, [
'BENCH_INTERNAL' if suite.internal else None]))
or 0))
if case.defines:
f.writeln(12*' '+'.defines = '
'(const bench_define_t*)(const bench_define_t[]['