diff options
| author | Jim Mussared <jim.mussared@gmail.com> | 2021-08-16 22:45:06 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2021-08-17 11:20:58 +1000 |
| commit | 91a99fcf0e79ccd8099881f744467fc32bd93672 (patch) | |
| tree | e6735b96f1691b3325190113db8ddbe87bba608f | |
| parent | 0c2cadf1c8c733878a5ecfe65fe339a8702f76bd (diff) | |
tests/extmod/vfs_fat_finaliser.py: Ensure alloc at never-used GC blocks.
Prevents the finaliser from being missed if there's a dangling reference
on the stack to one of the blocks for the files (that this test checks
that they get finalised).
See github.com/micropython/micropython/pull/7659#issuecomment-899479793
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
| -rw-r--r-- | tests/extmod/vfs_fat_finaliser.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/extmod/vfs_fat_finaliser.py b/tests/extmod/vfs_fat_finaliser.py index e30f42f84..b67afc2d9 100644 --- a/tests/extmod/vfs_fat_finaliser.py +++ b/tests/extmod/vfs_fat_finaliser.py @@ -56,6 +56,13 @@ micropython.heap_unlock() # Here we test that the finaliser is actually called during a garbage collection. import gc +# 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 +# therefore couldn't possibly have any references to them left behind on +# the stack. +for i in range(1024): + [] + N = 4 for i in range(N): n = "x%d" % i |
