qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Akihiko Odaki <akihiko.odaki@daynix.com>
To: "Eduardo Habkost" <eduardo@habkost.net>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Yanan Wang" <wangyanan55@huawei.com>,
	"John Snow" <jsnow@redhat.com>,
	"BALATON Zoltan" <balaton@eik.bme.hu>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
	"Alexey Kardashevskiy" <aik@ozlabs.ru>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Peter Xu" <peterx@redhat.com>, "Fabiano Rosas" <farosas@suse.de>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Laurent Vivier" <lvivier@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
	qemu-ppc@nongnu.org,  Akihiko Odaki <akihiko.odaki@daynix.com>
Subject: [PATCH v4 7/7] tests/qtest: Delete previous boot file
Date: Fri, 23 Aug 2024 15:13:12 +0900	[thread overview]
Message-ID: <20240823-san-v4-7-a24c6dfa4ceb@daynix.com> (raw)
In-Reply-To: <20240823-san-v4-0-a24c6dfa4ceb@daynix.com>

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>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Thomas Huth <thuth@redhat.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 70b606b88864..6c06100d91e2 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -144,12 +144,23 @@ static char *bootpath;
 #include "tests/migration/ppc64/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 */
@@ -177,13 +188,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.46.0



  parent reply	other threads:[~2024-08-23  6:14 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-23  6:13 [PATCH v4 0/7] Fix check-qtest-ppc64 sanitizer errors Akihiko Odaki
2024-08-23  6:13 ` [PATCH v4 1/7] migration: Free removed SaveStateEntry Akihiko Odaki
2024-08-23 12:30   ` Fabiano Rosas
2024-08-23  6:13 ` [PATCH v4 2/7] memory: Do not refer to "memory region's reference count" Akihiko Odaki
2024-08-23  6:13 ` [PATCH v4 3/7] memory: Refer to docs/devel/memory.rst for "owner" Akihiko Odaki
2024-08-23  6:13 ` [PATCH v4 4/7] memory: Clarify that owner may be missing Akihiko Odaki
2024-08-23  6:13 ` [PATCH v4 5/7] memory: Clarify owner must not call memory_region_ref() Akihiko Odaki
2024-08-26 15:31   ` Peter Xu
2024-08-23  6:13 ` [PATCH v4 6/7] memory: Do not create circular reference with subregion Akihiko Odaki
2024-08-26 15:21   ` Peter Xu
2024-08-26 17:10     ` Peter Maydell
2024-08-26 19:42       ` Peter Xu
2024-08-27  4:14         ` Akihiko Odaki
2024-08-27 16:11           ` Peter Xu
2024-08-28  5:33             ` Akihiko Odaki
2024-08-28 13:09               ` Peter Xu
2024-08-28 14:02                 ` Akihiko Odaki
2024-08-28 15:56                   ` Peter Xu
2024-08-29  4:39                     ` Akihiko Odaki
2024-08-29 19:48                       ` Peter Xu
2024-08-30  6:11                         ` Akihiko Odaki
2024-08-30 15:05                           ` Peter Xu
2024-08-31  4:03                             ` Akihiko Odaki
2024-08-23  6:13 ` Akihiko Odaki [this message]
2024-08-26 15:26   ` [PATCH v4 7/7] tests/qtest: Delete previous boot file Peter Xu
2024-08-27 13:20     ` Thomas Huth
2024-08-27 14:03       ` Fabiano Rosas
2024-08-27 14:46         ` Peter Maydell
2024-08-27 15:54           ` Fabiano Rosas

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=20240823-san-v4-7-a24c6dfa4ceb@daynix.com \
    --to=akihiko.odaki@daynix.com \
    --cc=aik@ozlabs.ru \
    --cc=alex.bennee@linaro.org \
    --cc=balaton@eik.bme.hu \
    --cc=danielhb413@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=david@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=farosas@suse.de \
    --cc=harshpb@linux.ibm.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=jsnow@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=wangyanan55@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).