diff --git a/bd/lfs_emubd.c b/bd/lfs_emubd.c index cf82f561..8b42ac5b 100644 --- a/bd/lfs_emubd.c +++ b/bd/lfs_emubd.c @@ -164,6 +164,19 @@ int lfs_emubd_createcfg(const struct lfs_config *cfg, const char *path, memset(bd->disk->scratch, bd->cfg->erase_value, cfg->block_size); + + // go ahead and erase all of the disk, otherwise the file will not + // match our internal representation + for (size_t i = 0; i < cfg->block_count; i++) { + ssize_t res = write(bd->disk->fd, + bd->disk->scratch, + cfg->block_size); + if (res < 0) { + int err = -errno; + LFS_EMUBD_TRACE("lfs_emubd_create -> %d", err); + return err; + } + } } } diff --git a/runners/bench_runner.c b/runners/bench_runner.c index cb814dd6..afb4c16c 100644 --- a/runners/bench_runner.c +++ b/runners/bench_runner.c @@ -1,4 +1,9 @@ - +/* + * Runner for littlefs benchmarks + * + * Copyright (c) 2022, The littlefs authors. + * SPDX-License-Identifier: BSD-3-Clause + */ #ifndef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 199309L #endif diff --git a/runners/bench_runner.h b/runners/bench_runner.h index a33c31d8..71ed5e31 100644 --- a/runners/bench_runner.h +++ b/runners/bench_runner.h @@ -1,3 +1,9 @@ +/* + * Runner for littlefs benchmarks + * + * Copyright (c) 2022, The littlefs authors. + * SPDX-License-Identifier: BSD-3-Clause + */ #ifndef BENCH_RUNNER_H #define BENCH_RUNNER_H diff --git a/runners/test_runner.c b/runners/test_runner.c index 076f6259..ea0864da 100644 --- a/runners/test_runner.c +++ b/runners/test_runner.c @@ -1,4 +1,9 @@ - +/* + * Runner for littlefs tests + * + * Copyright (c) 2022, The littlefs authors. + * SPDX-License-Identifier: BSD-3-Clause + */ #ifndef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 199309L #endif diff --git a/runners/test_runner.h b/runners/test_runner.h index f9561509..48e58dc7 100644 --- a/runners/test_runner.h +++ b/runners/test_runner.h @@ -1,3 +1,9 @@ +/* + * Runner for littlefs tests + * + * Copyright (c) 2022, The littlefs authors. + * SPDX-License-Identifier: BSD-3-Clause + */ #ifndef TEST_RUNNER_H #define TEST_RUNNER_H diff --git a/scripts/bench.py b/scripts/bench.py index 225e5231..13d8f084 100755 --- a/scripts/bench.py +++ b/scripts/bench.py @@ -118,6 +118,8 @@ class BenchCase: else: yield v_ # or a literal value + elif isinstance(v, bool): + yield 'true' if v else 'false' else: yield v @@ -817,8 +819,6 @@ def run_stage(name, runner_, ids, stdout_, trace_, output_, **args): stdout_.flush() except BrokenPipeError: pass - if args.get('verbose'): - sys.stdout.write(line) m = pattern.match(line) if m: diff --git a/scripts/plot.py b/scripts/plot.py index d2e64017..891e9433 100755 --- a/scripts/plot.py +++ b/scripts/plot.py @@ -535,7 +535,7 @@ def datasets(results, by=None, x=None, y=None, define=[]): results, x_, y_, - [(by_, k_) for by_, k_ in zip(by, ks_)] + [(by_, {k_}) for by_, k_ in zip(by, ks_)] if by is not None else []) return datasets diff --git a/scripts/plotmpl.py b/scripts/plotmpl.py index 52286525..faea5983 100755 --- a/scripts/plotmpl.py +++ b/scripts/plotmpl.py @@ -286,7 +286,7 @@ def datasets(results, by=None, x=None, y=None, define=[]): results, x_, y_, - [(by_, k_) for by_, k_ in zip(by, ks_)] + [(by_, {k_}) for by_, k_ in zip(by, ks_)] if by is not None else []) return datasets diff --git a/scripts/prettyasserts.py b/scripts/prettyasserts.py index b10fdda1..3a62d360 100755 --- a/scripts/prettyasserts.py +++ b/scripts/prettyasserts.py @@ -39,6 +39,7 @@ LEXEMES = { 'cmp': CMP.keys(), 'logic': ['\&\&', '\|\|'], 'sep': [':', ';', '\{', '\}', ','], + 'op': ['->'], # specifically ops that conflict with cmp } @@ -330,7 +331,7 @@ def p_expr(p): except ParseFailure: p.pop(state) res.append(p.expect('assert')) - elif p.accept('string', None, 'ws'): + elif p.accept('string', 'op', 'ws', None): res.append(p.m) else: return ''.join(res) @@ -414,7 +415,8 @@ def main(input=None, output=None, pattern=[], limit=LIMIT): f.write(p.m) else: break - except ParseFailure as f: + except ParseFailure as e: + print('warning: %s' % e) pass for i in range(p.off, len(p.tokens)): diff --git a/scripts/test.py b/scripts/test.py index 5ceb4208..929129af 100755 --- a/scripts/test.py +++ b/scripts/test.py @@ -121,6 +121,8 @@ class TestCase: else: yield v_ # or a literal value + elif isinstance(v, bool): + yield 'true' if v else 'false' else: yield v @@ -827,8 +829,6 @@ def run_stage(name, runner_, ids, stdout_, trace_, output_, **args): stdout_.flush() except BrokenPipeError: pass - if args.get('verbose'): - sys.stdout.write(line) m = pattern.match(line) if m: diff --git a/tests/test_superblocks.toml b/tests/test_superblocks.toml index d45d7887..689bbcd2 100644 --- a/tests/test_superblocks.toml +++ b/tests/test_superblocks.toml @@ -36,7 +36,7 @@ code = ''' # expanding superblock [cases.test_superblocks_expand] -defines.LFS_BLOCK_CYCLES = [32, 33, 1] +defines.BLOCK_CYCLES = [32, 33, 1] defines.N = [10, 100, 1000] code = ''' lfs_t lfs; @@ -70,7 +70,7 @@ code = ''' # expanding superblock with power cycle [cases.test_superblocks_expand_power_cycle] -defines.LFS_BLOCK_CYCLES = [32, 33, 1] +defines.BLOCK_CYCLES = [32, 33, 1] defines.N = [10, 100, 1000] code = ''' lfs_t lfs; @@ -108,7 +108,7 @@ code = ''' # reentrant expanding superblock [cases.test_superblocks_reentrant_expand] -defines.LFS_BLOCK_CYCLES = [2, 1] +defines.BLOCK_CYCLES = [2, 1] defines.N = 24 reentrant = true code = '''