|
From: | Thomas Huth |
Subject: | Re: [PATCH] tests/unit/test-image-locking: Fix handling of temporary files |
Date: | Wed, 12 Oct 2022 11:46:38 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 |
On 12/10/2022 11.21, Marc-André Lureau wrote:
HiOn Wed, Oct 12, 2022 at 1:03 PM Thomas Huth <thuth@redhat.com <mailto:thuth@redhat.com>> wrote:test-image-locking leaves some temporary files around - clean them up. While we're at it, test-image-locking is a unit test, so it should not use "qtest.*" for temporary file names. Give them better names instead, so that it clear where the temporary files come from. Signed-off-by: Thomas Huth <thuth@redhat.com <mailto:thuth@redhat.com>> ---
[...]
@@ -140,6 +140,8 @@ static void test_set_perm_abort(void) check_locked_bytes(fd, perm, ~shared_perm); blk_unref(blk1); blk_unref(blk2); + close(fd); + unlink(img_path);Perhaps we should use g_unlink() instead for better portability? although this is pre-existing.
I thought about that, too, but apparently you have to include an additional header file (gstdio.h) to get the prototype - so it seems to be more effort for no real gain (unless you want to use non-ASCII characters in the filename - which we are not doing here).
Thomas
[Prev in Thread] | Current Thread | [Next in Thread] |