Skip to content

Commit

Permalink
iotests: fix leak of tmpdir in dry-run mode
Browse files Browse the repository at this point in the history
Creating an instance of the 'TestEnv' class will create a temporary
directory. This dir is only deleted, however, in the __exit__ handler
invoked by a context manager.

In dry-run mode, we don't use the TestEnv via a context manager, so
were leaking the temporary directory. Since meson invokes 'check'
5 times on each configure run, developers /tmp was filling up with
empty temporary directories.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20240205154019.1841037-1-berrange@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit c645bac)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
berrange authored and Michael Tokarev committed Feb 12, 2024
1 parent bbfcb0f commit 88555e3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/qemu-iotests/check
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ if __name__ == '__main__':
sys.exit(str(e))

if args.dry_run:
print('\n'.join([os.path.basename(t) for t in tests]))
with env:
print('\n'.join([os.path.basename(t) for t in tests]))
else:
with TestRunner(env, tap=args.tap,
color=args.color) as tr:
Expand Down

0 comments on commit 88555e3

Please sign in to comment.