forked from Imagelibrary/littlefs
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,7 +884,7 @@ static void summary(void) {
|
||||
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
|
||||
char flag_buf[64];
|
||||
sprintf(flag_buf, "%s%s",
|
||||
(flags & BENCH_REENTRANT) ? "r" : "",
|
||||
(flags & BENCH_INTERNAL) ? "i" : "",
|
||||
(!flags) ? "-" : "");
|
||||
printf("%-23s %7s %7zu %7zu %11s\n",
|
||||
"TOTAL",
|
||||
@@ -943,7 +943,7 @@ static void list_suites(void) {
|
||||
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
|
||||
char flag_buf[64];
|
||||
sprintf(flag_buf, "%s%s",
|
||||
(bench_suites[i].flags & BENCH_REENTRANT) ? "r" : "",
|
||||
(bench_suites[i].flags & BENCH_INTERNAL) ? "i" : "",
|
||||
(!bench_suites[i].flags) ? "-" : "");
|
||||
printf("%-*s %7s %7zu %11s\n",
|
||||
name_width,
|
||||
@@ -996,8 +996,8 @@ static void list_cases(void) {
|
||||
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
|
||||
char flag_buf[64];
|
||||
sprintf(flag_buf, "%s%s",
|
||||
(bench_suites[i].cases[j].flags & BENCH_REENTRANT)
|
||||
? "r" : "",
|
||||
(bench_suites[i].cases[j].flags & BENCH_INTERNAL)
|
||||
? "i" : "",
|
||||
(!bench_suites[i].cases[j].flags)
|
||||
? "-" : "");
|
||||
printf("%-*s %7s %11s\n",
|
||||
|
||||
@@ -40,7 +40,7 @@ void bench_stop(void);
|
||||
struct lfs_config;
|
||||
|
||||
enum bench_flags {
|
||||
BENCH_REENTRANT = 0x1,
|
||||
BENCH_INTERNAL = 0x1,
|
||||
};
|
||||
typedef uint8_t bench_flags_t;
|
||||
|
||||
|
||||
@@ -912,8 +912,9 @@ static void summary(void) {
|
||||
char perm_buf[64];
|
||||
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
|
||||
char flag_buf[64];
|
||||
sprintf(flag_buf, "%s%s",
|
||||
sprintf(flag_buf, "%s%s%s",
|
||||
(flags & TEST_REENTRANT) ? "r" : "",
|
||||
(flags & TEST_INTERNAL) ? "i" : "",
|
||||
(!flags) ? "-" : "");
|
||||
printf("%-23s %7s %7zu %7zu %11s\n",
|
||||
"TOTAL",
|
||||
@@ -973,8 +974,9 @@ static void list_suites(void) {
|
||||
char perm_buf[64];
|
||||
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
|
||||
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_INTERNAL) ? "i" : "",
|
||||
(!test_suites[i].flags) ? "-" : "");
|
||||
printf("%-*s %7s %7zu %11s\n",
|
||||
name_width,
|
||||
@@ -1028,9 +1030,11 @@ static void list_cases(void) {
|
||||
char perm_buf[64];
|
||||
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
|
||||
char flag_buf[64];
|
||||
sprintf(flag_buf, "%s%s",
|
||||
sprintf(flag_buf, "%s%s%s",
|
||||
(test_suites[i].cases[j].flags & TEST_REENTRANT)
|
||||
? "r" : "",
|
||||
(test_suites[i].cases[j].flags & TEST_INTERNAL)
|
||||
? "i" : "",
|
||||
(!test_suites[i].cases[j].flags)
|
||||
? "-" : "");
|
||||
printf("%-*s %7s %11s\n",
|
||||
|
||||
@@ -33,7 +33,8 @@ void test_trace(const char *fmt, ...);
|
||||
struct lfs_config;
|
||||
|
||||
enum test_flags {
|
||||
TEST_REENTRANT = 0x1,
|
||||
TEST_INTERNAL = 0x1,
|
||||
TEST_REENTRANT = 0x2,
|
||||
};
|
||||
typedef uint8_t test_flags_t;
|
||||
|
||||
|
||||
@@ -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[]['
|
||||
|
||||
@@ -61,6 +61,7 @@ class TestCase:
|
||||
self.in_ = config.pop('in',
|
||||
config.pop('suite_in', None))
|
||||
|
||||
self.internal = bool(self.in_)
|
||||
self.reentrant = config.pop('reentrant',
|
||||
config.pop('suite_reentrant', False))
|
||||
|
||||
@@ -218,6 +219,7 @@ class TestSuite:
|
||||
set(case.defines) for case in self.cases))
|
||||
|
||||
# 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)
|
||||
|
||||
for k in config.keys():
|
||||
@@ -428,6 +430,7 @@ def compile(test_paths, **args):
|
||||
f.writeln(4*' '+'.path = "%s",' % suite.path)
|
||||
f.writeln(4*' '+'.flags = %s,'
|
||||
% (' | '.join(filter(None, [
|
||||
'TEST_INTERNAL' if suite.internal else None,
|
||||
'TEST_REENTRANT' if suite.reentrant else None]))
|
||||
or 0))
|
||||
if suite.defines:
|
||||
@@ -450,6 +453,7 @@ def compile(test_paths, **args):
|
||||
f.writeln(12*' '+'.path = "%s",' % case.path)
|
||||
f.writeln(12*' '+'.flags = %s,'
|
||||
% (' | '.join(filter(None, [
|
||||
'TEST_INTERNAL' if case.internal else None,
|
||||
'TEST_REENTRANT' if case.reentrant else None]))
|
||||
or 0))
|
||||
if case.defines:
|
||||
|
||||
Reference in New Issue
Block a user