From patchwork Tue Aug 21 17:01:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 960618 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="E6sTZBVH"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41vy985dLNz9s78 for ; Wed, 22 Aug 2018 03:19:56 +1000 (AEST) Received: from localhost ([::1]:55023 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsAJu-0007UM-7i for incoming@patchwork.ozlabs.org; Tue, 21 Aug 2018 13:19:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33169) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsA4M-0001hY-VF for qemu-devel@nongnu.org; Tue, 21 Aug 2018 13:03:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsA49-0006FV-8K for qemu-devel@nongnu.org; Tue, 21 Aug 2018 13:03:44 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:43890) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fsA3z-0005pJ-Hs for qemu-devel@nongnu.org; Tue, 21 Aug 2018 13:03:31 -0400 Received: by mail-wr1-x436.google.com with SMTP id k5-v6so4942754wre.10 for ; Tue, 21 Aug 2018 10:03:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=n3tuiHKM6dBv4TSVvX0LbuM54Vazkhn2qDEKA+MAPZ4=; b=E6sTZBVHcoLXGN1WROP2bz/bH5umsN1GgMpjDHE2UxVMvVDGYqtQ4+sLCp7w/s9HHb puc0PVqm/1OrSFbVdSZd9SBSJENx4CwneuBftX4r1Bx6Muvv2kfoI0zbZ/SqLcKvMb9T LPeYMG2cS/mhBN6N8XkIIwjTi+FVOFe/HYKQBjjE/sYK1HXuetWiSS4+JU7LlTD0/lUZ s2OCf1BuguW3rWfWyJCjJ+k7LwF9dpi/qNwp1Zz1TvNsaElby+Z4T590jHZIl3yEUrkk b7c0c1DMLnSRgHcKrQus68jXs7TCE5nUZDqZ5igxVq9ELq9cc7NYbwGWZTcBA6MtN6xe DVAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=n3tuiHKM6dBv4TSVvX0LbuM54Vazkhn2qDEKA+MAPZ4=; b=jZnNRBGj+cqzWCGVKDlcn0+2xzraB8gksR9m0WpG5mAmrjU8Ulxj4nimY1QzJhzfgD CHm3yALHGsBDUKUYcbTXRvZetw3xyBWNt7dndbAivzxlCDUmm9RgaElIYXKLdHWZpR3u TH34BxRYqEC6GBb5D4gb69dtOcJBduPr/FSrlTqdqKUJCm6oMwY6zfjS8g4egDcxCpqf 1dc35hYhxoekyw9VOlC2Ko2tko9nEE28bSkwEjZBiZFR67vm/X2z02R263jA5AhyK248 E3+QsJfaTmJTK/4ur7wBPIE2TrpFZHuSedSn2iiUh60wSU9jira78832yK45CT7GWaBI dAHA== X-Gm-Message-State: APzg51Axg7KOUrkkHSlyOqAqY2hlKckDdbXblrQVEGW0yj85iklXLPSA xawZlKijEnaLcJmRDTzmxc6yuHu4 X-Google-Smtp-Source: ANB0VdaFbhJjOtvmkfwJ5Dl6BQY24R7DXBXcIi//+DRw7VrpTIQc55VdQN72EDH2CyH4sFGmDNgu0A== X-Received: by 2002:adf:bd10:: with SMTP id j16-v6mr11180006wrh.267.1534871000432; Tue, 21 Aug 2018 10:03:20 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-184-244.clienti.tiscali.it. [78.12.184.244]) by smtp.gmail.com with ESMTPSA id v6-v6sm2608955wmc.43.2018.08.21.10.03.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Aug 2018 10:03:19 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 21 Aug 2018 19:01:48 +0200 Message-Id: <1534870966-9287-17-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1534870966-9287-1-git-send-email-pbonzini@redhat.com> References: <1534870966-9287-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::436 Subject: [Qemu-devel] [PULL 16/74] tests/device-introspect: Test with all machines, not only with "none" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Thomas Huth Certain device introspection crashes used to only happen if you were using a certain machine, e.g. if the machine was using serial_hd() or nd_table[], and a device was trying to use these in its instance_init function, too. To be able to catch these problems, let's extend the device-introspect test to check the devices on all machine types, with and without the "-nodefaults" parameter (since this makes a difference sometimes, too). Since this is a rather slow operation, and most of the problems are already handled by testing with the "none" machine only, the test with all machines is only run in the "make check SPEED=slow" mode. Reviewed-by: Markus Armbruster Signed-off-by: Thomas Huth Message-Id: <1534419358-10932-8-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini Reviewed-by: John Snow Reviewed-by: Laurent Vivier Signed-off-by: Paolo Bonzini --- tests/device-introspect-test.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/tests/device-introspect-test.c b/tests/device-introspect-test.c index a38193b..a25092d 100644 --- a/tests/device-introspect-test.c +++ b/tests/device-introspect-test.c @@ -221,13 +221,13 @@ static void test_device_intro_abstract(void) qtest_end(); } -static void test_device_intro_concrete(void) +static void test_device_intro_concrete(const void *args) { QList *types; QListEntry *entry; const char *type; - qtest_start(common_args); + qtest_start(args); types = device_type_list(false); QLIST_FOREACH_ENTRY(types, entry) { @@ -239,6 +239,7 @@ static void test_device_intro_concrete(void) qobject_unref(types); qtest_end(); + g_free((void *)args); } static void test_abstract_interfaces(void) @@ -275,6 +276,26 @@ static void test_abstract_interfaces(void) qtest_end(); } +static void add_machine_test_case(const char *mname) +{ + char *path, *args; + + /* Ignore blacklisted machines */ + if (g_str_equal("xenfv", mname) || g_str_equal("xenpv", mname)) { + return; + } + + path = g_strdup_printf("device/introspect/concrete/defaults/%s", mname); + args = g_strdup_printf("-M %s", mname); + qtest_add_data_func(path, args, test_device_intro_concrete); + g_free(path); + + path = g_strdup_printf("device/introspect/concrete/nodefaults/%s", mname); + args = g_strdup_printf("-nodefaults -M %s", mname); + qtest_add_data_func(path, args, test_device_intro_concrete); + g_free(path); +} + int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); @@ -283,8 +304,13 @@ int main(int argc, char **argv) qtest_add_func("device/introspect/list-fields", test_qom_list_fields); qtest_add_func("device/introspect/none", test_device_intro_none); qtest_add_func("device/introspect/abstract", test_device_intro_abstract); - qtest_add_func("device/introspect/concrete", test_device_intro_concrete); qtest_add_func("device/introspect/abstract-interfaces", test_abstract_interfaces); + if (g_test_quick()) { + qtest_add_data_func("device/introspect/concrete/defaults/none", + g_strdup(common_args), test_device_intro_concrete); + } else { + qtest_cb_for_every_machine(add_machine_test_case, true); + } return g_test_run(); }