diff options
| author | Damien George <damien@micropython.org> | 2023-09-27 15:28:42 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2023-09-29 12:02:36 +1000 |
| commit | 62c3033ba6af8a498644716819ac91522d372305 (patch) | |
| tree | 628c21a95692def216f07db5b9025ff54e52f811 | |
| parent | 7c88cdda49f98d76bc10b9d864fa1675acf46afc (diff) | |
tests/extmod/vfs_fat_finaliser.py: Tweak test so files are collected.
Signed-off-by: Damien George <damien@micropython.org>
| -rw-r--r-- | tests/extmod/vfs_fat_finaliser.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/extmod/vfs_fat_finaliser.py b/tests/extmod/vfs_fat_finaliser.py index b6c7dffb8..a2cce7846 100644 --- a/tests/extmod/vfs_fat_finaliser.py +++ b/tests/extmod/vfs_fat_finaliser.py @@ -64,7 +64,7 @@ import gc # in turn allocate new qstrs and/or a new qstr pool). f = None n = None -names = ["x%d" % i for i in range(4)] +names = ["x%d" % i for i in range(5)] # Do a large number of single-block allocations to move the GC head forwards, # ensuring that the files are allocated from never-before-used blocks and @@ -74,12 +74,13 @@ for i in range(1024): [] # Run the test: create files without closing them, run GC, then read back files. +# Only read back N-1 files because the last one may not be finalised due to +# references to it being left on the C stack. for n in names: f = vfs.open(n, "w") f.write(n) f = None # release f without closing - sorted([0, 1, 2, 3], key=lambda x: x) # use up Python and C stack so f is really gone -gc.collect() # should finalise all N files by closing them -for n in names: +gc.collect() # should finalise at least the first N-1 files by closing them +for n in names[:-1]: with vfs.open(n, "r") as f: print(f.read()) |
