diff mbox series

[v5,06/11] tests: Trying fixes test-replication.c on msys2.

Message ID 20200905062333.1087-7-luoyonggang@gmail.com
State New
Headers show
Series Green the msys2 CI make | expand

Commit Message

罗勇刚(Yonggang Luo) Sept. 5, 2020, 6:23 a.m. UTC
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
 tests/test-replication.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/tests/test-replication.c b/tests/test-replication.c
index 9ab3666a90..d0e06f8d77 100644
--- a/tests/test-replication.c
+++ b/tests/test-replication.c
@@ -23,14 +23,18 @@ 
 
 /* primary */
 #define P_ID "primary-id"
-static char p_local_disk[] = "/tmp/p_local_disk.XXXXXX";
+#define P_LOCAL_DISK "%s/p_local_disk.XXXXXX"
+static char p_local_disk[PATH_MAX];
 
 /* secondary */
 #define S_ID "secondary-id"
 #define S_LOCAL_DISK_ID "secondary-local-disk-id"
-static char s_local_disk[] = "/tmp/s_local_disk.XXXXXX";
-static char s_active_disk[] = "/tmp/s_active_disk.XXXXXX";
-static char s_hidden_disk[] = "/tmp/s_hidden_disk.XXXXXX";
+#define S_LOCAL_DISK "%s/s_local_disk.XXXXXX"
+static char s_local_disk[PATH_MAX];
+#define S_ACTIVE_DISK "%s/s_active_disk.XXXXXX"
+static char s_active_disk[PATH_MAX];
+#define S_HIDDEN_DISK "%s/s_hidden_disk.XXXXXX"
+static char s_hidden_disk[PATH_MAX];
 
 /* FIXME: steal from blockdev.c */
 QemuOptsList qemu_drive_opts = {
@@ -571,7 +575,12 @@  static void setup_sigabrt_handler(void)
 int main(int argc, char **argv)
 {
     int ret;
+    const char *tmpdir = g_get_tmp_dir();
     qemu_init_main_loop(&error_fatal);
+    sprintf(p_local_disk, P_LOCAL_DISK, tmpdir);
+    sprintf(s_local_disk, S_LOCAL_DISK, tmpdir);
+    sprintf(s_active_disk, S_ACTIVE_DISK, tmpdir);
+    sprintf(s_hidden_disk, S_HIDDEN_DISK, tmpdir);
     bdrv_init();
 
     g_test_init(&argc, &argv, NULL);