From: "Denis V. Lunev" <den@openvz.org>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, "Denis V. Lunev" <den@openvz.org>,
John Snow <jsnow@redhat.com>, Thomas Huth <thuth@redhat.com>
Subject: [PATCH 4/7] tests/qtest/hd-geo-test: skip when the scratch file cannot be created
Date: Mon, 24 Aug 2026 22:06:24 +0200 [thread overview]
Message-ID: <20260824200627.2180635-5-den@openvz.org> (raw)
In-Reply-To: <CAFn=p-bCR4TvVvHwagXiK-c0wuY5dACwh92249Wv0C3odCtbOg@mail.gmail.com>
From: Denis V. Lunev <den@openvz.org>
Commit a0d6d7454a ("tests/hd-geo-test: Skip test when images can not
be created") skips when the 4 GiB image cannot be sized, but the
temporary file itself is still asserted on, and a file system with no
room left fails g_file_open_tmp() as surely as the ftruncate().
Skip there too and say why in both cases, from inside
create_test_img() where the GError is. Unlink the image that could not
be sized while here.
Cc: John Snow <jsnow@redhat.com>
Cc: Thomas Huth <thuth@redhat.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
tests/qtest/hd-geo-test.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/tests/qtest/hd-geo-test.c b/tests/qtest/hd-geo-test.c
index 41481a5e09..e3b4a4db31 100644
--- a/tests/qtest/hd-geo-test.c
+++ b/tests/qtest/hd-geo-test.c
@@ -27,15 +27,24 @@
static char *create_test_img(int secs)
{
+ g_autoptr(GError) error = NULL;
char *template;
- int fd, ret;
+ int fd, ret, err;
+
+ fd = g_file_open_tmp("qtest.XXXXXX", &template, &error);
+ if (fd < 0) {
+ g_test_message("Could not create a temporary file: %s",
+ error->message);
+ return NULL;
+ }
- fd = g_file_open_tmp("qtest.XXXXXX", &template, NULL);
- g_assert(fd >= 0);
ret = ftruncate(fd, (off_t)secs * 512);
+ err = errno;
close(fd);
if (ret) {
+ g_test_message("Could not size %s: %s", template, strerror(err));
+ unlink(template);
g_free(template);
template = NULL;
}
@@ -1059,7 +1068,6 @@ int main(int argc, char **argv)
if (img_secs[i] >= 0) {
img_file_name[i] = create_test_img(img_secs[i]);
if (!img_file_name[i]) {
- g_test_message("Could not create test images.");
goto test_add_done;
}
} else {
--
2.53.0
next prev parent reply other threads:[~2026-08-24 20:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 17:49 IDE failures under netbsd unit tests John Snow
2026-08-24 20:06 ` [PATCH 0/7] tests/qtest: fix the disk tests on a host with a small /tmp Denis V. Lunev
2026-08-27 10:16 ` Thomas Huth
2026-08-27 11:03 ` Daniel P. Berrangé
2026-09-01 13:41 ` Denis V. Lunev
2026-09-03 16:57 ` Fabiano Rosas
2026-09-03 17:04 ` Denis V. Lunev
2026-08-24 20:06 ` [PATCH 1/7] tests/qtest/libqos: let mkqcow2() report failure Denis V. Lunev
2026-08-24 20:06 ` [PATCH 2/7] tests/qtest/ide-test: skip when the scratch files cannot be created Denis V. Lunev
2026-08-24 20:06 ` [PATCH 3/7] tests/qtest/ahci-test: " Denis V. Lunev
2026-08-24 20:06 ` Denis V. Lunev [this message]
2026-08-24 20:06 ` [PATCH 5/7] tests/qtest/libqtest: create images with a byte-precise size Denis V. Lunev
2026-08-24 20:06 ` [PATCH 6/7] tests/qtest/ide-test: build the shared disks with qemu-img Denis V. Lunev
2026-08-24 20:06 ` [PATCH 7/7] tests/qtest/hd-geo-test: build the test images " Denis V. Lunev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260824200627.2180635-5-den@openvz.org \
--to=den@openvz.org \
--cc=jsnow@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.