From: Thomas Huth <thuth@redhat.com>
To: Yonggang Luo <luoyonggang@gmail.com>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Xie Changlong <xiechanglong.d@gmail.com>,
Wen Congyang <wencongyang2@huawei.com>
Subject: Re: [PATCH v2] tests: Trying fixes test-replication.c on msys2.
Date: Fri, 4 Sep 2020 15:07:21 +0200 [thread overview]
Message-ID: <c11df65c-4503-d96d-3452-fe3ae1caca3a@redhat.com> (raw)
In-Reply-To: <20200903220655.1333-1-luoyonggang@gmail.com>
On 04/09/2020 00.06, Yonggang Luo wrote:
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> ---
> tests/test-replication.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> 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);
Sounds like the right way to go, but I think I'd do it without the
#defines and simply use the strings directly here, what do you think?
Thomas
PS: Please use scripts/get_maintainer.pl (or the MAINTAINERS file
directly) on your patches to find out the right maintainers that you
should put on CC: for every patch.
next prev parent reply other threads:[~2020-09-04 13:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-03 22:06 [PATCH v2] tests: Trying fixes test-replication.c on msys2 Yonggang Luo
2020-09-04 7:58 ` Paolo Bonzini
2020-09-04 13:07 ` Thomas Huth [this message]
2020-09-05 3:11 ` 罗勇刚(Yonggang Luo)
2020-09-05 7:25 ` Thomas Huth
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=c11df65c-4503-d96d-3452-fe3ae1caca3a@redhat.com \
--to=thuth@redhat.com \
--cc=luoyonggang@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=wencongyang2@huawei.com \
--cc=xiechanglong.d@gmail.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).