]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
iotests: fix leak of tmpdir in dry-run mode
authorDaniel P. Berrangé <berrange@redhat.com>
Mon, 5 Feb 2024 15:40:19 +0000 (15:40 +0000)
committerMichael Tokarev <mjt@tls.msk.ru>
Mon, 12 Feb 2024 16:26:03 +0000 (19:26 +0300)
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 c645bac4e06bf9642cc8e339d027a5d6ec54d811)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
tests/qemu-iotests/check

index f2e9d27dcf54bd7dc09d49abe3e4a54948005368..56d88ca4236b97b03ed461ed85b14f3e4f962fab 100755 (executable)
@@ -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: