mirror of
https://github.com/littlefs-project/littlefs.git
synced 2025-11-16 12:34:34 +00:00
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:
@@ -164,6 +164,19 @@ int lfs_emubd_createcfg(const struct lfs_config *cfg, const char *path,
|
|||||||
memset(bd->disk->scratch,
|
memset(bd->disk->scratch,
|
||||||
bd->cfg->erase_value,
|
bd->cfg->erase_value,
|
||||||
cfg->block_size);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
|
/*
|
||||||
|
* Runner for littlefs benchmarks
|
||||||
|
*
|
||||||
|
* Copyright (c) 2022, The littlefs authors.
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
#ifndef _POSIX_C_SOURCE
|
#ifndef _POSIX_C_SOURCE
|
||||||
#define _POSIX_C_SOURCE 199309L
|
#define _POSIX_C_SOURCE 199309L
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
/*
|
||||||
|
* Runner for littlefs benchmarks
|
||||||
|
*
|
||||||
|
* Copyright (c) 2022, The littlefs authors.
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
#ifndef BENCH_RUNNER_H
|
#ifndef BENCH_RUNNER_H
|
||||||
#define BENCH_RUNNER_H
|
#define BENCH_RUNNER_H
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
|
/*
|
||||||
|
* Runner for littlefs tests
|
||||||
|
*
|
||||||
|
* Copyright (c) 2022, The littlefs authors.
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
#ifndef _POSIX_C_SOURCE
|
#ifndef _POSIX_C_SOURCE
|
||||||
#define _POSIX_C_SOURCE 199309L
|
#define _POSIX_C_SOURCE 199309L
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
/*
|
||||||
|
* Runner for littlefs tests
|
||||||
|
*
|
||||||
|
* Copyright (c) 2022, The littlefs authors.
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
#ifndef TEST_RUNNER_H
|
#ifndef TEST_RUNNER_H
|
||||||
#define TEST_RUNNER_H
|
#define TEST_RUNNER_H
|
||||||
|
|
||||||
|
|||||||
@@ -118,6 +118,8 @@ class BenchCase:
|
|||||||
else:
|
else:
|
||||||
yield v_
|
yield v_
|
||||||
# or a literal value
|
# or a literal value
|
||||||
|
elif isinstance(v, bool):
|
||||||
|
yield 'true' if v else 'false'
|
||||||
else:
|
else:
|
||||||
yield v
|
yield v
|
||||||
|
|
||||||
@@ -817,8 +819,6 @@ def run_stage(name, runner_, ids, stdout_, trace_, output_, **args):
|
|||||||
stdout_.flush()
|
stdout_.flush()
|
||||||
except BrokenPipeError:
|
except BrokenPipeError:
|
||||||
pass
|
pass
|
||||||
if args.get('verbose'):
|
|
||||||
sys.stdout.write(line)
|
|
||||||
|
|
||||||
m = pattern.match(line)
|
m = pattern.match(line)
|
||||||
if m:
|
if m:
|
||||||
|
|||||||
@@ -535,7 +535,7 @@ def datasets(results, by=None, x=None, y=None, define=[]):
|
|||||||
results,
|
results,
|
||||||
x_,
|
x_,
|
||||||
y_,
|
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 [])
|
if by is not None else [])
|
||||||
|
|
||||||
return datasets
|
return datasets
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ def datasets(results, by=None, x=None, y=None, define=[]):
|
|||||||
results,
|
results,
|
||||||
x_,
|
x_,
|
||||||
y_,
|
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 [])
|
if by is not None else [])
|
||||||
|
|
||||||
return datasets
|
return datasets
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ LEXEMES = {
|
|||||||
'cmp': CMP.keys(),
|
'cmp': CMP.keys(),
|
||||||
'logic': ['\&\&', '\|\|'],
|
'logic': ['\&\&', '\|\|'],
|
||||||
'sep': [':', ';', '\{', '\}', ','],
|
'sep': [':', ';', '\{', '\}', ','],
|
||||||
|
'op': ['->'], # specifically ops that conflict with cmp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -330,7 +331,7 @@ def p_expr(p):
|
|||||||
except ParseFailure:
|
except ParseFailure:
|
||||||
p.pop(state)
|
p.pop(state)
|
||||||
res.append(p.expect('assert'))
|
res.append(p.expect('assert'))
|
||||||
elif p.accept('string', None, 'ws'):
|
elif p.accept('string', 'op', 'ws', None):
|
||||||
res.append(p.m)
|
res.append(p.m)
|
||||||
else:
|
else:
|
||||||
return ''.join(res)
|
return ''.join(res)
|
||||||
@@ -414,7 +415,8 @@ def main(input=None, output=None, pattern=[], limit=LIMIT):
|
|||||||
f.write(p.m)
|
f.write(p.m)
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
except ParseFailure as f:
|
except ParseFailure as e:
|
||||||
|
print('warning: %s' % e)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
for i in range(p.off, len(p.tokens)):
|
for i in range(p.off, len(p.tokens)):
|
||||||
|
|||||||
@@ -121,6 +121,8 @@ class TestCase:
|
|||||||
else:
|
else:
|
||||||
yield v_
|
yield v_
|
||||||
# or a literal value
|
# or a literal value
|
||||||
|
elif isinstance(v, bool):
|
||||||
|
yield 'true' if v else 'false'
|
||||||
else:
|
else:
|
||||||
yield v
|
yield v
|
||||||
|
|
||||||
@@ -827,8 +829,6 @@ def run_stage(name, runner_, ids, stdout_, trace_, output_, **args):
|
|||||||
stdout_.flush()
|
stdout_.flush()
|
||||||
except BrokenPipeError:
|
except BrokenPipeError:
|
||||||
pass
|
pass
|
||||||
if args.get('verbose'):
|
|
||||||
sys.stdout.write(line)
|
|
||||||
|
|
||||||
m = pattern.match(line)
|
m = pattern.match(line)
|
||||||
if m:
|
if m:
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ code = '''
|
|||||||
|
|
||||||
# expanding superblock
|
# expanding superblock
|
||||||
[cases.test_superblocks_expand]
|
[cases.test_superblocks_expand]
|
||||||
defines.LFS_BLOCK_CYCLES = [32, 33, 1]
|
defines.BLOCK_CYCLES = [32, 33, 1]
|
||||||
defines.N = [10, 100, 1000]
|
defines.N = [10, 100, 1000]
|
||||||
code = '''
|
code = '''
|
||||||
lfs_t lfs;
|
lfs_t lfs;
|
||||||
@@ -70,7 +70,7 @@ code = '''
|
|||||||
|
|
||||||
# expanding superblock with power cycle
|
# expanding superblock with power cycle
|
||||||
[cases.test_superblocks_expand_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]
|
defines.N = [10, 100, 1000]
|
||||||
code = '''
|
code = '''
|
||||||
lfs_t lfs;
|
lfs_t lfs;
|
||||||
@@ -108,7 +108,7 @@ code = '''
|
|||||||
|
|
||||||
# reentrant expanding superblock
|
# reentrant expanding superblock
|
||||||
[cases.test_superblocks_reentrant_expand]
|
[cases.test_superblocks_reentrant_expand]
|
||||||
defines.LFS_BLOCK_CYCLES = [2, 1]
|
defines.BLOCK_CYCLES = [2, 1]
|
||||||
defines.N = 24
|
defines.N = 24
|
||||||
reentrant = true
|
reentrant = true
|
||||||
code = '''
|
code = '''
|
||||||
|
|||||||
Reference in New Issue
Block a user