A number of small script fixes/tweaks from usage

- Fixed prettyasserts.py parsing when '->' is in expr

- Made prettyasserts.py failures not crash (yay dynamic typing)

- Fixed the initial state of the emubd disk file to match the internal
  state in RAM

- Fixed true/false getting changed to True/False in test.py/bench.py
  defines

- Fixed accidental substring matching in plot.py's --by comparison

- Fixed a missed LFS_BLOCk_CYCLES in test_superblocks.toml that was
  missed

- Changed test.py/bench.py -v to only show commands being run

  Including the test output is still possible with test.py -v -O-, making
  the implicit inclusion redundant and noisy.

- Added license comments to bench_runner/test_runner
This commit is contained in:
Christopher Haster
2022-11-11 16:00:10 -06:00
parent 6fce9e5156
commit 1a07c2ce0d
11 changed files with 50 additions and 13 deletions

View File

@@ -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;
}
}
}
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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:

View File

@@ -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

View File

@@ -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

View File

@@ -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)):

View File

@@ -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:

View File

@@ -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 = '''