From patchwork Mon Apr 24 09:22:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 676563 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp2054772wrs; Mon, 24 Apr 2023 02:25:13 -0700 (PDT) X-Google-Smtp-Source: AKy350bE45qVUDX6TPJdGfF4AXV3k4Afl305j8CGzrJ06CKnPBMoEmb56RwQN4ygtzTLiHRnyMrR X-Received: by 2002:a05:622a:178e:b0:3ed:a811:23d0 with SMTP id s14-20020a05622a178e00b003eda81123d0mr24304330qtk.41.1682328312826; Mon, 24 Apr 2023 02:25:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682328312; cv=none; d=google.com; s=arc-20160816; b=BUBgzLZGRYZyXb4uqPR7hYT6N6FbIo2tC1gWOwBVnOFQ4PrTLirTSg+iBlXf5ydrmv fEu6fbv58yvnNzwOlpNHGidqi2aAM8SLhvd8JiA5nf8tsoiCpwTTM9aANU6aHKDnCk3h ManaH3MDbck/HMfSqa06AnWvXNXuHzhZ4E4aLKIlStGdkDLi4SQUWNRtNk+ZiYrwq7V8 9z94UWAXe8+1obI8x9UOiiQZV5JwZHmC1EU+AdcHwwrIYJcUi3n3ODH4FoObL4JoiH12 y90CqqHBlrjOXuPiocoVgwDX5G2lOtCxCu0+ZK+9N+G6gvnqPhFhFEPrXgEEaFLNzq41 ODWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=I4tVKb7J1HOiUkOeX7zfOlqKTbRSuqHHdNiF8Yq+Ih8=; b=RVpLVQ1XhU51k2QaWyi0xZggo1VINaxoux3hUIeSpiD6toR/z/FiehQnRW9ZvEamJ2 qI4g62BmdeVV+RCR5zE+q6l0IJdVqlftjY/xYlXBtZuW1bAEm7DxHBFUNqueyhQVxNnh tq7lD5E6hUY50DaU1maz3XE1WoyEyjREWc2d+p0AXr0cz7vxHnhd+Il/1aJYnb/r7bPr hz7i89Y4R5n9U8UvYISVwJhfy7blFKGhWTp5EAAEwoX+NWwUO2YuSlGN0PAp2yShYGrJ u3XGi1lwmrl5tOggKOimB7R4nav7qmIdefzsSdwI9HD8rGGNzhVbr0nqsdF6NW1Ot6mJ 3LpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UjuONCQw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q18-20020a05622a04d200b003e64f4fb4f0si642900qtx.255.2023.04.24.02.25.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Apr 2023 02:25:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UjuONCQw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqsQ7-0007mB-LI; Mon, 24 Apr 2023 05:23:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqsPi-0007Fs-4K for qemu-devel@nongnu.org; Mon, 24 Apr 2023 05:23:25 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqsPQ-0004nX-T5 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 05:23:12 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3f173af665fso26195425e9.3 for ; Mon, 24 Apr 2023 02:22:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682328175; x=1684920175; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=I4tVKb7J1HOiUkOeX7zfOlqKTbRSuqHHdNiF8Yq+Ih8=; b=UjuONCQwve8NrKacSXdRZSXQbuZMAtROh/BwLiYNvTlW/8e/a9rudGEC0jtAty8Lho IpSoX87hFUIHnUEK9l/cQSc8j1bu1571jddQk1BfVud/cbiTkwFtq7xyqC/4JQ4iaBk/ AAA9I57skzbC0B3UirpMAppY1Z4RN4tTBxCRVu0vY9u0yStOcITQRB6juYVsyQugJNMP ImMCU1v96UFHoMdCr54gjq3AsraXHHffMAFiGHhFwtnmKgkW8TkiCQSwmOJLezFoRJgF ovcopdeUsqvNHOgfjqxkdg9X1xyp8+3ckmZSkkv2AqyYSAaDjONxqNrmfDjIy89E5q+n pi+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682328175; x=1684920175; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I4tVKb7J1HOiUkOeX7zfOlqKTbRSuqHHdNiF8Yq+Ih8=; b=jqPETCuKiEutKawgTtxCPXe8dedga2CmPcKavSg9WTqDsUAG/YTGXws79EtIa/5kDa Oe8MRXBymP9nj3enNrpTGgUMTrbJZIvVGZ6GH1yWGp7WglMS0d32Hc9xUzSEuVgjSQ4w GMJUuLejaMxSD3CAs5yELMdQd3M0utHtfLJs3wtdk/ERevm4ehkl1wkr5zqK7hZkBhPa 6+rDs3G7StvIa7UrNeJAXsSvQvuR+mgBDLUwxacQ2ZT6RGPQgy+B1IEKu+KkKhrX6sMn c7o38VmUsQCSf9jK6CXQVpTVht55ffrcbIZrTPm1DlT16N0FCowSfzYByTHW93Ow9ov3 Bcig== X-Gm-Message-State: AAQBX9d0ydV1RZ1MKwah2XCJQzPi99qYfTOCOvWMBVAWS2T3xzePrXmd HHG1/27V+2g+ix8r8MDW4DJ87A== X-Received: by 2002:a1c:e909:0:b0:3f1:98e1:c902 with SMTP id q9-20020a1ce909000000b003f198e1c902mr4009399wmc.4.1682328175463; Mon, 24 Apr 2023 02:22:55 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id n12-20020a7bc5cc000000b003f17329f7f2sm11624698wmk.38.2023.04.24.02.22.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Apr 2023 02:22:53 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C0C221FFC3; Mon, 24 Apr 2023 10:22:50 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , Beraldo Leal , Thomas Huth , =?utf-8?q?Alex_Benn=C3=A9e?= , "Edgar E. Iglesias" , Paolo Bonzini , Aurelien Jarno , Peter Maydell , Juan Quintela , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Richard Henderson , Joel Stanley , Leif Lindholm , Markus Armbruster , Radoslaw Biernacki , Stefan Hajnoczi , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , John Snow , Andrew Jeffery , David Hildenbrand , Bastian Koppelmann , Max Filippov , qemu-s390x@nongnu.org, Cleber Rosa , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Dani?= =?utf-8?q?el_P=2E_Berrang=C3=A9?= , qemu-arm@nongnu.org, Eduardo Habkost , Ilya Leoshkevich , Kautuk Consul , Harsh Prateek Bora Subject: [PATCH 12/18] tests/avocado/tuxrun_baselines.py: improve code coverage for ppc64 Date: Mon, 24 Apr 2023 10:22:43 +0100 Message-Id: <20230424092249.58552-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230424092249.58552-1-alex.bennee@linaro.org> References: <20230424092249.58552-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Kautuk Consul Commit c0c8687ef0fd990db8db1655a8a6c5a5e35dd4bb disabled the boot_linux.py test-case due to which the code coverage for ppc decreased by around 2%. As per the discussion on https://lore.kernel.org/qemu-devel/87sfdpqcy4.fsf@linaro.org/ it was mentioned that the baseline test for ppc64 could be modified to make up this 2% code coverage. This patch attempts to achieve this 2% code coverage by adding various device command line arguments (to ./qemu-system-ppc64) in the tuxrun_baselines.py test-case. The code coverage report with boot_linux.py, without it and finally with these tuxrun_baselines.py changes is as follows: With boot_linux.py ------------------ lines......: 13.8% (58006 of 420997 lines) functions..: 20.7% (7675 of 36993 functions) branches...: 9.2% (22146 of 240611 branches) Without boot_linux.py (without this patch changes) -------------------------------------------------- lines......: 11.9% (50174 of 420997 lines) functions..: 18.8% (6947 of 36993 functions) branches...: 7.4% (17580 of 239017 branches) Without boot_linux.py (with this patch changes) ----------------------------------------------- lines......: 13.8% (58287 of 420997 lines) functions..: 20.7% (7640 of 36993 functions) branches...: 8.4% (20223 of 240611 branches) Rebased on Alex Benee's testing/next branch: https://gitlab.com/stsquad/qemu/-/tree/testing/next Signed-off-by: Kautuk Consul Reported-by: Alex Bennée Reviewed-by: Harsh Prateek Bora Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230424041830.1275636-1-kconsul@linux.vnet.ibm.com> --- tests/avocado/tuxrun_baselines.py | 70 ++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 6 deletions(-) diff --git a/tests/avocado/tuxrun_baselines.py b/tests/avocado/tuxrun_baselines.py index e8749717e9..3a46e7a745 100644 --- a/tests/avocado/tuxrun_baselines.py +++ b/tests/avocado/tuxrun_baselines.py @@ -11,6 +11,7 @@ import os import time +import tempfile from avocado import skip, skipIf from avocado_qemu import QemuSystemTest @@ -72,6 +73,8 @@ def setUp(self): # Occasionally we need extra devices to hook things up self.extradev = self.get_tag('extradev') + self.qemu_img = super().get_qemu_img() + def wait_for_console_pattern(self, success_message, vm=None): wait_for_console_pattern(self, success_message, failure_message='Kernel panic - not syncing', @@ -179,6 +182,63 @@ def common_tuxrun(self, self.vm.launch() self.run_tuxtest_tests(haltmsg) + def ppc64_common_tuxrun(self, sums, prefix): + # add device args to command line. + self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22', + '-device', 'virtio-net,netdev=vnet') + self.vm.add_args('-netdev', '{"type":"user","id":"hostnet0"}', + '-device', '{"driver":"virtio-net-pci","netdev":' + '"hostnet0","id":"net0","mac":"52:54:00:4c:e3:86",' + '"bus":"pci.0","addr":"0x9"}') + self.vm.add_args('-device', '{"driver":"qemu-xhci","p2":15,"p3":15,' + '"id":"usb","bus":"pci.0","addr":"0x2"}') + self.vm.add_args('-device', '{"driver":"virtio-scsi-pci","id":"scsi0"' + ',"bus":"pci.0","addr":"0x3"}') + self.vm.add_args('-device', '{"driver":"virtio-serial-pci","id":' + '"virtio-serial0","bus":"pci.0","addr":"0x4"}') + self.vm.add_args('-device', '{"driver":"scsi-cd","bus":"scsi0.0"' + ',"channel":0,"scsi-id":0,"lun":0,"device_id":' + '"drive-scsi0-0-0-0","id":"scsi0-0-0-0"}') + self.vm.add_args('-device', '{"driver":"virtio-balloon-pci",' + '"id":"balloon0","bus":"pci.0","addr":"0x6"}') + self.vm.add_args('-audiodev', '{"id":"audio1","driver":"none"}') + self.vm.add_args('-device', '{"driver":"usb-tablet","id":"input0"' + ',"bus":"usb.0","port":"1"}') + self.vm.add_args('-device', '{"driver":"usb-kbd","id":"input1"' + ',"bus":"usb.0","port":"2"}') + self.vm.add_args('-device', '{"driver":"VGA","id":"video0",' + '"vgamem_mb":16,"bus":"pci.0","addr":"0x7"}') + self.vm.add_args('-object', '{"qom-type":"rng-random","id":"objrng0"' + ',"filename":"/dev/urandom"}', + '-device', '{"driver":"virtio-rng-pci","rng":"objrng0"' + ',"id":"rng0","bus":"pci.0","addr":"0x8"}') + self.vm.add_args('-object', '{"qom-type":"cryptodev-backend-builtin",' + '"id":"objcrypto0","queues":1}', + '-device', '{"driver":"virtio-crypto-pci",' + '"cryptodev":"objcrypto0","id":"crypto0","bus"' + ':"pci.0","addr":"0xa"}') + self.vm.add_args('-device', '{"driver":"spapr-pci-host-bridge"' + ',"index":1,"id":"pci.1"}') + self.vm.add_args('-device', '{"driver":"spapr-vscsi","id":"scsi1"' + ',"reg":12288}') + self.vm.add_args('-m', '2G,slots=32,maxmem=4G', + '-object', 'memory-backend-ram,id=ram1,size=1G', + '-device', 'pc-dimm,id=dimm1,memdev=ram1') + + # Create a temporary qcow2 and launch the test-case + with tempfile.NamedTemporaryFile(prefix=prefix, + suffix='.qcow2') as qcow2: + process.run(self.qemu_img + ' create -f qcow2 ' + + qcow2.name + ' 1G') + + self.vm.add_args('-drive', 'file=' + qcow2.name + + ',format=qcow2,if=none,id=' + 'drive-virtio-disk1', + '-device', 'virtio-blk-pci,scsi=off,bus=pci.0,' + 'addr=0xb,drive=drive-virtio-disk1,id=virtio-disk1' + ',bootindex=2') + self.common_tuxrun(csums=sums, drive="scsi-hd") + # # The tests themselves. The configuration is derived from how # tuxrun invokes qemu (with minor tweaks like using -blockdev @@ -379,7 +439,7 @@ def test_ppc64(self): """ :avocado: tags=arch:ppc64 :avocado: tags=machine:pseries - :avocado: tags=cpu:POWER8 + :avocado: tags=cpu:POWER10 :avocado: tags=endian:big :avocado: tags=console:hvc0 :avocado: tags=tuxboot:ppc64 @@ -391,14 +451,13 @@ def test_ppc64(self): "1d953e81a4379e537fc8e41e05a0a59d9b453eef97aa03d47866c6c45b00bdff", "vmlinux" : "f22a9b9e924174a4c199f4c7e5d91a2339fcfe51c6eafd0907dc3e09b64ab728" } - - self.common_tuxrun(csums=sums, drive="scsi-hd") + self.ppc64_common_tuxrun(sums, prefix='tuxrun_ppc64_') def test_ppc64le(self): """ :avocado: tags=arch:ppc64 :avocado: tags=machine:pseries - :avocado: tags=cpu:POWER8 + :avocado: tags=cpu:POWER10 :avocado: tags=console:hvc0 :avocado: tags=tuxboot:ppc64le :avocado: tags=image:vmlinux @@ -409,8 +468,7 @@ def test_ppc64le(self): "b442678c93fb8abe1f7d3bfa20556488de6b475c22c8fed363f42cf81a0a3906", "vmlinux" : "979eb61b445a010fb13e2b927126991f8ceef9c590fa2be0996c00e293e80cf2" } - - self.common_tuxrun(csums=sums, drive="scsi-hd") + self.ppc64_common_tuxrun(sums, prefix='tuxrun_ppc64le_') def test_riscv32(self): """