mirror of
https://github.com/littlefs-project/littlefs.git
synced 2025-11-16 04:24:35 +00:00
Tweaked/fixed a number of small runner things after a bit of use
- Added support for negative numbers in the leb16 encoding with an
optional 'w' prefix.
- Changed prettyasserts.py rule to .a.c => .c, allowing other .a.c files
in the future.
- Updated .gitignore with missing generated files (tags, .csv).
- Removed suite-namespacing of test symbols, these are no longer needed.
- Changed test define overrides to have higher priority than explicit
defines encoded in test ids. So:
./runners/bench_runner bench_dir_open:0f1g12gg2b8c8dgg4e0 -DREAD_SIZE=16
Behaves as expected.
Otherwise it's not easy to experiment with known failing test cases.
- Fixed issue where the -b flag ignored explicit test/bench ids.
This commit is contained in:
30
.gitignore
vendored
30
.gitignore
vendored
@@ -4,19 +4,31 @@
|
|||||||
*.a
|
*.a
|
||||||
*.ci
|
*.ci
|
||||||
*.csv
|
*.csv
|
||||||
*.t.c
|
*.t.*
|
||||||
*.b.c
|
*.b.*
|
||||||
*.a.c
|
|
||||||
*.gcno
|
*.gcno
|
||||||
*.gcda
|
*.gcda
|
||||||
*.perf
|
*.perf
|
||||||
|
lfs
|
||||||
|
liblfs.a
|
||||||
|
|
||||||
# Testing things
|
# Testing things
|
||||||
blocks/
|
|
||||||
lfs
|
|
||||||
test.c
|
|
||||||
tests/*.toml.*
|
|
||||||
scripts/__pycache__
|
|
||||||
.gdb_history
|
|
||||||
runners/test_runner
|
runners/test_runner
|
||||||
runners/bench_runner
|
runners/bench_runner
|
||||||
|
lfs.code.csv
|
||||||
|
lfs.data.csv
|
||||||
|
lfs.stack.csv
|
||||||
|
lfs.structs.csv
|
||||||
|
lfs.cov.csv
|
||||||
|
lfs.perf.csv
|
||||||
|
lfs.perfbd.csv
|
||||||
|
lfs.test.csv
|
||||||
|
lfs.bench.csv
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
tags
|
||||||
|
.gdb_history
|
||||||
|
scripts/__pycache__
|
||||||
|
|
||||||
|
# Historical, probably should remove at some point
|
||||||
|
tests/*.toml.*
|
||||||
|
|||||||
60
Makefile
60
Makefile
@@ -28,43 +28,43 @@ VALGRIND ?= valgrind
|
|||||||
GDB ?= gdb
|
GDB ?= gdb
|
||||||
PERF ?= perf
|
PERF ?= perf
|
||||||
|
|
||||||
SRC ?= $(filter-out $(wildcard *.*.c),$(wildcard *.c))
|
SRC ?= $(filter-out $(wildcard *.t.* *.b.*),$(wildcard *.c))
|
||||||
OBJ := $(SRC:%.c=$(BUILDDIR)/%.o)
|
OBJ := $(SRC:%.c=$(BUILDDIR)/%.o)
|
||||||
DEP := $(SRC:%.c=$(BUILDDIR)/%.d)
|
DEP := $(SRC:%.c=$(BUILDDIR)/%.d)
|
||||||
ASM := $(SRC:%.c=$(BUILDDIR)/%.s)
|
ASM := $(SRC:%.c=$(BUILDDIR)/%.s)
|
||||||
CI := $(SRC:%.c=$(BUILDDIR)/%.ci)
|
CI := $(SRC:%.c=$(BUILDDIR)/%.ci)
|
||||||
GCDA := $(SRC:%.c=$(BUILDDIR)/%.t.a.gcda)
|
GCDA := $(SRC:%.c=$(BUILDDIR)/%.t.gcda)
|
||||||
|
|
||||||
TESTS ?= $(wildcard tests/*.toml)
|
TESTS ?= $(wildcard tests/*.toml)
|
||||||
TEST_SRC ?= $(SRC) \
|
TEST_SRC ?= $(SRC) \
|
||||||
$(filter-out $(wildcard bd/*.*.c),$(wildcard bd/*.c)) \
|
$(filter-out $(wildcard bd/*.t.* bd/*.b.*),$(wildcard bd/*.c)) \
|
||||||
runners/test_runner.c
|
runners/test_runner.c
|
||||||
TEST_RUNNER ?= $(BUILDDIR)/runners/test_runner
|
TEST_RUNNER ?= $(BUILDDIR)/runners/test_runner
|
||||||
TEST_TC := $(TESTS:%.toml=$(BUILDDIR)/%.t.c) \
|
TEST_A := $(TESTS:%.toml=$(BUILDDIR)/%.t.a.c) \
|
||||||
$(TEST_SRC:%.c=$(BUILDDIR)/%.t.c)
|
$(TEST_SRC:%.c=$(BUILDDIR)/%.t.a.c)
|
||||||
TEST_TAC := $(TEST_TC:%.t.c=%.t.a.c)
|
TEST_C := $(TEST_A:%.t.a.c=%.t.c)
|
||||||
TEST_OBJ := $(TEST_TAC:%.t.a.c=%.t.a.o)
|
TEST_OBJ := $(TEST_C:%.t.c=%.t.o)
|
||||||
TEST_DEP := $(TEST_TAC:%.t.a.c=%.t.a.d)
|
TEST_DEP := $(TEST_C:%.t.c=%.t.d)
|
||||||
TEST_CI := $(TEST_TAC:%.t.a.c=%.t.a.ci)
|
TEST_CI := $(TEST_C:%.t.c=%.t.ci)
|
||||||
TEST_GCNO := $(TEST_TAC:%.t.a.c=%.t.a.gcno)
|
TEST_GCNO := $(TEST_C:%.t.c=%.t.gcno)
|
||||||
TEST_GCDA := $(TEST_TAC:%.t.a.c=%.t.a.gcda)
|
TEST_GCDA := $(TEST_C:%.t.c=%.t.gcda)
|
||||||
TEST_PERF := $(TEST_RUNNER:%=%.perf)
|
TEST_PERF := $(TEST_RUNNER:%=%.perf)
|
||||||
TEST_TRACE := $(TEST_RUNNER:%=%.trace)
|
TEST_TRACE := $(TEST_RUNNER:%=%.trace)
|
||||||
TEST_CSV := $(TEST_RUNNER:%=%.csv)
|
TEST_CSV := $(TEST_RUNNER:%=%.csv)
|
||||||
|
|
||||||
BENCHES ?= $(wildcard benches/*.toml)
|
BENCHES ?= $(wildcard benches/*.toml)
|
||||||
BENCH_SRC ?= $(SRC) \
|
BENCH_SRC ?= $(SRC) \
|
||||||
$(filter-out $(wildcard bd/*.*.c),$(wildcard bd/*.c)) \
|
$(filter-out $(wildcard bd/*.t.* bd/*.b.*),$(wildcard bd/*.c)) \
|
||||||
runners/bench_runner.c
|
runners/bench_runner.c
|
||||||
BENCH_RUNNER ?= $(BUILDDIR)/runners/bench_runner
|
BENCH_RUNNER ?= $(BUILDDIR)/runners/bench_runner
|
||||||
BENCH_BC := $(BENCHES:%.toml=$(BUILDDIR)/%.b.c) \
|
BENCH_A := $(BENCHES:%.toml=$(BUILDDIR)/%.b.a.c) \
|
||||||
$(BENCH_SRC:%.c=$(BUILDDIR)/%.b.c)
|
$(BENCH_SRC:%.c=$(BUILDDIR)/%.b.a.c)
|
||||||
BENCH_BAC := $(BENCH_BC:%.b.c=%.b.a.c)
|
BENCH_C := $(BENCH_A:%.b.a.c=%.b.c)
|
||||||
BENCH_OBJ := $(BENCH_BAC:%.b.a.c=%.b.a.o)
|
BENCH_OBJ := $(BENCH_C:%.b.c=%.b.o)
|
||||||
BENCH_DEP := $(BENCH_BAC:%.b.a.c=%.b.a.d)
|
BENCH_DEP := $(BENCH_C:%.b.c=%.b.d)
|
||||||
BENCH_CI := $(BENCH_BAC:%.b.a.c=%.b.a.ci)
|
BENCH_CI := $(BENCH_C:%.b.c=%.b.ci)
|
||||||
BENCH_GCNO := $(BENCH_BAC:%.b.a.c=%.b.a.gcno)
|
BENCH_GCNO := $(BENCH_C:%.b.c=%.b.gcno)
|
||||||
BENCH_GCDA := $(BENCH_BAC:%.b.a.c=%.b.a.gcda)
|
BENCH_GCDA := $(BENCH_C:%.b.c=%.b.gcda)
|
||||||
BENCH_PERF := $(BENCH_RUNNER:%=%.perf)
|
BENCH_PERF := $(BENCH_RUNNER:%=%.perf)
|
||||||
BENCH_TRACE := $(BENCH_RUNNER:%=%.trace)
|
BENCH_TRACE := $(BENCH_RUNNER:%=%.trace)
|
||||||
BENCH_CSV := $(BENCH_RUNNER:%=%.csv)
|
BENCH_CSV := $(BENCH_RUNNER:%=%.csv)
|
||||||
@@ -517,22 +517,22 @@ $(BUILDDIR)/%.o $(BUILDDIR)/%.ci: %.c
|
|||||||
$(BUILDDIR)/%.s: %.c
|
$(BUILDDIR)/%.s: %.c
|
||||||
$(CC) -S $(CFLAGS) $< -o $@
|
$(CC) -S $(CFLAGS) $< -o $@
|
||||||
|
|
||||||
$(BUILDDIR)/%.a.c: %.c
|
$(BUILDDIR)/%.c: %.a.c
|
||||||
./scripts/prettyasserts.py -p LFS_ASSERT $< -o $@
|
./scripts/prettyasserts.py -p LFS_ASSERT $< -o $@
|
||||||
|
|
||||||
$(BUILDDIR)/%.a.c: $(BUILDDIR)/%.c
|
$(BUILDDIR)/%.c: $(BUILDDIR)/%.a.c
|
||||||
./scripts/prettyasserts.py -p LFS_ASSERT $< -o $@
|
./scripts/prettyasserts.py -p LFS_ASSERT $< -o $@
|
||||||
|
|
||||||
$(BUILDDIR)/%.t.c: %.toml
|
$(BUILDDIR)/%.t.a.c: %.toml
|
||||||
./scripts/test.py -c $< $(TESTCFLAGS) -o $@
|
./scripts/test.py -c $< $(TESTCFLAGS) -o $@
|
||||||
|
|
||||||
$(BUILDDIR)/%.t.c: %.c $(TESTS)
|
$(BUILDDIR)/%.t.a.c: %.c $(TESTS)
|
||||||
./scripts/test.py -c $(TESTS) -s $< $(TESTCFLAGS) -o $@
|
./scripts/test.py -c $(TESTS) -s $< $(TESTCFLAGS) -o $@
|
||||||
|
|
||||||
$(BUILDDIR)/%.b.c: %.toml
|
$(BUILDDIR)/%.b.a.c: %.toml
|
||||||
./scripts/bench.py -c $< $(BENCHCFLAGS) -o $@
|
./scripts/bench.py -c $< $(BENCHCFLAGS) -o $@
|
||||||
|
|
||||||
$(BUILDDIR)/%.b.c: %.c $(BENCHES)
|
$(BUILDDIR)/%.b.a.c: %.c $(BENCHES)
|
||||||
./scripts/bench.py -c $(BENCHES) -s $< $(BENCHCFLAGS) -o $@
|
./scripts/bench.py -c $(BENCHES) -s $< $(BENCHCFLAGS) -o $@
|
||||||
|
|
||||||
## Clean everything
|
## Clean everything
|
||||||
@@ -554,8 +554,8 @@ clean:
|
|||||||
rm -f $(ASM)
|
rm -f $(ASM)
|
||||||
rm -f $(CI)
|
rm -f $(CI)
|
||||||
rm -f $(TEST_RUNNER)
|
rm -f $(TEST_RUNNER)
|
||||||
rm -f $(TEST_TC)
|
rm -f $(TEST_A)
|
||||||
rm -f $(TEST_TAC)
|
rm -f $(TEST_C)
|
||||||
rm -f $(TEST_OBJ)
|
rm -f $(TEST_OBJ)
|
||||||
rm -f $(TEST_DEP)
|
rm -f $(TEST_DEP)
|
||||||
rm -f $(TEST_CI)
|
rm -f $(TEST_CI)
|
||||||
@@ -565,8 +565,8 @@ clean:
|
|||||||
rm -f $(TEST_TRACE)
|
rm -f $(TEST_TRACE)
|
||||||
rm -f $(TEST_CSV)
|
rm -f $(TEST_CSV)
|
||||||
rm -f $(BENCH_RUNNER)
|
rm -f $(BENCH_RUNNER)
|
||||||
rm -f $(BENCH_BC)
|
rm -f $(BENCH_A)
|
||||||
rm -f $(BENCH_BAC)
|
rm -f $(BENCH_C)
|
||||||
rm -f $(BENCH_OBJ)
|
rm -f $(BENCH_OBJ)
|
||||||
rm -f $(BENCH_DEP)
|
rm -f $(BENCH_DEP)
|
||||||
rm -f $(BENCH_CI)
|
rm -f $(BENCH_CI)
|
||||||
|
|||||||
@@ -52,6 +52,12 @@ void *mappend(void **p,
|
|||||||
|
|
||||||
// a quick self-terminating text-safe varint scheme
|
// a quick self-terminating text-safe varint scheme
|
||||||
static void leb16_print(uintmax_t x) {
|
static void leb16_print(uintmax_t x) {
|
||||||
|
// allow 'w' to indicate negative numbers
|
||||||
|
if ((intmax_t)x < 0) {
|
||||||
|
printf("w");
|
||||||
|
x = -x;
|
||||||
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
char nibble = (x & 0xf) | (x > 0xf ? 0x10 : 0);
|
char nibble = (x & 0xf) | (x > 0xf ? 0x10 : 0);
|
||||||
printf("%c", (nibble < 10) ? '0'+nibble : 'a'+nibble-10);
|
printf("%c", (nibble < 10) ? '0'+nibble : 'a'+nibble-10);
|
||||||
@@ -63,7 +69,17 @@ static void leb16_print(uintmax_t x) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static uintmax_t leb16_parse(const char *s, char **tail) {
|
static uintmax_t leb16_parse(const char *s, char **tail) {
|
||||||
|
bool neg = false;
|
||||||
uintmax_t x = 0;
|
uintmax_t x = 0;
|
||||||
|
if (tail) {
|
||||||
|
*tail = (char*)s;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s[0] == 'w') {
|
||||||
|
neg = true;
|
||||||
|
s = s+1;
|
||||||
|
}
|
||||||
|
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
uintmax_t nibble = s[i];
|
uintmax_t nibble = s[i];
|
||||||
@@ -73,23 +89,21 @@ static uintmax_t leb16_parse(const char *s, char **tail) {
|
|||||||
nibble = nibble - 'a' + 10;
|
nibble = nibble - 'a' + 10;
|
||||||
} else {
|
} else {
|
||||||
// invalid?
|
// invalid?
|
||||||
if (tail) {
|
|
||||||
*tail = (char*)s;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
x |= (nibble & 0xf) << (4*i);
|
x |= (nibble & 0xf) << (4*i);
|
||||||
i += 1;
|
i += 1;
|
||||||
if (!(nibble & 0x10)) {
|
if (!(nibble & 0x10)) {
|
||||||
|
s = s + i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tail) {
|
if (tail) {
|
||||||
*tail = (char*)s + i;
|
*tail = (char*)s;
|
||||||
}
|
}
|
||||||
return x;
|
return neg ? -x : x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -145,8 +159,8 @@ intmax_t bench_define_lit(void *data) {
|
|||||||
BENCH_IMPLICIT_DEFINES
|
BENCH_IMPLICIT_DEFINES
|
||||||
#undef BENCH_DEF
|
#undef BENCH_DEF
|
||||||
|
|
||||||
#define BENCH_DEFINE_MAP_EXPLICIT 0
|
#define BENCH_DEFINE_MAP_OVERRIDE 0
|
||||||
#define BENCH_DEFINE_MAP_OVERRIDE 1
|
#define BENCH_DEFINE_MAP_EXPLICIT 1
|
||||||
#define BENCH_DEFINE_MAP_PERMUTATION 2
|
#define BENCH_DEFINE_MAP_PERMUTATION 2
|
||||||
#define BENCH_DEFINE_MAP_GEOMETRY 3
|
#define BENCH_DEFINE_MAP_GEOMETRY 3
|
||||||
#define BENCH_DEFINE_MAP_IMPLICIT 4
|
#define BENCH_DEFINE_MAP_IMPLICIT 4
|
||||||
@@ -681,11 +695,18 @@ static void case_forperm(
|
|||||||
const struct bench_suite *suite,
|
const struct bench_suite *suite,
|
||||||
const struct bench_case *case_),
|
const struct bench_case *case_),
|
||||||
void *data) {
|
void *data) {
|
||||||
|
// explicit permutation?
|
||||||
if (defines) {
|
if (defines) {
|
||||||
bench_define_explicit(defines, define_count);
|
bench_define_explicit(defines, define_count);
|
||||||
|
|
||||||
|
for (size_t v = 0; v < bench_override_define_permutations; v++) {
|
||||||
|
// define override permutation
|
||||||
|
bench_define_override(v);
|
||||||
bench_define_flush();
|
bench_define_flush();
|
||||||
|
|
||||||
cb(data, suite, case_);
|
cb(data, suite, case_);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,12 @@ void *mappend(void **p,
|
|||||||
|
|
||||||
// a quick self-terminating text-safe varint scheme
|
// a quick self-terminating text-safe varint scheme
|
||||||
static void leb16_print(uintmax_t x) {
|
static void leb16_print(uintmax_t x) {
|
||||||
|
// allow 'w' to indicate negative numbers
|
||||||
|
if ((intmax_t)x < 0) {
|
||||||
|
printf("w");
|
||||||
|
x = -x;
|
||||||
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
char nibble = (x & 0xf) | (x > 0xf ? 0x10 : 0);
|
char nibble = (x & 0xf) | (x > 0xf ? 0x10 : 0);
|
||||||
printf("%c", (nibble < 10) ? '0'+nibble : 'a'+nibble-10);
|
printf("%c", (nibble < 10) ? '0'+nibble : 'a'+nibble-10);
|
||||||
@@ -63,7 +69,17 @@ static void leb16_print(uintmax_t x) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static uintmax_t leb16_parse(const char *s, char **tail) {
|
static uintmax_t leb16_parse(const char *s, char **tail) {
|
||||||
|
bool neg = false;
|
||||||
uintmax_t x = 0;
|
uintmax_t x = 0;
|
||||||
|
if (tail) {
|
||||||
|
*tail = (char*)s;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s[0] == 'w') {
|
||||||
|
neg = true;
|
||||||
|
s = s+1;
|
||||||
|
}
|
||||||
|
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
uintmax_t nibble = s[i];
|
uintmax_t nibble = s[i];
|
||||||
@@ -73,23 +89,21 @@ static uintmax_t leb16_parse(const char *s, char **tail) {
|
|||||||
nibble = nibble - 'a' + 10;
|
nibble = nibble - 'a' + 10;
|
||||||
} else {
|
} else {
|
||||||
// invalid?
|
// invalid?
|
||||||
if (tail) {
|
|
||||||
*tail = (char*)s;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
x |= (nibble & 0xf) << (4*i);
|
x |= (nibble & 0xf) << (4*i);
|
||||||
i += 1;
|
i += 1;
|
||||||
if (!(nibble & 0x10)) {
|
if (!(nibble & 0x10)) {
|
||||||
|
s = s + i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tail) {
|
if (tail) {
|
||||||
*tail = (char*)s + i;
|
*tail = (char*)s;
|
||||||
}
|
}
|
||||||
return x;
|
return neg ? -x : x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -158,8 +172,8 @@ intmax_t test_define_lit(void *data) {
|
|||||||
TEST_IMPLICIT_DEFINES
|
TEST_IMPLICIT_DEFINES
|
||||||
#undef TEST_DEF
|
#undef TEST_DEF
|
||||||
|
|
||||||
#define TEST_DEFINE_MAP_EXPLICIT 0
|
#define TEST_DEFINE_MAP_OVERRIDE 0
|
||||||
#define TEST_DEFINE_MAP_OVERRIDE 1
|
#define TEST_DEFINE_MAP_EXPLICIT 1
|
||||||
#define TEST_DEFINE_MAP_PERMUTATION 2
|
#define TEST_DEFINE_MAP_PERMUTATION 2
|
||||||
#define TEST_DEFINE_MAP_GEOMETRY 3
|
#define TEST_DEFINE_MAP_GEOMETRY 3
|
||||||
#define TEST_DEFINE_MAP_IMPLICIT 4
|
#define TEST_DEFINE_MAP_IMPLICIT 4
|
||||||
@@ -675,10 +689,16 @@ static void case_forperm(
|
|||||||
const struct test_case *case_,
|
const struct test_case *case_,
|
||||||
const test_powerloss_t *powerloss),
|
const test_powerloss_t *powerloss),
|
||||||
void *data) {
|
void *data) {
|
||||||
|
// explicit permutation?
|
||||||
if (defines) {
|
if (defines) {
|
||||||
test_define_explicit(defines, define_count);
|
test_define_explicit(defines, define_count);
|
||||||
|
|
||||||
|
for (size_t v = 0; v < test_override_define_permutations; v++) {
|
||||||
|
// define override permutation
|
||||||
|
test_define_override(v);
|
||||||
test_define_flush();
|
test_define_flush();
|
||||||
|
|
||||||
|
// explicit powerloss cycles?
|
||||||
if (cycles) {
|
if (cycles) {
|
||||||
cb(data, suite, case_, &(test_powerloss_t){
|
cb(data, suite, case_, &(test_powerloss_t){
|
||||||
.run=run_powerloss_cycles,
|
.run=run_powerloss_cycles,
|
||||||
@@ -695,6 +715,8 @@ static void case_forperm(
|
|||||||
cb(data, suite, case_, &test_powerlosses[p]);
|
cb(data, suite, case_, &test_powerlosses[p]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -315,8 +315,8 @@ def compile(bench_paths, **args):
|
|||||||
for i, defines in enumerate(case.permutations):
|
for i, defines in enumerate(case.permutations):
|
||||||
for k, v in sorted(defines.items()):
|
for k, v in sorted(defines.items()):
|
||||||
if v not in define_cbs:
|
if v not in define_cbs:
|
||||||
name = ('__bench__%s__%s__%s__%d'
|
name = ('__bench__%s__%s__%d'
|
||||||
% (suite.name, case.name, k, i))
|
% (case.name, k, i))
|
||||||
define_cbs[v] = name
|
define_cbs[v] = name
|
||||||
f.writeln('intmax_t %s('
|
f.writeln('intmax_t %s('
|
||||||
'__attribute__((unused)) '
|
'__attribute__((unused)) '
|
||||||
@@ -325,9 +325,9 @@ def compile(bench_paths, **args):
|
|||||||
f.writeln('}')
|
f.writeln('}')
|
||||||
f.writeln()
|
f.writeln()
|
||||||
f.writeln('const bench_define_t '
|
f.writeln('const bench_define_t '
|
||||||
'__bench__%s__%s__defines[]['
|
'__bench__%s__defines[]['
|
||||||
'BENCH_IMPLICIT_DEFINE_COUNT+%d] = {'
|
'BENCH_IMPLICIT_DEFINE_COUNT+%d] = {'
|
||||||
% (suite.name, case.name, len(suite.defines)))
|
% (case.name, len(suite.defines)))
|
||||||
for defines in case.permutations:
|
for defines in case.permutations:
|
||||||
f.writeln(4*' '+'{')
|
f.writeln(4*' '+'{')
|
||||||
for k, v in sorted(defines.items()):
|
for k, v in sorted(defines.items()):
|
||||||
@@ -339,8 +339,8 @@ def compile(bench_paths, **args):
|
|||||||
|
|
||||||
# create case filter function
|
# create case filter function
|
||||||
if suite.if_ is not None or case.if_ is not None:
|
if suite.if_ is not None or case.if_ is not None:
|
||||||
f.writeln('bool __bench__%s__%s__filter(void) {'
|
f.writeln('bool __bench__%s__filter(void) {'
|
||||||
% (suite.name, case.name))
|
% (case.name))
|
||||||
f.writeln(4*' '+'return %s;'
|
f.writeln(4*' '+'return %s;'
|
||||||
% ' && '.join('(%s)' % if_
|
% ' && '.join('(%s)' % if_
|
||||||
for if_ in [suite.if_, case.if_]
|
for if_ in [suite.if_, case.if_]
|
||||||
@@ -349,9 +349,9 @@ def compile(bench_paths, **args):
|
|||||||
f.writeln()
|
f.writeln()
|
||||||
|
|
||||||
# create case run function
|
# create case run function
|
||||||
f.writeln('void __bench__%s__%s__run('
|
f.writeln('void __bench__%s__run('
|
||||||
'__attribute__((unused)) struct lfs_config *cfg) {'
|
'__attribute__((unused)) struct lfs_config *cfg) {'
|
||||||
% (suite.name, case.name))
|
% (case.name))
|
||||||
f.writeln(4*' '+'// bench case %s' % case.name)
|
f.writeln(4*' '+'// bench case %s' % case.name)
|
||||||
if case.code_lineno is not None:
|
if case.code_lineno is not None:
|
||||||
f.writeln(4*' '+'#line %d "%s"'
|
f.writeln(4*' '+'#line %d "%s"'
|
||||||
@@ -391,16 +391,16 @@ def compile(bench_paths, **args):
|
|||||||
else:
|
else:
|
||||||
if case.defines:
|
if case.defines:
|
||||||
f.writeln('extern const bench_define_t '
|
f.writeln('extern const bench_define_t '
|
||||||
'__bench__%s__%s__defines[]['
|
'__bench__%s__defines[]['
|
||||||
'BENCH_IMPLICIT_DEFINE_COUNT+%d];'
|
'BENCH_IMPLICIT_DEFINE_COUNT+%d];'
|
||||||
% (suite.name, case.name, len(suite.defines)))
|
% (case.name, len(suite.defines)))
|
||||||
if suite.if_ is not None or case.if_ is not None:
|
if suite.if_ is not None or case.if_ is not None:
|
||||||
f.writeln('extern bool __bench__%s__%s__filter('
|
f.writeln('extern bool __bench__%s__filter('
|
||||||
'void);'
|
'void);'
|
||||||
% (suite.name, case.name))
|
% (case.name))
|
||||||
f.writeln('extern void __bench__%s__%s__run('
|
f.writeln('extern void __bench__%s__run('
|
||||||
'struct lfs_config *cfg);'
|
'struct lfs_config *cfg);'
|
||||||
% (suite.name, case.name))
|
% (case.name))
|
||||||
f.writeln()
|
f.writeln()
|
||||||
|
|
||||||
# create suite struct
|
# create suite struct
|
||||||
@@ -436,13 +436,13 @@ def compile(bench_paths, **args):
|
|||||||
% len(case.permutations))
|
% len(case.permutations))
|
||||||
if case.defines:
|
if case.defines:
|
||||||
f.writeln(12*' '+'.defines '
|
f.writeln(12*' '+'.defines '
|
||||||
'= (const bench_define_t*)__bench__%s__%s__defines,'
|
'= (const bench_define_t*)__bench__%s__defines,'
|
||||||
% (suite.name, case.name))
|
% (case.name))
|
||||||
if suite.if_ is not None or case.if_ is not None:
|
if suite.if_ is not None or case.if_ is not None:
|
||||||
f.writeln(12*' '+'.filter = __bench__%s__%s__filter,'
|
f.writeln(12*' '+'.filter = __bench__%s__filter,'
|
||||||
% (suite.name, case.name))
|
% (case.name))
|
||||||
f.writeln(12*' '+'.run = __bench__%s__%s__run,'
|
f.writeln(12*' '+'.run = __bench__%s__run,'
|
||||||
% (suite.name, case.name))
|
% (case.name))
|
||||||
f.writeln(8*' '+'},')
|
f.writeln(8*' '+'},')
|
||||||
f.writeln(4*' '+'},')
|
f.writeln(4*' '+'},')
|
||||||
f.writeln(4*' '+'.case_count = %d,' % len(suite.cases))
|
f.writeln(4*' '+'.case_count = %d,' % len(suite.cases))
|
||||||
@@ -1040,7 +1040,8 @@ def run(runner, bench_ids=[], **args):
|
|||||||
proged = 0
|
proged = 0
|
||||||
erased = 0
|
erased = 0
|
||||||
failures = []
|
failures = []
|
||||||
for by in (expected_case_perms.keys() if args.get('by_cases')
|
for by in (bench_ids if bench_ids
|
||||||
|
else expected_case_perms.keys() if args.get('by_cases')
|
||||||
else expected_suite_perms.keys() if args.get('by_suites')
|
else expected_suite_perms.keys() if args.get('by_suites')
|
||||||
else [None]):
|
else [None]):
|
||||||
# spawn jobs for stage
|
# spawn jobs for stage
|
||||||
@@ -1053,7 +1054,7 @@ def run(runner, bench_ids=[], **args):
|
|||||||
killed) = run_stage(
|
killed) = run_stage(
|
||||||
by or 'benches',
|
by or 'benches',
|
||||||
runner_,
|
runner_,
|
||||||
[by] if by is not None else bench_ids,
|
[by] if by is not None else [],
|
||||||
stdout,
|
stdout,
|
||||||
trace,
|
trace,
|
||||||
output,
|
output,
|
||||||
|
|||||||
@@ -323,8 +323,8 @@ def compile(test_paths, **args):
|
|||||||
for i, defines in enumerate(case.permutations):
|
for i, defines in enumerate(case.permutations):
|
||||||
for k, v in sorted(defines.items()):
|
for k, v in sorted(defines.items()):
|
||||||
if v not in define_cbs:
|
if v not in define_cbs:
|
||||||
name = ('__test__%s__%s__%s__%d'
|
name = ('__test__%s__%s__%d'
|
||||||
% (suite.name, case.name, k, i))
|
% (case.name, k, i))
|
||||||
define_cbs[v] = name
|
define_cbs[v] = name
|
||||||
f.writeln('intmax_t %s('
|
f.writeln('intmax_t %s('
|
||||||
'__attribute__((unused)) '
|
'__attribute__((unused)) '
|
||||||
@@ -333,9 +333,9 @@ def compile(test_paths, **args):
|
|||||||
f.writeln('}')
|
f.writeln('}')
|
||||||
f.writeln()
|
f.writeln()
|
||||||
f.writeln('const test_define_t '
|
f.writeln('const test_define_t '
|
||||||
'__test__%s__%s__defines[]['
|
'__test__%s__defines[]['
|
||||||
'TEST_IMPLICIT_DEFINE_COUNT+%d] = {'
|
'TEST_IMPLICIT_DEFINE_COUNT+%d] = {'
|
||||||
% (suite.name, case.name, len(suite.defines)))
|
% (case.name, len(suite.defines)))
|
||||||
for defines in case.permutations:
|
for defines in case.permutations:
|
||||||
f.writeln(4*' '+'{')
|
f.writeln(4*' '+'{')
|
||||||
for k, v in sorted(defines.items()):
|
for k, v in sorted(defines.items()):
|
||||||
@@ -347,8 +347,8 @@ def compile(test_paths, **args):
|
|||||||
|
|
||||||
# create case filter function
|
# create case filter function
|
||||||
if suite.if_ is not None or case.if_ is not None:
|
if suite.if_ is not None or case.if_ is not None:
|
||||||
f.writeln('bool __test__%s__%s__filter(void) {'
|
f.writeln('bool __test__%s__filter(void) {'
|
||||||
% (suite.name, case.name))
|
% (case.name))
|
||||||
f.writeln(4*' '+'return %s;'
|
f.writeln(4*' '+'return %s;'
|
||||||
% ' && '.join('(%s)' % if_
|
% ' && '.join('(%s)' % if_
|
||||||
for if_ in [suite.if_, case.if_]
|
for if_ in [suite.if_, case.if_]
|
||||||
@@ -357,9 +357,9 @@ def compile(test_paths, **args):
|
|||||||
f.writeln()
|
f.writeln()
|
||||||
|
|
||||||
# create case run function
|
# create case run function
|
||||||
f.writeln('void __test__%s__%s__run('
|
f.writeln('void __test__%s__run('
|
||||||
'__attribute__((unused)) struct lfs_config *cfg) {'
|
'__attribute__((unused)) struct lfs_config *cfg) {'
|
||||||
% (suite.name, case.name))
|
% (case.name))
|
||||||
f.writeln(4*' '+'// test case %s' % case.name)
|
f.writeln(4*' '+'// test case %s' % case.name)
|
||||||
if case.code_lineno is not None:
|
if case.code_lineno is not None:
|
||||||
f.writeln(4*' '+'#line %d "%s"'
|
f.writeln(4*' '+'#line %d "%s"'
|
||||||
@@ -399,16 +399,16 @@ def compile(test_paths, **args):
|
|||||||
else:
|
else:
|
||||||
if case.defines:
|
if case.defines:
|
||||||
f.writeln('extern const test_define_t '
|
f.writeln('extern const test_define_t '
|
||||||
'__test__%s__%s__defines[]['
|
'__test__%s__defines[]['
|
||||||
'TEST_IMPLICIT_DEFINE_COUNT+%d];'
|
'TEST_IMPLICIT_DEFINE_COUNT+%d];'
|
||||||
% (suite.name, case.name, len(suite.defines)))
|
% (case.name, len(suite.defines)))
|
||||||
if suite.if_ is not None or case.if_ is not None:
|
if suite.if_ is not None or case.if_ is not None:
|
||||||
f.writeln('extern bool __test__%s__%s__filter('
|
f.writeln('extern bool __test__%s__filter('
|
||||||
'void);'
|
'void);'
|
||||||
% (suite.name, case.name))
|
% (case.name))
|
||||||
f.writeln('extern void __test__%s__%s__run('
|
f.writeln('extern void __test__%s__run('
|
||||||
'struct lfs_config *cfg);'
|
'struct lfs_config *cfg);'
|
||||||
% (suite.name, case.name))
|
% (case.name))
|
||||||
f.writeln()
|
f.writeln()
|
||||||
|
|
||||||
# create suite struct
|
# create suite struct
|
||||||
@@ -450,13 +450,13 @@ def compile(test_paths, **args):
|
|||||||
% len(case.permutations))
|
% len(case.permutations))
|
||||||
if case.defines:
|
if case.defines:
|
||||||
f.writeln(12*' '+'.defines '
|
f.writeln(12*' '+'.defines '
|
||||||
'= (const test_define_t*)__test__%s__%s__defines,'
|
'= (const test_define_t*)__test__%s__defines,'
|
||||||
% (suite.name, case.name))
|
% (case.name))
|
||||||
if suite.if_ is not None or case.if_ is not None:
|
if suite.if_ is not None or case.if_ is not None:
|
||||||
f.writeln(12*' '+'.filter = __test__%s__%s__filter,'
|
f.writeln(12*' '+'.filter = __test__%s__filter,'
|
||||||
% (suite.name, case.name))
|
% (case.name))
|
||||||
f.writeln(12*' '+'.run = __test__%s__%s__run,'
|
f.writeln(12*' '+'.run = __test__%s__run,'
|
||||||
% (suite.name, case.name))
|
% (case.name))
|
||||||
f.writeln(8*' '+'},')
|
f.writeln(8*' '+'},')
|
||||||
f.writeln(4*' '+'},')
|
f.writeln(4*' '+'},')
|
||||||
f.writeln(4*' '+'.case_count = %d,' % len(suite.cases))
|
f.writeln(4*' '+'.case_count = %d,' % len(suite.cases))
|
||||||
@@ -1044,7 +1044,8 @@ def run(runner, test_ids=[], **args):
|
|||||||
passed = 0
|
passed = 0
|
||||||
powerlosses = 0
|
powerlosses = 0
|
||||||
failures = []
|
failures = []
|
||||||
for by in (expected_case_perms.keys() if args.get('by_cases')
|
for by in (test_ids if test_ids
|
||||||
|
else expected_case_perms.keys() if args.get('by_cases')
|
||||||
else expected_suite_perms.keys() if args.get('by_suites')
|
else expected_suite_perms.keys() if args.get('by_suites')
|
||||||
else [None]):
|
else [None]):
|
||||||
# spawn jobs for stage
|
# spawn jobs for stage
|
||||||
@@ -1055,7 +1056,7 @@ def run(runner, test_ids=[], **args):
|
|||||||
killed) = run_stage(
|
killed) = run_stage(
|
||||||
by or 'tests',
|
by or 'tests',
|
||||||
runner_,
|
runner_,
|
||||||
[by] if by is not None else test_ids,
|
[by] if by is not None else [],
|
||||||
stdout,
|
stdout,
|
||||||
trace,
|
trace,
|
||||||
output,
|
output,
|
||||||
|
|||||||
Reference in New Issue
Block a user