Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Haster <chaster@utexas.edu>2020-01-27 04:16:57 +0300
committerChristopher Haster <chaster@utexas.edu>2020-01-27 08:53:53 +0300
commit52ef0c1c9efac025b71f2bf3d33e8785538e88c7 (patch)
tree2aa183ca6d0b1d7e03a3d808a9b2e7b8f05428f6 /scripts
parentb9d0695e0a026d144772480f339e577782729949 (diff)
Fixed a crazy consistency issue in test.py
The root of the problem was the notorious Python quirk with mutable default parameters. The default defines for the TestSuite class ended up being mutated as the class determined the permutations to test, corrupting other test's defines. However, the only define that was mutated this way was the CACHE_SIZE config in test_entries. The crazy thing was how this small innocuous change would cause "./scripts/test.py -nr test_relocations" and "./scripts/test.py -nr" to drift out of sync only after a commit spanning the different cache sizes would be written out with a different number of prog calls. This offset the power-cycle counter enough to cause one case to make it to an erase, and the other to not. Normally, the difference between a successful/unsuccessful erase wouldn't change the result of a test, but in this case it offset the revision count used for wear-leveling, causing one run run expand the superblock and the other to not. This change to the filesystem would then propogate through the rest of the test, making it difficult to reproduce test failures. Fortunately the fix was to just make a copy of the default define dictionary. This should also prevent accidently mutating of dicts belonging to our caller. Oh, also fixed a buffer overflow in test_files.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/test_.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/test_.py b/scripts/test_.py
index 1a13c5b..4593b40 100755
--- a/scripts/test_.py
+++ b/scripts/test_.py
@@ -304,8 +304,8 @@ class ReentrantTestCase(TestCase):
# exact cycle we should drop into debugger?
if gdb and failure and failure.cycleno == cycles:
- return super().test(gdb=gdb,
- persist=persist, failure=failure, **args)
+ return super().test(gdb=gdb, persist=persist, cycles=cycles,
+ failure=failure, **args)
# run tests, but kill the program after prog/erase has
# been hit n cycles. We exit with a special return code if the
@@ -327,7 +327,7 @@ class TestSuite:
self.name = self.name[:-len('.toml')]
self.path = path
self.classes = classes
- self.defines = defines
+ self.defines = defines.copy()
self.filter = filter
with open(path) as f: