diff options
| author | Bin Meng <bin.meng@windriver.com> | 2022-09-25 19:30:15 +0800 |
|---|---|---|
| committer | Thomas Huth <thuth@redhat.com> | 2022-09-27 20:51:21 +0200 |
| commit | be181f87eb75d21ad82819e92175a2d6716527e0 (patch) | |
| tree | 80a554dfb6faac7b7ec8d17ff23be74ad76e733e /tests/qtest/ide-test.c | |
| parent | 490081b282766df0e91de3903d948f1eed6fe6d2 (diff) | |
| download | focaccia-qemu-be181f87eb75d21ad82819e92175a2d6716527e0.tar.gz focaccia-qemu-be181f87eb75d21ad82819e92175a2d6716527e0.zip | |
tests/qtest: {ahci, ide}-test: Use relative path for temporary files for win32
These test cases uses "blkdebug:path/to/config:path/to/image" for testing. On Windows, absolute file paths contain the delimiter ':' which causes the blkdebug filename parser fail to parse filenames. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20220925113032.1949844-38-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/qtest/ide-test.c')
| -rw-r--r-- | tests/qtest/ide-test.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/qtest/ide-test.c b/tests/qtest/ide-test.c index 25302be6dc..5e3e28aea2 100644 --- a/tests/qtest/ide-test.c +++ b/tests/qtest/ide-test.c @@ -1011,16 +1011,32 @@ static void test_cdrom_dma(void) int main(int argc, char **argv) { + const char *base; int fd; int ret; + /* + * "base" stores the starting point where we create temporary files. + * + * On Windows, this is set to the relative path of current working + * directory, because the absolute path causes the blkdebug filename + * parser fail to parse "blkdebug:path/to/config:path/to/image". + */ +#ifndef _WIN32 + base = g_get_tmp_dir(); +#else + base = "."; +#endif + /* Create temporary blkdebug instructions */ - fd = g_file_open_tmp("qtest-blkdebug.XXXXXX", &debug_path, NULL); + debug_path = g_strdup_printf("%s/qtest-blkdebug.XXXXXX", base); + fd = g_mkstemp(debug_path); g_assert(fd >= 0); close(fd); /* Create a temporary raw image */ - fd = g_file_open_tmp("qtest.XXXXXX", &tmp_path, NULL); + tmp_path = g_strdup_printf("%s/qtest.XXXXXX", base); + fd = g_mkstemp(tmp_path); g_assert(fd >= 0); ret = ftruncate(fd, TEST_IMAGE_SIZE); g_assert(ret == 0); |