iotests: fix leak of tmpdir in dry-run mode

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>
This commit is contained in:
Daniel P. Berrangé 2024-02-05 15:40:19 +00:00 committed by Kevin Wolf
parent 1604c04931
commit c645bac4e0

View File

@ -184,6 +184,7 @@ if __name__ == '__main__':
sys.exit(str(e)) sys.exit(str(e))
if args.dry_run: if args.dry_run:
with env:
print('\n'.join([os.path.basename(t) for t in tests])) print('\n'.join([os.path.basename(t) for t in tests]))
else: else:
with TestRunner(env, tap=args.tap, with TestRunner(env, tap=args.tap,