mirror of
https://github.com/littlefs-project/littlefs.git
synced 2025-12-01 12:20:02 +00:00
Added reentrant and gdb testing mechanisms to test framework
Aside from reworking the internals of test_.py to work well with inherited TestCase classes, this also provides the two main features that were the main reason for revamping the test framework 1. ./scripts/test_.py --reentrant Runs reentrant tests (tests with reentrant=true in the .toml configuration) under gdb such that the program is killed on every call to lfs_emubd_prog or lfs_emubd_erase. Currently this just increments a number of prog/erases to skip, which means it doesn't necessarily check every possible branch of the test, but this should still provide a good coverage of power-loss tests. 2. ./scripts/test_.py --gdb Run the tests and if a failure is hit, drop into GDB. In theory this will be very useful for reproducing and debugging test failures. Note this can be combined with --reentrant to drop into GDB on the exact cycle of power-loss where the tests fail.
This commit is contained in:
@ -16,7 +16,8 @@ ASSERT_TESTS = {
|
||||
printf("%s:%d:assert: "
|
||||
"assert failed with %"PRIiMAX", expected {comp} %"PRIiMAX"\\n",
|
||||
{file}, {line}, (intmax_t)_lh, (intmax_t)_rh);
|
||||
exit(-2);
|
||||
fflush(NULL);
|
||||
raise(SIGABRT);
|
||||
}}
|
||||
""",
|
||||
'str': """
|
||||
@ -26,7 +27,8 @@ ASSERT_TESTS = {
|
||||
printf("%s:%d:assert: "
|
||||
"assert failed with \\\"%s\\\", expected {comp} \\\"%s\\\"\\n",
|
||||
{file}, {line}, _lh, _rh);
|
||||
exit(-2);
|
||||
fflush(NULL);
|
||||
raise(SIGABRT);
|
||||
}}
|
||||
""",
|
||||
'bool': """
|
||||
@ -36,7 +38,8 @@ ASSERT_TESTS = {
|
||||
printf("%s:%d:assert: "
|
||||
"assert failed with %s, expected {comp} %s\\n",
|
||||
{file}, {line}, _lh ? "true" : "false", _rh ? "true" : "false");
|
||||
exit(-2);
|
||||
fflush(NULL);
|
||||
raise(SIGABRT);
|
||||
}}
|
||||
""",
|
||||
}
|
||||
@ -180,6 +183,7 @@ def main(args):
|
||||
outf.write("#include <stdbool.h>\n")
|
||||
outf.write("#include <stdint.h>\n")
|
||||
outf.write("#include <inttypes.h>\n")
|
||||
outf.write("#include <signal.h>\n")
|
||||
outf.write(mkdecl('int', 'eq', '=='))
|
||||
outf.write(mkdecl('int', 'ne', '!='))
|
||||
outf.write(mkdecl('int', 'lt', '<'))
|
||||
|
||||
Reference in New Issue
Block a user