Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
56a9903
Created new test_runner.c and test_.py
geky Apr 16, 2022
d683f1c
Reintroduced test-defines into the new test_runner
geky Apr 18, 2022
4b0aa62
Some more minor improvements to the test_runner
geky Apr 18, 2022
9281ce2
More test_runner progress
geky Apr 18, 2022
92a600a
Added trace and persist flags to test_runner
geky Apr 19, 2022
6443693
Putting together rewritten test.py script
geky Apr 24, 2022
5812d2b
Reworked how multi-layered defines work in the test-runner
geky Apr 25, 2022
5ee4b05
Misc test-runner improvements
geky Apr 25, 2022
4962829
Continued progress toward feature parity with new test-runner
geky May 1, 2022
be0e6ad
More progress toward test-runner feature parity
geky May 2, 2022
5a572ce
Reworked how test defines are implemented to support recursion
geky May 8, 2022
d679fbb
In ./scripts/test.py, readded external commands, tweaked subprocesses
geky May 8, 2022
0781f50
Ported tests to new framework
geky May 14, 2022
4a42326
Moved test suites into custom linker section
geky May 14, 2022
1616115
Fix test.py hang on ctrl-C, cleanup TODOs
geky May 15, 2022
2b11f2b
Tweaked generation of .cgi files, error code for recursion in stack.py
geky May 15, 2022
4a7e94f
Reimplemented coverage.py, using only gcov and with line+branch coverage
geky May 16, 2022
5b0a6d4
Reworked scripts to move field details into classes
geky May 21, 2022
46cc6d4
Added support for annotated source in coverage.py
geky May 23, 2022
92eee8e
Removed some prefixes from Makefile variables where not necessary
geky Aug 15, 2022
b08463f
Reworked scripts/pretty_asserts.py a bit
geky Aug 16, 2022
a368d3a
Moved emulation of erase values up into lfs_testbd
geky Aug 17, 2022
01b11da
Added a simple test that the block device works
geky Aug 17, 2022
61455b6
Added back heuristic-based power-loss testing
geky Aug 19, 2022
4689678
Added --color to test.py, fixed some terminal-clobbering issues
geky Aug 22, 2022
3f4f859
Readded support for mirror writes to a file in testbd
geky Aug 23, 2022
552336e
Added optional read/prog/erase delays to testbd
geky Aug 23, 2022
5279fc6
Implemented exhaustive testing of n nested powerlosses
geky Aug 25, 2022
c9a6e3a
Added tailpipe.py and improved redirecting test trace/log output over…
geky Aug 27, 2022
91200e6
Added tracebd.py, a script for rendering block device operations
geky Sep 2, 2022
a208d84
Reworked test defines a bit to use one common array layout
geky Sep 6, 2022
c7f7094
Several tweaks to test.py and test runner
geky Sep 9, 2022
5a2ff17
Changed test identifier separator # -> :
geky Sep 9, 2022
bfbe44e
Dropped permutation number for full leb16-encoded defines
geky Sep 10, 2022
03c1a4e
Added permutations and ranges to test defines
geky Sep 11, 2022
23fba40
Added option for updating a CSV file with test results
geky Sep 12, 2022
acdea18
Made summary.py more powerful, dropped -m from size scripts
geky Sep 14, 2022
1fcd82d
Made test.py output parsable by summary.py
geky Sep 16, 2022
11d6d12
Dropped namespacing of test cases
geky Sep 17, 2022
20ec0be
Cleaned up a number of small tweaks in the scripts
geky Sep 19, 2022
4fe0738
Added bench.py and bench_runner.c for benchmarking
geky Sep 20, 2022
9a0e3be
Added a quick trie to avoid running redundant test/bench permutations
geky Sep 20, 2022
7591d9c
Added plot.py for in-terminal plotting
geky Sep 22, 2022
fb58148
Consistent handling of by/field arguments for plot.py and summary.py
geky Sep 23, 2022
42d889e
Reworked/simplified tracebd.py a bit
geky Sep 25, 2022
9507e62
Several tweaks to script flags
geky Sep 27, 2022
a2fb708
Added stddev/gmean/gstddev to summary.py
geky Sep 27, 2022
274222b
Added some automatic sizing for field-names in scripts/runners
geky Sep 27, 2022
296c5af
Renamed bench_read/prog/erased -> bench_readed/proged/erased
geky Sep 27, 2022
ca66993
Tweaked scripts to share more code, added coverage calls/hits
geky Oct 2, 2022
490e1c4
Added perf.py a wrapper around Linux's perf tool for perf sampling
geky Oct 2, 2022
df283ae
Added recursive results to perf.py
geky Oct 9, 2022
29cbafe
Renamed coverage.py -> cov.py
geky Oct 9, 2022
3a33c37
Added perfbd.py and block device performance sampling in bench-runner
geky Oct 13, 2022
b2a2cc9
Added teepipe.py and watch.py
geky Oct 16, 2022
559e174
Added plotmpl.py for creating svg/png plots with matplotlib
geky Oct 20, 2022
6fce9e5
Changed plotmpl.py/plot.py to not treat missing values as discontinui…
geky Nov 10, 2022
1a07c2c
A number of small script fixes/tweaks from usage
geky Nov 11, 2022
e35e078
Renamed prefix.py -> changeprefix.py and updated to use argparse
geky Nov 16, 2022
bcc88f5
A couple Makefile-related tweaks
geky Nov 17, 2022
f734941
Changed default build target lfs.a -> liblfs.a
geky Nov 17, 2022
6c18b4d
Added a simple help rule to the Makefile
geky Nov 17, 2022
f89d758
Fixed test out-of-space issues with powerloss testing
geky Nov 28, 2022
eba5553
Fixed hidden orphans by separating deorphan search into two passes
geky Nov 28, 2022
0b11ce0
Fixed incorrect calculation of extra space needed in mdir blocks
geky Nov 19, 2022
387cf6f
Fixed a couple corner cases in scripts when fields are empty
geky Nov 19, 2022
65923cd
Adopted script changes in GitHub Actions
geky Nov 17, 2022
397aa27
Removed unnecessarily heavy RAM usage from logs in bench/test.py
geky Nov 23, 2022
a659c02
Added a bot-generated PR-comment with a simple status table
geky Nov 23, 2022
4a20934
Fixed bench workflow + changeprefix issue in prefix releases
geky Nov 27, 2022
0c781dd
Merge remote-tracking branch 'origin/master' into test-and-bench-runners
geky Dec 7, 2022
9990342
Fixed Clang testing in CI, removed override vars in Makefile
geky Nov 29, 2022
c4b3e9d
A couple of script changes after CI integration
geky Nov 29, 2022
9b687dd
Added make benchmarks/testmarks rules
geky Nov 29, 2022
cda2f6f
Changed test_runner to run with -Pnone,linear by default
geky Nov 30, 2022
d8e7ffb
Changed lfs_emubd_get* -> lfs_emubd_*
geky Nov 30, 2022
b0382fa
Added BENCH/TEST_PRNG, replacing other ad-hoc sources of randomness
geky Nov 30, 2022
2d2dd8b
Added plotmpl.py --github flag to match the website's foreground/back…
geky Dec 2, 2022
cfd4e60
Added --subplot* to plotmpl.py
geky Dec 13, 2022
1f37eb5
Adopted --subplot* in plot.py
geky Dec 15, 2022
801cf27
Tweaked/fixed a number of small runner things after a bit of use
geky Dec 17, 2022
c2147c4
Added --gdb-pl to test.py for breaking on specific powerlosses
geky Dec 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added trace and persist flags to test_runner
  • Loading branch information
geky committed Apr 19, 2022
commit 92a600a980438c4506ff46c95588c5af347ac879
2 changes: 2 additions & 0 deletions bd/lfs_filebd.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ extern "C"


// Block device specific tracing
#ifndef LFS_FILEBD_TRACE
#ifdef LFS_FILEBD_YES_TRACE
#define LFS_FILEBD_TRACE(...) LFS_TRACE(__VA_ARGS__)
#else
#define LFS_FILEBD_TRACE(...)
#endif
#endif

// filebd config (optional)
struct lfs_filebd_config {
Expand Down
2 changes: 2 additions & 0 deletions bd/lfs_rambd.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ extern "C"


// Block device specific tracing
#ifndef LFS_RAMBD_TRACE
#ifdef LFS_RAMBD_YES_TRACE
#define LFS_RAMBD_TRACE(...) LFS_TRACE(__VA_ARGS__)
#else
#define LFS_RAMBD_TRACE(...)
#endif
#endif

// rambd config (optional)
struct lfs_rambd_config {
Expand Down
2 changes: 2 additions & 0 deletions bd/lfs_testbd.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ extern "C"


// Block device specific tracing
#ifndef LFS_TESTBD_TRACE
#ifdef LFS_TESTBD_YES_TRACE
#define LFS_TESTBD_TRACE(...) LFS_TRACE(__VA_ARGS__)
#else
#define LFS_TESTBD_TRACE(...)
#endif
#endif

// Mode determining how "bad blocks" behave during testing. This simulates
// some real-world circumstances such as progs not sticking (prog-noop),
Expand Down
41 changes: 38 additions & 3 deletions runners/test_runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <getopt.h>
#include <sys/types.h>
#include <errno.h>

// disk geometries
struct test_geometry {
Expand Down Expand Up @@ -126,6 +127,9 @@ static test_define_t *override_defines = NULL;
static size_t override_count = 0;
static size_t override_cap = 0;

static const char *test_persist = NULL;
FILE *test_trace = NULL;

// note, these skips are different than filtered tests
static bool test_suite_skip(const struct test_suite *suite) {
return (test_suite && strcmp(suite->name, test_suite) != 0)
Expand Down Expand Up @@ -491,7 +495,12 @@ static void run(void) {
.power_cycles = 0,
};

lfs_testbd_createcfg(&cfg, NULL, &bdcfg) => 0;
int err = lfs_testbd_createcfg(&cfg, test_persist, &bdcfg);
if (err) {
fprintf(stderr, "error: "
"could not create block device: %d\n", err);
exit(-1);
}

// run the test
printf("running %s#%zu\n", test_suites[i]->cases[j]->id, perm);
Expand All @@ -501,7 +510,12 @@ static void run(void) {
printf("finished %s#%zu\n", test_suites[i]->cases[j]->id, perm);

// cleanup
lfs_testbd_destroy(&cfg) => 0;
err = lfs_testbd_destroy(&cfg);
if (err) {
fprintf(stderr, "error: "
"could not destroy block device: %d\n", err);
exit(-1);
}

test_define_geometry(NULL);
test_define_case(NULL, 0);
Expand Down Expand Up @@ -532,9 +546,11 @@ enum opt_flags {
OPT_SKIP = 4,
OPT_COUNT = 5,
OPT_EVERY = 6,
OPT_PERSIST = 'p',
OPT_TRACE = 't',
};

const char *short_opts = "hYlLD:G:nrV";
const char *short_opts = "hYlLD:G:nrVp:t:";

const struct option long_opts[] = {
{"help", no_argument, NULL, OPT_HELP},
Expand All @@ -552,6 +568,8 @@ const struct option long_opts[] = {
{"skip", required_argument, NULL, OPT_SKIP},
{"count", required_argument, NULL, OPT_COUNT},
{"every", required_argument, NULL, OPT_EVERY},
{"persist", required_argument, NULL, OPT_PERSIST},
{"trace", required_argument, NULL, OPT_TRACE},
{NULL, 0, NULL, 0},
};

Expand All @@ -571,6 +589,8 @@ const char *const help_text[] = {
"Skip the first n tests.",
"Stop after n tests.",
"Only run every n tests, calculated after --skip and --stop.",
"Persist the disk to this file.",
"Redirect trace output to this file.",
};

int main(int argc, char **argv) {
Expand Down Expand Up @@ -727,6 +747,21 @@ int main(int argc, char **argv) {
}
break;
}
case OPT_PERSIST:
test_persist = optarg;
break;
case OPT_TRACE:
if (strcmp(optarg, "-") == 0) {
test_trace = stdout;
} else {
test_trace = fopen(optarg, "w");
if (!test_trace) {
fprintf(stderr, "error: could not open for trace: %d\n",
-errno);
exit(-1);
}
}
break;
// done parsing
case -1:
goto getopt_done;
Expand Down
32 changes: 30 additions & 2 deletions scripts/test_.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
TEST_PATHS = ['tests_']

SUITE_PROLOGUE = """
//////// AUTOGENERATED ////////
#include "runners/test_runner.h"
#include <stdio.h>
"""
Expand Down Expand Up @@ -222,7 +221,21 @@ def compile(**args):
suite = TestSuite(paths[0])
if 'output' in args:
with openio(args['output'], 'w') as f:
f.write(SUITE_PROLOGUE)
# redirect littlefs tracing
f.write('#define LFS_TRACE_(fmt, ...) do { \\\n')
f.write(8*' '+'extern FILE *test_trace; \\\n')
f.write(8*' '+'if (test_trace) { \\\n')
f.write(12*' '+'fprintf(test_trace, '
'"%s:%d:trace: " fmt "%s\\n", \\\n')
f.write(20*' '+'__FILE__, __LINE__, __VA_ARGS__); \\\n')
f.write(8*' '+'} \\\n')
f.write(4*' '+'} while (0)\n')
f.write('#define LFS_TRACE(...) LFS_TRACE_(__VA_ARGS__, "")\n')
f.write('#define LFS_TESTBD_TRACE(...) '
'LFS_TRACE_(__VA_ARGS__, "")\n')
f.write('\n')

f.write('%s\n' % SUITE_PROLOGUE.strip())
f.write('\n')
if suite.code is not None:
if suite.code_lineno is not None:
Expand Down Expand Up @@ -380,6 +393,21 @@ def compile(**args):
# write out a test source
if 'output' in args:
with openio(args['output'], 'w') as f:
# redirect littlefs tracing
f.write('#define LFS_TRACE_(fmt, ...) do { \\\n')
f.write(8*' '+'extern FILE *test_trace; \\\n')
f.write(8*' '+'if (test_trace) { \\\n')
f.write(12*' '+'fprintf(test_trace, '
'"%s:%d:trace: " fmt "%s\\n", \\\n')
f.write(20*' '+'__FILE__, __LINE__, __VA_ARGS__); \\\n')
f.write(8*' '+'} \\\n')
f.write(4*' '+'} while (0)\n')
f.write('#define LFS_TRACE(...) LFS_TRACE_(__VA_ARGS__, "")\n')
f.write('#define LFS_TESTBD_TRACE(...) '
'LFS_TRACE_(__VA_ARGS__, "")\n')
f.write('\n')

# copy source
f.write('#line 1 "%s"\n' % args['source'])
with open(args['source']) as sf:
shutil.copyfileobj(sf, f)
Expand Down