From nobody Mon Feb 9 12:26:05 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=1610723405; cv=none; d=zohomail.com; s=zohoarc; b=e06UoL7+tKpgZnKocKKoKobYb3qFy8rmeriYqGe4T4bZILokkEFzO50SUaREgx0DhSi+Dm4tGu9YaGX9ZTWh4JNAEVb7MRjuQdPWK1iiwS6InZOggZO6qB+4k/b62r32EDuJxR1M50VNeT3MetO79fKUSAvCNhcdUqaOKIYNwWU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610723405; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=0/+/AX09CbbEizWPkEMvsyLmancVxaiGyOdttwtAppI=; b=SaskwP+Ne+YBrmulF0MSDHk1mCMPuYI5cW2AOgrGGIexFzPTrFTIXW9UaPgU7E0KnF+zObb7s2dhVNKfsGFl52X9Eindzbwq6i34HUnBQFa9m6HzSb1JSgFjhUDnEKCXxpn5ftsoZpuQ+XKYapalMlJiw9YIe5OhQ7NLgeEbOjQ= 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 1610723405136896.9954390589387; Fri, 15 Jan 2021 07:10:05 -0800 (PST) Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-224-m4QDGPvJNXe47_FZQhPhAQ-1; Fri, 15 Jan 2021 10:10:00 -0500 Received: by mail-ej1-f71.google.com with SMTP id x22so3684091ejb.10 for ; Fri, 15 Jan 2021 07:09:59 -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 h12sm3667242eja.113.2021.01.15.07.09.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 07:09:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610723404; 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=0/+/AX09CbbEizWPkEMvsyLmancVxaiGyOdttwtAppI=; b=MLhA3QDqLkgcfmjRfQKmxxbgjU89y/+5i9xlRYsyv1Za2VEIOA/c/xA7u1TfYwR7TrYm0a PirYFUzfkEQ3wslqrW9LBIQ3YqZM9LuoH1SbBQsQnO8Pt/mI7o5CAkRMD5ICagisPGB0Nj iScoID7X4jU2/EyW49Is5iSzQvfDPNQ= X-MC-Unique: m4QDGPvJNXe47_FZQhPhAQ-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=0/+/AX09CbbEizWPkEMvsyLmancVxaiGyOdttwtAppI=; b=KUPNoEI7/RFLEYP8wyjIWtho5/ADJC3YSO8C979sxS+CbWppDJ6zsq+wOnIRaHkUCe SWYgrD8d9YEpKYsmOmufxfCUszOtgYYrSfZ7Q+dnfnplxdOkTfEonBcypXPorLu3i60z 6dk5Njqyh8RFzhxvt9Y/fJRf7kgQ829kkz7y2Ufi56ZUmJ46LXrdQP2gGF3YikdwvPyn PzwduNBVmC/v3fi5VlzrXpU9CqQMs37k6NEvUSKCkwDeM+VgkDtn22C1mseobwhbuC2V znFJqtMcZKWeYZLFU4B+125U9jeXhbNhtB6p9jhxZKYAgM/58cplLY3U53j1dIXgy6dU IpBQ== X-Gm-Message-State: AOAM531bUcAH1rXCwr/IoNQbk9j6K1YgaXtRxQko3WGQO/73+Uy7m+If 8L6VrDhPzc1HvbkgU0xxefzVzXP5eBHjTie7fKqSYPae0unO0xufISW3z3bmYp1hC4E1jZe/Wve qt03FgxsB6DpO9Q== X-Received: by 2002:a05:6402:1c0f:: with SMTP id ck15mr1048686edb.171.1610723398746; Fri, 15 Jan 2021 07:09:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJzRmYcfzEbNzRbED9BztKtmSiCCZaTKca9N4JmFSnyd7nzKI3T6HAWLZwmTzZm+xxAptnmmzw== X-Received: by 2002:a05:6402:1c0f:: with SMTP id ck15mr1048665edb.171.1610723398539; Fri, 15 Jan 2021 07:09:58 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Fam Zheng , Thomas Huth , Laurent Vivier , Paolo Bonzini , Li Qiang , Alexander Bulekov , Hannes Reinecke , Stefan Berger , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 3/4] tests/qtest: Only run fuzz-megasas-test if megasas device is available Date: Fri, 15 Jan 2021 16:09:35 +0100 Message-Id: <20210115150936.3333282-4-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210115150936.3333282-1-philmd@redhat.com> References: <20210115150936.3333282-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 --- 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 cb0656aec3d..b2ef820a9fa 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 874f5d34674..a24e7f1c34a 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