[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 13/15] tests/qtest: Delete previous boot file
From: |
Akihiko Odaki |
Subject: |
[PATCH v2 13/15] tests/qtest: Delete previous boot file |
Date: |
Thu, 27 Jun 2024 22:37:56 +0900 |
A test run may create boot files several times. Delete the previous boot
file before creating a new one.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
tests/qtest/migration-test.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index b7e3406471a6..5c0d669b6df3 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -129,12 +129,23 @@ static char *bootpath;
#include "tests/migration/aarch64/a-b-kernel.h"
#include "tests/migration/s390x/a-b-bios.h"
+static void bootfile_delete(void)
+{
+ unlink(bootpath);
+ g_free(bootpath);
+ bootpath = NULL;
+}
+
static void bootfile_create(char *dir, bool suspend_me)
{
const char *arch = qtest_get_arch();
unsigned char *content;
size_t len;
+ if (bootpath) {
+ bootfile_delete();
+ }
+
bootpath = g_strdup_printf("%s/bootsect", dir);
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
/* the assembled x86 boot sector should be exactly one sector large */
@@ -164,13 +175,6 @@ static void bootfile_create(char *dir, bool suspend_me)
fclose(bootfile);
}
-static void bootfile_delete(void)
-{
- unlink(bootpath);
- g_free(bootpath);
- bootpath = NULL;
-}
-
/*
* Wait for some output in the serial output file,
* we get an 'A' followed by an endless string of 'B's
--
2.45.2
- [PATCH v2 06/15] ppc/vof: Fix unaligned FDT property access, (continued)
- [PATCH v2 06/15] ppc/vof: Fix unaligned FDT property access, Akihiko Odaki, 2024/06/27
- [PATCH v2 07/15] hw/virtio: Free vqs after vhost_dev_cleanup(), Akihiko Odaki, 2024/06/27
- [PATCH v2 08/15] migration: Free removed SaveStateEntry, Akihiko Odaki, 2024/06/27
- [PATCH v2 09/15] memory: Do not create circular reference with subregion, Akihiko Odaki, 2024/06/27
- [PATCH v2 10/15] tests/qtest: Use qtest_add_data_func_full(), Akihiko Odaki, 2024/06/27
- [PATCH v2 11/15] tests/qtest: Free unused QMP response, Akihiko Odaki, 2024/06/27
- [PATCH v2 12/15] tests/qtest: Free old machine variable name, Akihiko Odaki, 2024/06/27
- [PATCH v2 13/15] tests/qtest: Delete previous boot file,
Akihiko Odaki <=
- [PATCH v2 15/15] tests/qtest: Free GThread, Akihiko Odaki, 2024/06/27
- [PATCH v2 14/15] tests/qtest: Free paths, Akihiko Odaki, 2024/06/27