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 <[email protected]> > --- > 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 <[email protected]> > + * > + * 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
