From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 212A8C4360C for ; Fri, 27 Sep 2019 10:42:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EAD8020673 for ; Fri, 27 Sep 2019 10:42:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726284AbfI0Kmh (ORCPT ); Fri, 27 Sep 2019 06:42:37 -0400 Received: from foss.arm.com ([217.140.110.172]:48736 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725890AbfI0Kmh (ORCPT ); Fri, 27 Sep 2019 06:42:37 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F2E271570; Fri, 27 Sep 2019 03:42:35 -0700 (PDT) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.197.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2FF213F534; Fri, 27 Sep 2019 03:42:35 -0700 (PDT) From: Andre Przywara To: Paolo Bonzini , Andrew Jones Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [kvm-unit-tests PATCH 2/6] arm: gic: Split variable output data from test name Date: Fri, 27 Sep 2019 11:42:23 +0100 Message-Id: <20190927104227.253466-3-andre.przywara@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190927104227.253466-1-andre.przywara@arm.com> References: <20190927104227.253466-1-andre.przywara@arm.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org For some tests we mix variable diagnostic output with the test name, which leads to variable test line, confusing some higher level frameworks. Split the output to always use the same test name for a certain test, and put diagnostic output on a separate line using the INFO: tag. Signed-off-by: Andre Przywara --- arm/gic.c | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/arm/gic.c b/arm/gic.c index 6fd5e5e..66dcafe 100644 --- a/arm/gic.c +++ b/arm/gic.c @@ -353,8 +353,8 @@ static void test_typer_v2(uint32_t reg) { int nr_gic_cpus = ((reg >> 5) & 0x7) + 1; - report("all %d CPUs have interrupts", nr_cpus == nr_gic_cpus, - nr_gic_cpus); + report("all CPUs have interrupts", nr_cpus == nr_gic_cpus); + report_info("having %d CPUs", nr_gic_cpus); } #define BYTE(reg32, byte) (((reg32) >> ((byte) * 8)) & 0xff) @@ -370,16 +370,21 @@ static void test_typer_v2(uint32_t reg) static void test_byte_access(void *base_addr, u32 pattern, u32 mask) { u32 reg = readb(base_addr + 1); + bool res; - report("byte reads successful (0x%08x => 0x%02x)", - reg == (BYTE(pattern, 1) & (mask >> 8)), - pattern & mask, reg); + res = (reg == (BYTE(pattern, 1) & (mask >> 8))); + report("byte reads successful", res); + if (!res) + report_info("byte 1 of 0x%08x => 0x%02x", pattern & mask, reg); pattern = REPLACE_BYTE(pattern, 2, 0x1f); writeb(BYTE(pattern, 2), base_addr + 2); reg = readl(base_addr); - report("byte writes successful (0x%02x => 0x%08x)", - reg == (pattern & mask), BYTE(pattern, 2), reg); + res = (reg == (pattern & mask)); + report("byte writes successful", res); + if (!res) + report_info("writing 0x%02x into bytes 2 => 0x%08x", + BYTE(pattern, 2), reg); } static void test_priorities(int nr_irqs, void *priptr) @@ -399,15 +404,16 @@ static void test_priorities(int nr_irqs, void *priptr) pri_mask = readl(first_spi); reg = ~pri_mask; - report("consistent priority masking (0x%08x)", + report("consistent priority masking", (((reg >> 16) == (reg & 0xffff)) && - ((reg & 0xff) == ((reg >> 8) & 0xff))), pri_mask); + ((reg & 0xff) == ((reg >> 8) & 0xff)))); + report_info("priority mask is 0x%08x", pri_mask); reg = reg & 0xff; for (pri_bits = 8; reg & 1; reg >>= 1, pri_bits--) ; - report("implements at least 4 priority bits (%d)", - pri_bits >= 4, pri_bits); + report("implements at least 4 priority bits", pri_bits >= 4); + report_info("%d priority bits implemented", pri_bits); pattern = 0; writel(pattern, first_spi); @@ -452,9 +458,9 @@ static void test_targets(int nr_irqs) /* Check that bits for non implemented CPUs are RAZ/WI. */ if (nr_cpus < 8) { writel(0xffffffff, targetsptr + GIC_FIRST_SPI); - report("bits for %d non-existent CPUs masked", - !(readl(targetsptr + GIC_FIRST_SPI) & ~cpu_mask), - 8 - nr_cpus); + report("bits for non-existent CPUs masked", + !(readl(targetsptr + GIC_FIRST_SPI) & ~cpu_mask)); + report_info("%d non-existent CPUs", 8 - nr_cpus); } else { report_skip("CPU masking (all CPUs implemented)"); } @@ -465,8 +471,10 @@ static void test_targets(int nr_irqs) pattern = 0x0103020f; writel(pattern, targetsptr + GIC_FIRST_SPI); reg = readl(targetsptr + GIC_FIRST_SPI); - report("register content preserved (%08x => %08x)", - reg == (pattern & cpu_mask), pattern & cpu_mask, reg); + report("register content preserved", reg == (pattern & cpu_mask)); + if (reg != (pattern & cpu_mask)) + report_info("writing %08x reads back as %08x", + pattern & cpu_mask, reg); /* The TARGETS registers are byte accessible. */ test_byte_access(targetsptr + GIC_FIRST_SPI, pattern, cpu_mask); @@ -505,9 +513,8 @@ static void gic_test_mmio(void) test_readonly_32(gic_dist_base + GICD_IIDR, false)); reg = readl(idreg); - report("ICPIDR2 is read-only (0x%08x)", - test_readonly_32(idreg, false), - reg); + report("ICPIDR2 is read-only", test_readonly_32(idreg, false)); + report_info("value of ICPIDR2: 0x%08x", reg); test_priorities(nr_irqs, gic_dist_base + GICD_IPRIORITYR); -- 2.17.1