Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1925626rwb; Fri, 28 Jul 2023 18:18:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlHOsaqygQfJIWuL2I/lVVX6atsX+dUcTCcZBr202vfYqURxGzzEj+QkqgGG3jU5ZV8TBeen X-Received: by 2002:a05:6a20:a11d:b0:132:7fb3:3325 with SMTP id q29-20020a056a20a11d00b001327fb33325mr3292149pzk.59.1690593513614; Fri, 28 Jul 2023 18:18:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690593513; cv=none; d=google.com; s=arc-20160816; b=ApVjDpwPD/wyPUUJCBHocbevMX6V0XxVV2/2tDepALjOBH08GjNDiV38wG3ZAI2c6D Bx3gLmz0TBnOtRkZKDN7XHPtDMKtUKS4f0weueJcQqreqwIEXAcblYznRCna9JN9zf/i 26Id5fnt9AKL0PL++a2tSuhMs/Kc5UCe0Vv7snkSaNXCTgaBos4DVN94XjNZTBqGMU/A i9iMCYip43UG3/qgU+LNEBDeYcRONTE2aLGLxZlsTpqG6cpDGSxVq/imDllcP3APAXKN qwnHnFcCpUrRhnAfIvXHk5ORWwrwhTOBJhl3/7C4PVQmmu120XW+EhGuGR//cZjEODbu RJvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:dkim-signature; bh=uqgzEcKwgDl6AmVuFP39+si1T3Ya5yGv/aLgXdHyXDE=; fh=Ctt0ydInMKwei8YFBFbw7rU4p8H0G/T51ZI/KkO6Md4=; b=v4dV0TKBRJ1r61QBV713kaYmi+RUaG69sfoDxLpJS45mXp1ZrwpRRfciwhF215N/Gq 2sJGhmRsxJ1oG0ejqe4TltrcekgK09IP219v5Mlg7WzS7GATuVFdOxf4qZg/DQFc5lE5 fWM9MZO9Hn6XdvwQ33IZVaOkAZ+9889fPn2427gzqhY3SMgPKmPSKM9pBYokbuFpXTpd gsppux/0G01IdyixLYH6A99xB6IRF+P5RJ68Voq54jztEstaEoSzM0ULIHH/jTitPEVU wOSHwgzCg/fItnc6wPR9hPwmZ5zjTagCoKFKAX8E/1MsWUzWOCn502QG+y+PSnF6LFe6 kQUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=fvI3egsP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l184-20020a6325c1000000b0056424625524si1030880pgl.219.2023.07.28.18.18.21; Fri, 28 Jul 2023 18:18:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=fvI3egsP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236642AbjG2Ak1 (ORCPT + 99 others); Fri, 28 Jul 2023 20:40:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236028AbjG2AkH (ORCPT ); Fri, 28 Jul 2023 20:40:07 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10D704C19 for ; Fri, 28 Jul 2023 17:38:26 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-d1ebc896bd7so2489863276.2 for ; Fri, 28 Jul 2023 17:38:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690591062; x=1691195862; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=uqgzEcKwgDl6AmVuFP39+si1T3Ya5yGv/aLgXdHyXDE=; b=fvI3egsPRdl7x5TIjH2EOrD2f/T/HclIL2aPO34GGiSzGBfdKdwjZp9XOdOAfFV8De GaIg88nJGpbUijVUqQfVh711UtHGpq+25x5CvLvNnNO3IoPjD9jcqBPgKr2KOMAHNnur sd5TKdQxtbsVsfSJGVH+CfR8faEfr/z3bWeqvcqfnC8AtS4FqO2XnqnvANwkVYlTPXaK tqt1jtFPvLLM7FXra00twXW1xp6756sf8zJNZuMVsgXomcI0pvusFdGrQ4cq54QQn85s YcZ0QQ4IH7klbQ/xFgqvH//siGtJktYv2CFC7ukfKe6FPmsnWvYDyMp3atHnSZ/wqL4V BRug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690591062; x=1691195862; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uqgzEcKwgDl6AmVuFP39+si1T3Ya5yGv/aLgXdHyXDE=; b=dA5zBrKqS06BPiHwGkpjBdUYHFgvazsoDsNd6sRDu4mvt2/4NNLtn0g5voCHAF38hK gagB9i9kIO4vdgB1M7YdfKVxa6oE4zDF6/dibyducJDVBCsMf/rHteu8BxQ8l+pu0RQY a/hPMIkTYknHpUaJDhMtrY6m8gL2eGyrXUJyqaXeclAb020D3UUOiBodKm9f9ZbB8C+/ U73oamSiZQUcyRDhlt91VYNo8SJ97V5bUWDtuqsf8K6vW93+wDwDb/GJbDLAT18hWE6f ddVJTAdXxKN7zDMCzUpaf+QTMl1P2Fx/eo82G2r2RnL33IB085m9iCzMvuwXh6ap0mkO Hgqg== X-Gm-Message-State: ABy/qLZ+1xF1h2AOwbUTebbY0v5LgVkVe3RgIbLtUc1SE4G4QOJNEHy/ N8H9qogRZabti7TYQ5c7fEFzE1mQnrA= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a25:dc94:0:b0:c10:8d28:d3ae with SMTP id y142-20020a25dc94000000b00c108d28d3aemr17101ybe.8.1690591062181; Fri, 28 Jul 2023 17:37:42 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 28 Jul 2023 17:36:38 -0700 In-Reply-To: <20230729003643.1053367-1-seanjc@google.com> Mime-Version: 1.0 References: <20230729003643.1053367-1-seanjc@google.com> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog Message-ID: <20230729003643.1053367-30-seanjc@google.com> Subject: [PATCH v4 29/34] KVM: selftests: Convert the x86 userspace I/O test to printf guest assert From: Sean Christopherson To: Paolo Bonzini , Marc Zyngier , Oliver Upton , Christian Borntraeger , Janosch Frank , Claudio Imbrenda Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, Sean Christopherson , Thomas Huth , "=?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?=" , Aaron Lewis Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert x86's userspace I/O test to use printf-based guest asserts. Signed-off-by: Sean Christopherson --- .../testing/selftests/kvm/x86_64/userspace_io_test.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/kvm/x86_64/userspace_io_test.c b/tools/testing/selftests/kvm/x86_64/userspace_io_test.c index 0cb51fa42773..2c5d2a18d184 100644 --- a/tools/testing/selftests/kvm/x86_64/userspace_io_test.c +++ b/tools/testing/selftests/kvm/x86_64/userspace_io_test.c @@ -1,4 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 +#define USE_GUEST_ASSERT_PRINTF 1 + #include #include #include @@ -20,8 +22,8 @@ static void guest_ins_port80(uint8_t *buffer, unsigned int count) end = (unsigned long)buffer + 8192; asm volatile("cld; rep; insb" : "+D"(buffer), "+c"(count) : "d"(0x80) : "memory"); - GUEST_ASSERT_1(count == 0, count); - GUEST_ASSERT_2((unsigned long)buffer == end, buffer, end); + GUEST_ASSERT_EQ(count, 0); + GUEST_ASSERT_EQ((unsigned long)buffer, end); } static void guest_code(void) @@ -43,7 +45,9 @@ static void guest_code(void) memset(buffer, 0, sizeof(buffer)); guest_ins_port80(buffer, 8192); for (i = 0; i < 8192; i++) - GUEST_ASSERT_2(buffer[i] == 0xaa, i, buffer[i]); + __GUEST_ASSERT(buffer[i] == 0xaa, + "Expected '0xaa', got '0x%x' at buffer[%u]", + buffer[i], i); GUEST_DONE(); } @@ -91,7 +95,7 @@ int main(int argc, char *argv[]) case UCALL_DONE: break; case UCALL_ABORT: - REPORT_GUEST_ASSERT_2(uc, "argN+1 = 0x%lx, argN+2 = 0x%lx"); + REPORT_GUEST_ASSERT(uc); default: TEST_FAIL("Unknown ucall %lu", uc.cmd); } -- 2.41.0.487.g6d72f3e995-goog