qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Li Qiang <liq3ea@163.com>,
	lvivier@redhat.com, pbonzini@redhat.com, alxndr@bu.edu
Cc: liq3ea@gmail.com, qemu-devel@nongnu.org
Subject: Re: [PATCH] qtest: add fuzz test case
Date: Thu, 20 Aug 2020 16:24:20 +0200	[thread overview]
Message-ID: <a9fc6988-3561-5199-d2ff-6ea4892461a1@redhat.com> (raw)
In-Reply-To: <20200819141533.66354-1-liq3ea@163.com>

On 19/08/2020 16.15, Li Qiang wrote:
> Currently the device fuzzer find a more and more issues.
> For every fuzz case, we need not only the fixes but also
> the coressponding test case. We can analysis the reproducer
> for every case and find what happened in where and write
> a beautiful test case. However the raw data of reproducer is not
> friendly to analysis. It will take a very long time, even far more
> than the fixes itself. So let's create a new file to hold all of
> the fuzz test cases and just use the raw data to act as the test
> case. This way nobody will be afraid of writing a test case for
> the fuzz reproducer.
> 
> This patch adds the issue LP#1878263 test case.
> 
> Signed-off-by: Li Qiang <liq3ea@163.com>
> ---
>  tests/qtest/Makefile.include |  2 ++
>  tests/qtest/fuzz-test.c      | 45 ++++++++++++++++++++++++++++++++++++
>  2 files changed, 47 insertions(+)
>  create mode 100644 tests/qtest/fuzz-test.c
> 
> diff --git a/tests/qtest/Makefile.include b/tests/qtest/Makefile.include
> index b0204e44f2..ff460179c5 100644
> --- a/tests/qtest/Makefile.include
> +++ b/tests/qtest/Makefile.include
> @@ -7,6 +7,7 @@ check-qtest-generic-y += machine-none-test
>  check-qtest-generic-y += qmp-test
>  check-qtest-generic-y += qmp-cmd-test
>  check-qtest-generic-y += qom-test
> +check-qtest-generic-y += fuzz-test

I think this should go into check-qtest-i386-y instead ...

> diff --git a/tests/qtest/fuzz-test.c b/tests/qtest/fuzz-test.c
> new file mode 100644
> index 0000000000..695c6dffb9
> --- /dev/null
> +++ b/tests/qtest/fuzz-test.c
> @@ -0,0 +1,45 @@
> +/*
> + * QTest testcase for fuzz case
> + *
> + * Copyright (c) 2020 Li Qiang <liq3ea@gmail.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +
> +#include "qemu/osdep.h"
> +
> +#include "libqtest.h"
> +
> +/*
> + * This used to trigger the assert in scsi_dma_complete
> + * https://bugs.launchpad.net/qemu/+bug/1878263
> + */
> +static void test_megasas_zero_iov_cnt(void)
> +{
> +    QTestState *s;
> +
> +    s = qtest_init("-nographic -monitor none -serial none "
> +                   "-M q35 -device megasas -device scsi-cd,drive=null0 "
> +                   "-blockdev driver=null-co,read-zeroes=on,node-name=null0");

... since you hard-coded -M q35 here.

Alternatively, you need to check qtest_get_arch() for "i386" /  "x86_64"
in the main() function.

 Thomas



  parent reply	other threads:[~2020-08-20 14:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-19 14:15 [PATCH] qtest: add fuzz test case Li Qiang
2020-08-19 14:38 ` Philippe Mathieu-Daudé
2020-08-19 14:50   ` Li Qiang
2020-08-19 16:22     ` Alexander Bulekov
2020-08-19 21:48       ` Paolo Bonzini
2020-08-20  1:22       ` Li Qiang
2020-08-19 14:53 ` no-reply
2020-08-19 21:49 ` Paolo Bonzini
2020-08-20 14:24 ` Thomas Huth [this message]
2020-08-20 15:49   ` Li Qiang

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=a9fc6988-3561-5199-d2ff-6ea4892461a1@redhat.com \
    --to=thuth@redhat.com \
    --cc=alxndr@bu.edu \
    --cc=liq3ea@163.com \
    --cc=liq3ea@gmail.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).