From nobody Mon Feb 9 18:18:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1611659813; cv=none; d=zohomail.com; s=zohoarc; b=PWAcjm5dQxA6EU5rG24V0ujGcqM4IDmhdbvwIApUJxj1/FIMR3RFfdb7a8WqUjA1PzIHLK0sTPt0LOXZdLe1tcLaPbiNbPAA23d83Y1QjcQXy8saU4iousZa1ZUse83bEJflS/BudbRmkMk+KaiEi6xmnrRHKMhIFziR5qvr/xo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611659813; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=pOa+invkTSd9msAOq158KC7sen/JzmgqNE1f7YnfH2U=; b=HWMqXulagVVv5seqpa1Ra/b2O23mtj1c1tyV4rO4Dd5XBrsm31h9wI3EGO92HaFH53RJMufNh+qGCvharxFFg+zTmSSpMnWrWlMR5Fi9LAMMCNhW/hwBKbUHE7RBLs2uBJS1BiSItJ+m/IPKeivigIQ3gtZG/lSzOGfX944LqDc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1611659813420994.668333072752; Tue, 26 Jan 2021 03:16:53 -0800 (PST) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-172-5YEhAGKHNaGUpY_E-Ca8GQ-1; Tue, 26 Jan 2021 06:16:48 -0500 Received: by mail-ed1-f69.google.com with SMTP id ck25so9165423edb.16 for ; Tue, 26 Jan 2021 03:16:48 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (13.red-83-57-169.dynamicip.rima-tde.net. [83.57.169.13]) by smtp.gmail.com with ESMTPSA id g14sm9592461ejr.105.2021.01.26.03.16.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jan 2021 03:16:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611659812; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pOa+invkTSd9msAOq158KC7sen/JzmgqNE1f7YnfH2U=; b=CkIYc/sKsW/JwrrbU6FDbRIF+/zOjKhjWJ92tomaD6I3VvNYbjPFQCWVh0m3ODGrzGNAXX kjmXEDT8wvgK7Z3HbMaHqov94sGQzluVwab2Q6WWije0hvCQLOxva66Z58DUf0DEsLe6t7 juQ3I/i8ETMKxyGFdskXhbocQz/OAMI= X-MC-Unique: 5YEhAGKHNaGUpY_E-Ca8GQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pOa+invkTSd9msAOq158KC7sen/JzmgqNE1f7YnfH2U=; b=ez/Viop9lMQVtTNfWdUWbuDAlsfK+sJurlMv3KV58PV4F/pa4NXaMx7h0JtHDTZ3Ox VUE7JyQ3YB1XE+fpJS5596VzuYQtu95kw3rbsKNLrHDs+b0QIK4IWpieXTbYOE0Di4IN GEkeZA2IWgLiS1gAScXoeX/DBBSeFaExexaoaksA1MzQkDhZEh7+YoHfPfl/8+Yzoa1X p/6F5zNcLK5aHx2OFzdnAPuInrHOhtFeUO0xNB7IpZDRuca0j5L1CTSbbamS5sqaLJpM z0erMKEm7+BCt0rH68/tPtbZmfjLl11PsRmteRPsZKj/etryFg1lgEFSfBKh9BeXVceL rJRg== X-Gm-Message-State: AOAM532npTc4O8NVKmp5g3ufeDgcZryhMJIzgrHyycA2F2GlIV0iHdYj 5Lv2VX2Gt0dPjvSnlwHvUAG5p5akJfEyBMHh2bZ/sU97jNTX/Ya/ICZgLd+ck4tV1mW+okdL0nc 2w1xBYVK5FPAxxg== X-Received: by 2002:a50:fc8c:: with SMTP id f12mr4119196edq.225.1611659807550; Tue, 26 Jan 2021 03:16:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTDP67weBlp45JOc7dob+dM0iHxeNK7szy/rUJ0V75hf62dePbLWJA+DXrNW5UQ0UoeX1KLA== X-Received: by 2002:a50:fc8c:: with SMTP id f12mr4119182edq.225.1611659807368; Tue, 26 Jan 2021 03:16:47 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Fam Zheng , Hannes Reinecke , qemu-block@nongnu.org, Paolo Bonzini , Thomas Huth , Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 1/2] tests/qtest: Only run fuzz-megasas-test if megasas device is available Date: Tue, 26 Jan 2021 12:16:37 +0100 Message-Id: <20210126111638.3141780-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210126111638.3141780-1-philmd@redhat.com> References: <20210126111638.3141780-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) This test fails when QEMU is built without the megasas device, restrict it to its availability. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth --- tests/qtest/fuzz-megasas-test.c | 49 +++++++++++++++++++++++++++++++++ tests/qtest/fuzz-test.c | 25 ----------------- MAINTAINERS | 1 + tests/qtest/meson.build | 4 ++- 4 files changed, 53 insertions(+), 26 deletions(-) create mode 100644 tests/qtest/fuzz-megasas-test.c diff --git a/tests/qtest/fuzz-megasas-test.c b/tests/qtest/fuzz-megasas-tes= t.c new file mode 100644 index 00000000000..940a76bf25a --- /dev/null +++ b/tests/qtest/fuzz-megasas-test.c @@ -0,0 +1,49 @@ +/* + * QTest fuzzer-generated testcase for megasas device + * + * Copyright (c) 2020 Li Qiang + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" + +#include "libqos/libqtest.h" + +/* + * This used to trigger the assert in scsi_dma_complete + * https://bugs.launchpad.net/qemu/+bug/1878263 + */ +static void test_lp1878263_megasas_zero_iov_cnt(void) +{ + QTestState *s; + + s =3D qtest_init("-nographic -monitor none -serial none " + "-M q35 -device megasas -device scsi-cd,drive=3Dnull0 " + "-blockdev driver=3Dnull-co,read-zeroes=3Don,node-name= =3Dnull0"); + qtest_outl(s, 0xcf8, 0x80001818); + qtest_outl(s, 0xcfc, 0xc101); + qtest_outl(s, 0xcf8, 0x8000181c); + qtest_outl(s, 0xcf8, 0x80001804); + qtest_outw(s, 0xcfc, 0x7); + qtest_outl(s, 0xcf8, 0x8000186a); + qtest_writeb(s, 0x14, 0xfe); + qtest_writeb(s, 0x0, 0x02); + qtest_outb(s, 0xc1c0, 0x17); + qtest_quit(s); +} + +int main(int argc, char **argv) +{ + const char *arch =3D qtest_get_arch(); + + g_test_init(&argc, &argv, NULL); + + if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { + qtest_add_func("fuzz/test_lp1878263_megasas_zero_iov_cnt", + test_lp1878263_megasas_zero_iov_cnt); + } + + return g_test_run(); +} diff --git a/tests/qtest/fuzz-test.c b/tests/qtest/fuzz-test.c index cdb1100a0b8..6188fbb8e96 100644 --- a/tests/qtest/fuzz-test.c +++ b/tests/qtest/fuzz-test.c @@ -11,29 +11,6 @@ =20 #include "libqos/libqtest.h" =20 -/* - * This used to trigger the assert in scsi_dma_complete - * https://bugs.launchpad.net/qemu/+bug/1878263 - */ -static void test_lp1878263_megasas_zero_iov_cnt(void) -{ - QTestState *s; - - s =3D qtest_init("-nographic -monitor none -serial none " - "-M q35 -device megasas -device scsi-cd,drive=3Dnull0 " - "-blockdev driver=3Dnull-co,read-zeroes=3Don,node-name= =3Dnull0"); - qtest_outl(s, 0xcf8, 0x80001818); - qtest_outl(s, 0xcfc, 0xc101); - qtest_outl(s, 0xcf8, 0x8000181c); - qtest_outl(s, 0xcf8, 0x80001804); - qtest_outw(s, 0xcfc, 0x7); - qtest_outl(s, 0xcf8, 0x8000186a); - qtest_writeb(s, 0x14, 0xfe); - qtest_writeb(s, 0x0, 0x02); - qtest_outb(s, 0xc1c0, 0x17); - qtest_quit(s); -} - static void test_lp1878642_pci_bus_get_irq_level_assert(void) { QTestState *s; @@ -104,8 +81,6 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); =20 if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { - qtest_add_func("fuzz/test_lp1878263_megasas_zero_iov_cnt", - test_lp1878263_megasas_zero_iov_cnt); qtest_add_func("fuzz/test_lp1878642_pci_bus_get_irq_level_assert", test_lp1878642_pci_bus_get_irq_level_assert); qtest_add_func("fuzz/test_mmio_oob_from_memory_region_cache", diff --git a/MAINTAINERS b/MAINTAINERS index 34359a99b8e..44cd74b03cd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1925,6 +1925,7 @@ S: Supported F: hw/scsi/megasas.c F: hw/scsi/mfi.h F: tests/qtest/megasas-test.c +F: tests/qtest/fuzz-megasas-test.c =20 Network packet abstractions M: Dmitry Fleytman diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 16d04625b8b..85682d0dfce 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -4,7 +4,9 @@ subdir_done() endif =20 -qtests_generic =3D [ +qtests_generic =3D \ + (config_all_devices.has_key('CONFIG_MEGASAS_SCSI_PCI') ? ['fuzz-megasas-= test'] : []) + \ + [ 'cdrom-test', 'device-introspect-test', 'machine-none-test', --=20 2.26.2