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 2/7] tests/qtest/ide-test: skip when the scratch files cannot be created
Date: Mon, 24 Aug 2026 22:06:22 +0200 [thread overview]
Message-ID: <20260824200627.2180635-3-den@openvz.org> (raw)
In-Reply-To: <CAFn=p-bCR4TvVvHwagXiK-c0wuY5dACwh92249Wv0C3odCtbOg@mail.gmail.com>
From: Denis V. Lunev <den@openvz.org>
main() creates a blkdebug script and two 64 MiB images and asserts
that every step worked. The images are sparse, which is free on Linux
but not everywhere: NetBSD mounts /tmp as a tmpfs sized at 25% of RAM
and charges a file its full length the moment it is extended, so the
ftruncate() returns ENOSPC and the binary dies before a test has run:
ERROR:../src/tests/qtest/ide-test.c:1260:main: assertion failed:
(ret == 0)
A file system with no room left fails the g_mkstemp() calls too, the
blkdebug script first of all.
Skip instead, as hd-geo-test does since commit a0d6d7454a
("tests/hd-geo-test: Skip test when images can not be created"): move
g_test_init() ahead of the setup, report the errno and register no
tests. The cleanup loop has to cope with a path never filled in.
Cc: John Snow <jsnow@redhat.com>
Cc: Thomas Huth <thuth@redhat.com>
Reported-by: John Snow <jsnow@redhat.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
tests/qtest/ide-test.c | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/tests/qtest/ide-test.c b/tests/qtest/ide-test.c
index b36b0f8875..805afb9461 100644
--- a/tests/qtest/ide-test.c
+++ b/tests/qtest/ide-test.c
@@ -1231,6 +1231,7 @@ int main(int argc, char **argv)
int i;
int fd;
int ret;
+ int err;
/*
* "base" stores the starting point where we create temporary files.
@@ -1245,25 +1246,37 @@ int main(int argc, char **argv)
base = ".";
#endif
+ g_test_init(&argc, &argv, NULL);
+
/* Create temporary blkdebug instructions */
debug_path = g_strdup_printf("%s/qtest-blkdebug.XXXXXX", base);
fd = g_mkstemp(debug_path);
- g_assert(fd >= 0);
+ if (fd < 0) {
+ g_test_message("Could not create %s: %s", debug_path,
+ strerror(errno));
+ goto test_add_done;
+ }
close(fd);
/* Create a temporary raw image */
for (i = 0; i < 2; ++i) {
tmp_path[i] = g_strdup_printf("%s/qtest.XXXXXX", base);
fd = g_mkstemp(tmp_path[i]);
- g_assert(fd >= 0);
+ if (fd < 0) {
+ g_test_message("Could not create %s: %s", tmp_path[i],
+ strerror(errno));
+ goto test_add_done;
+ }
ret = ftruncate(fd, TEST_IMAGE_SIZE);
- g_assert(ret == 0);
+ err = errno;
close(fd);
+ if (ret < 0) {
+ g_test_message("Could not size %s: %s", tmp_path[i],
+ strerror(err));
+ goto test_add_done;
+ }
}
- /* Run the tests */
- g_test_init(&argc, &argv, NULL);
-
qtest_add_func("/ide/read_native", test_specify);
qtest_add_func("/ide/identify", test_identify);
@@ -1288,10 +1301,14 @@ int main(int argc, char **argv)
qtest_add_func("/ide/cdrom/pio_raw", test_cdrom_pio_raw);
qtest_add_func("/ide/cdrom/dma_raw", test_cdrom_dma_raw);
+test_add_done:
ret = g_test_run();
/* Cleanup */
for (i = 0; i < 2; ++i) {
+ if (!tmp_path[i]) {
+ continue;
+ }
unlink(tmp_path[i]);
g_free(tmp_path[i]);
}
--
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 ` Denis V. Lunev [this message]
2026-08-24 20:06 ` [PATCH 3/7] tests/qtest/ahci-test: skip when the scratch files cannot be created Denis V. Lunev
2026-08-24 20:06 ` [PATCH 4/7] tests/qtest/hd-geo-test: skip when the scratch file " Denis V. Lunev
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-3-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.