From patchwork Thu Feb 28 16:51:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 1049617 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=kvm-ppc-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 449JW433L8z9s5c for ; Fri, 1 Mar 2019 03:52:16 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733069AbfB1QwQ (ORCPT ); Thu, 28 Feb 2019 11:52:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38512 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731621AbfB1QwP (ORCPT ); Thu, 28 Feb 2019 11:52:15 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 50235307CB3F; Thu, 28 Feb 2019 16:52:15 +0000 (UTC) Received: from thuth.com (ovpn-116-149.ams2.redhat.com [10.36.116.149]) by smtp.corp.redhat.com (Postfix) with ESMTP id C5D6518525; Thu, 28 Feb 2019 16:52:11 +0000 (UTC) From: Thomas Huth To: Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= , kvm@vger.kernel.org Cc: kvm-ppc@vger.kernel.org, David Hildenbrand , Laurent Vivier , Janosch Frank Subject: [kvm-unit-tests PULL 3/5] s390x: Beautify sthyi report strings Date: Thu, 28 Feb 2019 17:51:58 +0100 Message-Id: <1551372720-17321-4-git-send-email-thuth@redhat.com> In-Reply-To: <1551372720-17321-1-git-send-email-thuth@redhat.com> References: <1551372720-17321-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 28 Feb 2019 16:52:15 +0000 (UTC) Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org From: Janosch Frank Tests like the register odd check in r1 and r2 were not distinguishable and the reports were hard to read in total. Signed-off-by: Janosch Frank Reviewed-by: Thomas Huth Signed-off-by: Thomas Huth --- s390x/sthyi.c | 54 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/s390x/sthyi.c b/s390x/sthyi.c index 16b8c14..04a7b4f 100644 --- a/s390x/sthyi.c +++ b/s390x/sthyi.c @@ -52,10 +52,12 @@ static void test_exception_addr(void) static void test_exception_reg_odd(void) { - report_prefix_push("Register check odd"); + report_prefix_push("Register check odd R1"); expect_pgm_int(); sthyi((uint64_t)pagebuf, 0, NULL, 1, 2); check_pgm_int_code(PGM_INT_CODE_SPECIFICATION); + report_prefix_pop(); + report_prefix_push("Register check odd R2"); expect_pgm_int(); sthyi((uint64_t)pagebuf, 0, NULL, 0, 3); check_pgm_int_code(PGM_INT_CODE_SPECIFICATION); @@ -76,52 +78,58 @@ static void test_function_code(uint64_t addr) uint64_t urc = 0; int cc = sthyi((uint64_t)pagebuf, 42, &urc, 0, 2); - report("Ill. fcode", cc == 3 && urc == CODE_UNSUPP); + report("Illegal fcode", cc == 3 && urc == CODE_UNSUPP); } static void test_fcode0_hdr(struct sthyi_hdr_sctn *hdr) { - report("HDR length", (hdr->INFHDLN >= sizeof(*hdr) - && !(hdr->INFHDLN % 8))); - report("MACH sctn length", (hdr->INFMLEN >= sizeof(struct sthyi_mach_sctn) - && !(hdr->INFMLEN % 8))); - report("PAR sctn length", (hdr->INFPLEN >= sizeof(struct sthyi_par_sctn) - && !(hdr->INFPLEN % 8))); - - report("MACH offset", hdr->INFMOFF >= hdr->INFHDLN); - report("PAR offset", hdr->INFPOFF >= hdr->INFHDLN); + report_prefix_push("Header"); + + report("length", hdr->INFHDLN >= sizeof(*hdr) && !(hdr->INFHDLN % 8)); + report("Machine sctn length", (hdr->INFMLEN >= sizeof(struct sthyi_mach_sctn) + && !(hdr->INFMLEN % 8))); + report("Partition section length", (hdr->INFPLEN >= sizeof(struct sthyi_par_sctn) + && !(hdr->INFPLEN % 8))); + + report("Machine offset", hdr->INFMOFF >= hdr->INFHDLN); + report("Partition offset", hdr->INFPOFF >= hdr->INFHDLN); + report_prefix_pop(); } static void test_fcode0_mach(struct sthyi_mach_sctn *mach) { int sum = mach->INFMSCPS + mach->INFMDCPS + mach->INFMSIFL + mach->INFMDIFL; + report_prefix_push("Machine"); if (mach->INFMVAL1 & MACH_ID_VLD) { - report("MACH type", memcmp(mach->INFMTYPE, null_buf, sizeof(mach->INFMTYPE))); - report("MACH manu", memcmp(mach->INFMMANU, null_buf, sizeof(mach->INFMMANU))); - report("MACH seq", memcmp(mach->INFMSEQ, null_buf, sizeof(mach->INFMSEQ))); - report("MACH plant", memcmp(mach->INFMPMAN, null_buf, sizeof(mach->INFMPMAN))); + report("type", memcmp(mach->INFMTYPE, null_buf, sizeof(mach->INFMTYPE))); + report("manufacturer", memcmp(mach->INFMMANU, null_buf, sizeof(mach->INFMMANU))); + report("sequence", memcmp(mach->INFMSEQ, null_buf, sizeof(mach->INFMSEQ))); + report("plant", memcmp(mach->INFMPMAN, null_buf, sizeof(mach->INFMPMAN))); } if (mach->INFMVAL1 & MACH_NAME_VLD) - report("MACH name", memcmp(mach->INFMNAME, null_buf, - sizeof(mach->INFMNAME))); + report("name", memcmp(mach->INFMNAME, null_buf, + sizeof(mach->INFMNAME))); if (mach->INFMVAL1 & MACH_CNT_VLD) - report("MACH core counts", sum); + report("core counts", sum); + report_prefix_pop(); } static void test_fcode0_par(struct sthyi_par_sctn *par) { int sum = par->INFPSCPS + par->INFPDCPS + par->INFPSIFL + par->INFPDIFL; + report_prefix_push("Partition"); if (par->INFPVAL1 & PART_CNT_VLD) - report("PAR core counts", sum); + report("core counts", sum); if (par->INFPVAL1 & PART_STSI_SUC) { - report("PAR number", par->INFPPNUM); - report("PAR name", memcmp(par->INFPPNAM, null_buf, sizeof(par->INFPPNAM))); + report("number", par->INFPPNUM); + report("name", memcmp(par->INFPPNAM, null_buf, sizeof(par->INFPPNAM))); } + report_prefix_pop(); } static void test_fcode0(void) @@ -133,6 +141,7 @@ static void test_fcode0(void) /* Zero destination memory. */ memset(pagebuf, 0, PAGE_SIZE); + report_prefix_push("fcode 0"); sthyi((uint64_t)pagebuf, 0, NULL, 0, 2); hdr = (void *)pagebuf; mach = (void *)pagebuf + hdr->INFMOFF; @@ -141,6 +150,7 @@ static void test_fcode0(void) test_fcode0_hdr(hdr); test_fcode0_mach(mach); test_fcode0_par(par); + report_prefix_pop(); } int main(void) @@ -156,10 +166,12 @@ int main(void) } /* Test register/argument checking. */ + report_prefix_push("Instruction"); test_exception_addr(); test_exception_reg_odd(); test_exception_reg_equal(); test_function_code((uint64_t) pagebuf); + report_prefix_pop(); /* Test function code 0 - CP and IFL Capacity Information */ test_fcode0();