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:
@@ -884,8 +884,8 @@ static void summary(void) {
|
|||||||
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
|
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
|
||||||
char flag_buf[64];
|
char flag_buf[64];
|
||||||
sprintf(flag_buf, "%s%s",
|
sprintf(flag_buf, "%s%s",
|
||||||
(flags & BENCH_REENTRANT) ? "r" : "",
|
(flags & BENCH_INTERNAL) ? "i" : "",
|
||||||
(!flags) ? "-" : "");
|
(!flags) ? "-" : "");
|
||||||
printf("%-23s %7s %7zu %7zu %11s\n",
|
printf("%-23s %7s %7zu %7zu %11s\n",
|
||||||
"TOTAL",
|
"TOTAL",
|
||||||
flag_buf,
|
flag_buf,
|
||||||
@@ -943,8 +943,8 @@ static void list_suites(void) {
|
|||||||
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
|
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
|
||||||
char flag_buf[64];
|
char flag_buf[64];
|
||||||
sprintf(flag_buf, "%s%s",
|
sprintf(flag_buf, "%s%s",
|
||||||
(bench_suites[i].flags & BENCH_REENTRANT) ? "r" : "",
|
(bench_suites[i].flags & BENCH_INTERNAL) ? "i" : "",
|
||||||
(!bench_suites[i].flags) ? "-" : "");
|
(!bench_suites[i].flags) ? "-" : "");
|
||||||
printf("%-*s %7s %7zu %11s\n",
|
printf("%-*s %7s %7zu %11s\n",
|
||||||
name_width,
|
name_width,
|
||||||
bench_suites[i].name,
|
bench_suites[i].name,
|
||||||
@@ -996,8 +996,8 @@ static void list_cases(void) {
|
|||||||
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
|
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
|
||||||
char flag_buf[64];
|
char flag_buf[64];
|
||||||
sprintf(flag_buf, "%s%s",
|
sprintf(flag_buf, "%s%s",
|
||||||
(bench_suites[i].cases[j].flags & BENCH_REENTRANT)
|
(bench_suites[i].cases[j].flags & BENCH_INTERNAL)
|
||||||
? "r" : "",
|
? "i" : "",
|
||||||
(!bench_suites[i].cases[j].flags)
|
(!bench_suites[i].cases[j].flags)
|
||||||
? "-" : "");
|
? "-" : "");
|
||||||
printf("%-*s %7s %11s\n",
|
printf("%-*s %7s %11s\n",
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ void bench_stop(void);
|
|||||||
struct lfs_config;
|
struct lfs_config;
|
||||||
|
|
||||||
enum bench_flags {
|
enum bench_flags {
|
||||||
BENCH_REENTRANT = 0x1,
|
BENCH_INTERNAL = 0x1,
|
||||||
};
|
};
|
||||||
typedef uint8_t bench_flags_t;
|
typedef uint8_t bench_flags_t;
|
||||||
|
|
||||||
|
|||||||
@@ -912,9 +912,10 @@ static void summary(void) {
|
|||||||
char perm_buf[64];
|
char perm_buf[64];
|
||||||
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
|
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
|
||||||
char flag_buf[64];
|
char flag_buf[64];
|
||||||
sprintf(flag_buf, "%s%s",
|
sprintf(flag_buf, "%s%s%s",
|
||||||
(flags & TEST_REENTRANT) ? "r" : "",
|
(flags & TEST_REENTRANT) ? "r" : "",
|
||||||
(!flags) ? "-" : "");
|
(flags & TEST_INTERNAL) ? "i" : "",
|
||||||
|
(!flags) ? "-" : "");
|
||||||
printf("%-23s %7s %7zu %7zu %11s\n",
|
printf("%-23s %7s %7zu %7zu %11s\n",
|
||||||
"TOTAL",
|
"TOTAL",
|
||||||
flag_buf,
|
flag_buf,
|
||||||
@@ -973,9 +974,10 @@ static void list_suites(void) {
|
|||||||
char perm_buf[64];
|
char perm_buf[64];
|
||||||
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
|
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
|
||||||
char flag_buf[64];
|
char flag_buf[64];
|
||||||
sprintf(flag_buf, "%s%s",
|
sprintf(flag_buf, "%s%s%s",
|
||||||
(test_suites[i].flags & TEST_REENTRANT) ? "r" : "",
|
(test_suites[i].flags & TEST_REENTRANT) ? "r" : "",
|
||||||
(!test_suites[i].flags) ? "-" : "");
|
(test_suites[i].flags & TEST_INTERNAL) ? "i" : "",
|
||||||
|
(!test_suites[i].flags) ? "-" : "");
|
||||||
printf("%-*s %7s %7zu %11s\n",
|
printf("%-*s %7s %7zu %11s\n",
|
||||||
name_width,
|
name_width,
|
||||||
test_suites[i].name,
|
test_suites[i].name,
|
||||||
@@ -1028,9 +1030,11 @@ static void list_cases(void) {
|
|||||||
char perm_buf[64];
|
char perm_buf[64];
|
||||||
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
|
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
|
||||||
char flag_buf[64];
|
char flag_buf[64];
|
||||||
sprintf(flag_buf, "%s%s",
|
sprintf(flag_buf, "%s%s%s",
|
||||||
(test_suites[i].cases[j].flags & TEST_REENTRANT)
|
(test_suites[i].cases[j].flags & TEST_REENTRANT)
|
||||||
? "r" : "",
|
? "r" : "",
|
||||||
|
(test_suites[i].cases[j].flags & TEST_INTERNAL)
|
||||||
|
? "i" : "",
|
||||||
(!test_suites[i].cases[j].flags)
|
(!test_suites[i].cases[j].flags)
|
||||||
? "-" : "");
|
? "-" : "");
|
||||||
printf("%-*s %7s %11s\n",
|
printf("%-*s %7s %11s\n",
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ void test_trace(const char *fmt, ...);
|
|||||||
struct lfs_config;
|
struct lfs_config;
|
||||||
|
|
||||||
enum test_flags {
|
enum test_flags {
|
||||||
TEST_REENTRANT = 0x1,
|
TEST_INTERNAL = 0x1,
|
||||||
|
TEST_REENTRANT = 0x2,
|
||||||
};
|
};
|
||||||
typedef uint8_t test_flags_t;
|
typedef uint8_t test_flags_t;
|
||||||
|
|
||||||
|
|||||||
+13
-2
@@ -61,6 +61,8 @@ class BenchCase:
|
|||||||
self.in_ = config.pop('in',
|
self.in_ = config.pop('in',
|
||||||
config.pop('suite_in', None))
|
config.pop('suite_in', None))
|
||||||
|
|
||||||
|
self.internal = bool(self.in_)
|
||||||
|
|
||||||
# figure out defines and build possible permutations
|
# figure out defines and build possible permutations
|
||||||
self.defines = set()
|
self.defines = set()
|
||||||
self.permutations = []
|
self.permutations = []
|
||||||
@@ -212,6 +214,9 @@ class BenchSuite:
|
|||||||
self.defines = set.union(set(), *(
|
self.defines = set.union(set(), *(
|
||||||
set(case.defines) for case in self.cases))
|
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():
|
for k in config.keys():
|
||||||
print('%swarning:%s in %s, found unused key %r' % (
|
print('%swarning:%s in %s, found unused key %r' % (
|
||||||
'\x1b[01;33m' if args['color'] else '',
|
'\x1b[01;33m' if args['color'] else '',
|
||||||
@@ -418,7 +423,10 @@ def compile(bench_paths, **args):
|
|||||||
% suite.name)
|
% suite.name)
|
||||||
f.writeln(4*' '+'.name = "%s",' % suite.name)
|
f.writeln(4*' '+'.name = "%s",' % suite.name)
|
||||||
f.writeln(4*' '+'.path = "%s",' % suite.path)
|
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:
|
if suite.defines:
|
||||||
# create suite define names
|
# create suite define names
|
||||||
f.writeln(4*' '+'.define_names = (const char *const['
|
f.writeln(4*' '+'.define_names = (const char *const['
|
||||||
@@ -437,7 +445,10 @@ def compile(bench_paths, **args):
|
|||||||
f.writeln(8*' '+'{')
|
f.writeln(8*' '+'{')
|
||||||
f.writeln(12*' '+'.name = "%s",' % case.name)
|
f.writeln(12*' '+'.name = "%s",' % case.name)
|
||||||
f.writeln(12*' '+'.path = "%s",' % case.path)
|
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:
|
if case.defines:
|
||||||
f.writeln(12*' '+'.defines = '
|
f.writeln(12*' '+'.defines = '
|
||||||
'(const bench_define_t*)(const bench_define_t[]['
|
'(const bench_define_t*)(const bench_define_t[]['
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ class TestCase:
|
|||||||
self.in_ = config.pop('in',
|
self.in_ = config.pop('in',
|
||||||
config.pop('suite_in', None))
|
config.pop('suite_in', None))
|
||||||
|
|
||||||
|
self.internal = bool(self.in_)
|
||||||
self.reentrant = config.pop('reentrant',
|
self.reentrant = config.pop('reentrant',
|
||||||
config.pop('suite_reentrant', False))
|
config.pop('suite_reentrant', False))
|
||||||
|
|
||||||
@@ -218,6 +219,7 @@ class TestSuite:
|
|||||||
set(case.defines) for case in self.cases))
|
set(case.defines) for case in self.cases))
|
||||||
|
|
||||||
# combine other per-case things
|
# combine other per-case things
|
||||||
|
self.internal = any(case.internal for case in self.cases)
|
||||||
self.reentrant = any(case.reentrant for case in self.cases)
|
self.reentrant = any(case.reentrant for case in self.cases)
|
||||||
|
|
||||||
for k in config.keys():
|
for k in config.keys():
|
||||||
@@ -428,6 +430,7 @@ def compile(test_paths, **args):
|
|||||||
f.writeln(4*' '+'.path = "%s",' % suite.path)
|
f.writeln(4*' '+'.path = "%s",' % suite.path)
|
||||||
f.writeln(4*' '+'.flags = %s,'
|
f.writeln(4*' '+'.flags = %s,'
|
||||||
% (' | '.join(filter(None, [
|
% (' | '.join(filter(None, [
|
||||||
|
'TEST_INTERNAL' if suite.internal else None,
|
||||||
'TEST_REENTRANT' if suite.reentrant else None]))
|
'TEST_REENTRANT' if suite.reentrant else None]))
|
||||||
or 0))
|
or 0))
|
||||||
if suite.defines:
|
if suite.defines:
|
||||||
@@ -450,6 +453,7 @@ def compile(test_paths, **args):
|
|||||||
f.writeln(12*' '+'.path = "%s",' % case.path)
|
f.writeln(12*' '+'.path = "%s",' % case.path)
|
||||||
f.writeln(12*' '+'.flags = %s,'
|
f.writeln(12*' '+'.flags = %s,'
|
||||||
% (' | '.join(filter(None, [
|
% (' | '.join(filter(None, [
|
||||||
|
'TEST_INTERNAL' if case.internal else None,
|
||||||
'TEST_REENTRANT' if case.reentrant else None]))
|
'TEST_REENTRANT' if case.reentrant else None]))
|
||||||
or 0))
|
or 0))
|
||||||
if case.defines:
|
if case.defines:
|
||||||
|
|||||||
Reference in New Issue
Block a user