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=-16.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, 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 E223BC433FE for ; Thu, 16 Sep 2021 18:16:07 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 93AE261246 for ; Thu, 16 Sep 2021 18:16:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 93AE261246 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 463414B174; Thu, 16 Sep 2021 14:16:07 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tChwSLiykLOi; Thu, 16 Sep 2021 14:16:06 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id BC5534B177; Thu, 16 Sep 2021 14:16:04 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 64BC34B0CB for ; Thu, 16 Sep 2021 14:16:03 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ESQnh4JfyrPd for ; Thu, 16 Sep 2021 14:16:02 -0400 (EDT) Received: from mail-qv1-f73.google.com (mail-qv1-f73.google.com [209.85.219.73]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id C86FC4B107 for ; Thu, 16 Sep 2021 14:16:01 -0400 (EDT) Received: by mail-qv1-f73.google.com with SMTP id h25-20020a0cab19000000b0037a49d15c93so62847937qvb.22 for ; Thu, 16 Sep 2021 11:16:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=JJZ190EFBdoAROgHmhQViRGxGG559ZmU5Q/9tQKxLoY=; b=VXFxleX8XZbxaXGsk52pqIxNLQlkPnbly3aXNjlVihcthPwkd7vAB2Ak2ReYQFp9Gz XNRC4NG00zHZWIHAqSy8Xe5QfHf2iqo04aBflACa0wBiSyaXPe41s9VLzvd0ze9jnmsk RDVfUZcyLzHoCDoidFIb1uEDOnlAcaLO7ll4PjIsWhMEwsl2NyGzWZj+GqNsRmgV9cyQ x24xui9+LrpOpWh2dLRRwg3b/yJbwu8oKo1k943MMDbWls0v3XpScoPeIvfAD0kuf4WM V8zsVGw4LFa0PpNqKVVgKta63ymqxpGPok4eoZB5FbmvmYMNpIrxqU4VMtlRfzAamFPi QU9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=JJZ190EFBdoAROgHmhQViRGxGG559ZmU5Q/9tQKxLoY=; b=crogXsdQ8wKYgjdwY7hedrtBGl/xCszCPVrLjzx4b+j+zAZwApMFP0u36jLWsOd7fv BT63xdlsjoP59jwlsKPySJsS2aNcNQE5xVAAHygYYvk/VfVfMMwGE6/zBtiO8fYy++65 2SQtHofNY5430+72GBXz9CH74nmqn409dKmfResilINln8pbxvNv+wUyc09xUXXcK9mT pDEPiXA+tJOfT06GCuIwiHj0dEZHVvOowJ4ckyZqBjp4gYog5olpDaa8r+g3mN4rNK/e J4Z5vwnnaky8cBNLrhIVdX54e84FehYw5dUk3MxH+WH5oOaglADNzpcVvyIavgLgFtfH EkNQ== X-Gm-Message-State: AOAM533Hq2NR4Oy3A8O5Oo7RRe9+gMFuwWSDkDdtYbG5K2shHeI9fUt1 AfYajRubORpMos36rcGSraGTs2t0K0s= X-Google-Smtp-Source: ABdhPJwltYXH4Kr/7Jd29on+c2F3YNghXUrtcqQSctncJpRrq17F9VQCTldOwtteX8HrCI551yoAzX3DyD4= X-Received: from oupton.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:404]) (user=oupton job=sendgmr) by 2002:a05:6214:146d:: with SMTP id c13mr6829626qvy.46.1631816161461; Thu, 16 Sep 2021 11:16:01 -0700 (PDT) Date: Thu, 16 Sep 2021 18:15:49 +0000 In-Reply-To: <20210916181555.973085-1-oupton@google.com> Message-Id: <20210916181555.973085-4-oupton@google.com> Mime-Version: 1.0 References: <20210916181555.973085-1-oupton@google.com> X-Mailer: git-send-email 2.33.0.464.g1972c5931b-goog Subject: [PATCH v8 3/9] selftests: KVM: Fix kvm device helper ioctl assertions From: Oliver Upton To: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu Cc: Catalin Marinas , Will Deacon , Marc Zyngier , Peter Shier , Sean Christopherson , David Matlack , Paolo Bonzini , linux-arm-kernel@lists.infradead.org, Jim Mattson X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu The KVM_CREATE_DEVICE and KVM_{GET,SET}_DEVICE_ATTR ioctls are defined to return a value of zero on success. As such, tighten the assertions in the helper functions to only pass if the return code is zero. Suggested-by: Andrew Jones Reviewed-by: Andrew Jones Signed-off-by: Oliver Upton --- tools/testing/selftests/kvm/lib/kvm_util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 10a8ed691c66..0ffc2d39c80d 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -1984,7 +1984,7 @@ int kvm_device_check_attr(int dev_fd, uint32_t group, uint64_t attr) { int ret = _kvm_device_check_attr(dev_fd, group, attr); - TEST_ASSERT(ret >= 0, "KVM_HAS_DEVICE_ATTR failed, rc: %i errno: %i", ret, errno); + TEST_ASSERT(!ret, "KVM_HAS_DEVICE_ATTR failed, rc: %i errno: %i", ret, errno); return ret; } @@ -2008,7 +2008,7 @@ int kvm_create_device(struct kvm_vm *vm, uint64_t type, bool test) ret = _kvm_create_device(vm, type, test, &fd); if (!test) { - TEST_ASSERT(ret >= 0, + TEST_ASSERT(!ret, "KVM_CREATE_DEVICE IOCTL failed, rc: %i errno: %i", ret, errno); return fd; } @@ -2036,7 +2036,7 @@ int kvm_device_access(int dev_fd, uint32_t group, uint64_t attr, { int ret = _kvm_device_access(dev_fd, group, attr, val, write); - TEST_ASSERT(ret >= 0, "KVM_SET|GET_DEVICE_ATTR IOCTL failed, rc: %i errno: %i", ret, errno); + TEST_ASSERT(!ret, "KVM_SET|GET_DEVICE_ATTR IOCTL failed, rc: %i errno: %i", ret, errno); return ret; } -- 2.33.0.464.g1972c5931b-goog _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, 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 897DEC433EF for ; Thu, 16 Sep 2021 18:30:47 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 56FB561029 for ; Thu, 16 Sep 2021 18:30:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 56FB561029 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=QcN/vvWJc4zN2xOIHJ//Pqv7pdBYM1KX44Hj+SLHmuI=; b=VtLRZ8Y3V5xZUus5PJvOB650R3 0ZvbnMPBdc53jYJbsj5nd31DvJQOsBjW8r7Yr4DwOuAndXv/WKywDvqkVuPUcnhlLTjUl5t7ZqpeQ Z5H2fFqYvVjoQO5xGC9TqnnK9vrlrN6O7HPJUH1L3iwHpR3KrDwQOfZIk2LiY+IbbFxyPhKJ8qa14 h/kNJ4Cq0YorKk85AuRRR711XTsLgaAmZGzEZ6CBRMz528A9DE3TenAfHJpQnNg/wpsHWYGvxyuCG Aq3KpN4TW7F9oNo9edgENCq4C3JGRKEk1Xso1a1TagLmKLkdsJNfQ5bCBI6S/wXe2/FdbW3Cen44o Um3OsxiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQw7p-00C7V5-QE; Thu, 16 Sep 2021 18:28:49 +0000 Received: from mail-qv1-xf49.google.com ([2607:f8b0:4864:20::f49]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQvvW-00C23O-VY for linux-arm-kernel@lists.infradead.org; Thu, 16 Sep 2021 18:16:04 +0000 Received: by mail-qv1-xf49.google.com with SMTP id f14-20020a056214076e00b003773e95910bso63238266qvz.4 for ; Thu, 16 Sep 2021 11:16:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=JJZ190EFBdoAROgHmhQViRGxGG559ZmU5Q/9tQKxLoY=; b=VXFxleX8XZbxaXGsk52pqIxNLQlkPnbly3aXNjlVihcthPwkd7vAB2Ak2ReYQFp9Gz XNRC4NG00zHZWIHAqSy8Xe5QfHf2iqo04aBflACa0wBiSyaXPe41s9VLzvd0ze9jnmsk RDVfUZcyLzHoCDoidFIb1uEDOnlAcaLO7ll4PjIsWhMEwsl2NyGzWZj+GqNsRmgV9cyQ x24xui9+LrpOpWh2dLRRwg3b/yJbwu8oKo1k943MMDbWls0v3XpScoPeIvfAD0kuf4WM V8zsVGw4LFa0PpNqKVVgKta63ymqxpGPok4eoZB5FbmvmYMNpIrxqU4VMtlRfzAamFPi QU9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=JJZ190EFBdoAROgHmhQViRGxGG559ZmU5Q/9tQKxLoY=; b=NNBFb6s2PTF3+ShBqngPvU9f9JNImyLXJw2RcqiPe87KT0N01Lk0otDINtBxg7gc+v hhAjEYmLjT1GQlDyvHTF260zg+OOUHwUxLdIUUFlG29BDb5ybCtT7qbkdHlyeUpPxFnm o9WSqM8U9XbBi3vWrq8HjmNi9aVgYBN6o7E12+odrzt4deRPZ5MMHaWQS1lK6RkKdTz0 PI0c33rSBEEiIKiOtMhwGejFAmwC4KEvK2zyH8t9zrsSDAqn7abbud96O+GqTfPKC485 VAjc4DMVFeR8eu6G93KxKWGc1ERb+RItLFRZmegY0K7rZb62ld283XdtyIzbaF3VnJc3 kGMQ== X-Gm-Message-State: AOAM530TO62chE/7Zj5MhtyeQ5b/7n4f1DH8JGosfSrfsGYndAZ+rZRe E6XnvUQ0VICrU7zzovmmvS0jHwu1Nfg= X-Google-Smtp-Source: ABdhPJwltYXH4Kr/7Jd29on+c2F3YNghXUrtcqQSctncJpRrq17F9VQCTldOwtteX8HrCI551yoAzX3DyD4= X-Received: from oupton.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:404]) (user=oupton job=sendgmr) by 2002:a05:6214:146d:: with SMTP id c13mr6829626qvy.46.1631816161461; Thu, 16 Sep 2021 11:16:01 -0700 (PDT) Date: Thu, 16 Sep 2021 18:15:49 +0000 In-Reply-To: <20210916181555.973085-1-oupton@google.com> Message-Id: <20210916181555.973085-4-oupton@google.com> Mime-Version: 1.0 References: <20210916181555.973085-1-oupton@google.com> X-Mailer: git-send-email 2.33.0.464.g1972c5931b-goog Subject: [PATCH v8 3/9] selftests: KVM: Fix kvm device helper ioctl assertions From: Oliver Upton To: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu Cc: Paolo Bonzini , Sean Christopherson , Marc Zyngier , Peter Shier , Jim Mattson , David Matlack , Ricardo Koller , Jing Zhang , Raghavendra Rao Anata , James Morse , Alexandru Elisei , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, Andrew Jones , Will Deacon , Catalin Marinas , Oliver Upton X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210916_111603_069840_24BA26CD X-CRM114-Status: GOOD ( 11.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The KVM_CREATE_DEVICE and KVM_{GET,SET}_DEVICE_ATTR ioctls are defined to return a value of zero on success. As such, tighten the assertions in the helper functions to only pass if the return code is zero. Suggested-by: Andrew Jones Reviewed-by: Andrew Jones Signed-off-by: Oliver Upton --- tools/testing/selftests/kvm/lib/kvm_util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 10a8ed691c66..0ffc2d39c80d 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -1984,7 +1984,7 @@ int kvm_device_check_attr(int dev_fd, uint32_t group, uint64_t attr) { int ret = _kvm_device_check_attr(dev_fd, group, attr); - TEST_ASSERT(ret >= 0, "KVM_HAS_DEVICE_ATTR failed, rc: %i errno: %i", ret, errno); + TEST_ASSERT(!ret, "KVM_HAS_DEVICE_ATTR failed, rc: %i errno: %i", ret, errno); return ret; } @@ -2008,7 +2008,7 @@ int kvm_create_device(struct kvm_vm *vm, uint64_t type, bool test) ret = _kvm_create_device(vm, type, test, &fd); if (!test) { - TEST_ASSERT(ret >= 0, + TEST_ASSERT(!ret, "KVM_CREATE_DEVICE IOCTL failed, rc: %i errno: %i", ret, errno); return fd; } @@ -2036,7 +2036,7 @@ int kvm_device_access(int dev_fd, uint32_t group, uint64_t attr, { int ret = _kvm_device_access(dev_fd, group, attr, val, write); - TEST_ASSERT(ret >= 0, "KVM_SET|GET_DEVICE_ATTR IOCTL failed, rc: %i errno: %i", ret, errno); + TEST_ASSERT(!ret, "KVM_SET|GET_DEVICE_ATTR IOCTL failed, rc: %i errno: %i", ret, errno); return ret; } -- 2.33.0.464.g1972c5931b-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL 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 B76F0C433F5 for ; Thu, 16 Sep 2021 18:56:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9FA1560E52 for ; Thu, 16 Sep 2021 18:56:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345789AbhIPS6J (ORCPT ); Thu, 16 Sep 2021 14:58:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238777AbhIPS5c (ORCPT ); Thu, 16 Sep 2021 14:57:32 -0400 Received: from mail-qk1-x74a.google.com (mail-qk1-x74a.google.com [IPv6:2607:f8b0:4864:20::74a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 693FDC04A15D for ; Thu, 16 Sep 2021 11:16:02 -0700 (PDT) Received: by mail-qk1-x74a.google.com with SMTP id 23-20020a05620a071700b00426392c0e6eso44851737qkc.4 for ; Thu, 16 Sep 2021 11:16:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=JJZ190EFBdoAROgHmhQViRGxGG559ZmU5Q/9tQKxLoY=; b=VXFxleX8XZbxaXGsk52pqIxNLQlkPnbly3aXNjlVihcthPwkd7vAB2Ak2ReYQFp9Gz XNRC4NG00zHZWIHAqSy8Xe5QfHf2iqo04aBflACa0wBiSyaXPe41s9VLzvd0ze9jnmsk RDVfUZcyLzHoCDoidFIb1uEDOnlAcaLO7ll4PjIsWhMEwsl2NyGzWZj+GqNsRmgV9cyQ x24xui9+LrpOpWh2dLRRwg3b/yJbwu8oKo1k943MMDbWls0v3XpScoPeIvfAD0kuf4WM V8zsVGw4LFa0PpNqKVVgKta63ymqxpGPok4eoZB5FbmvmYMNpIrxqU4VMtlRfzAamFPi QU9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=JJZ190EFBdoAROgHmhQViRGxGG559ZmU5Q/9tQKxLoY=; b=Zb5Y2Nxbq3IzRhP8y+V+IgKIowoNHJGH5VuBfqYVZDYwuZNFPmxyT2r+Vbc5v49M0N 0zjtrRZswqwupnndX7l5dguvy09r/qcgs4DQSfVTYszsThY4vgMjbHhmkOEFtDV7W2Lg CZYhPlpbTKH6LweLpiMHqYfKIn3v2m9ZRPf/IQbJ3Jd71rNQGxY9/YNq2asgUGIfm3Jm NqnNsTCLWyHqX0bsIC5fr/1vou12qhel5Y6ovpEcraj9CaQRP0h4TuM3y6C5d36389rE wL/ktoXy8u8H5RfqMY6hi31PGFRrTHDqZQe9SnP3VatG/NNWofBLR5dKagruoGGB/jAC 41/A== X-Gm-Message-State: AOAM531NJ82gktuHZq5WuHCZrB/2bQF9QtNUHCIdsDRcx/lp4YZLz1Kd 9kis5lk+NnSA7DlU8Uf1b28Wk85Gy/tmPMfTO3H2t/gtgxD6oNO1AzMCGh5xcsPfiwMQGO1827B 8gNYuQQUF6NIfiDxsK19BPYqSFtW/JGXzyI5Dx4LzPw4bXuAaDaU9U2o0IQ== X-Google-Smtp-Source: ABdhPJwltYXH4Kr/7Jd29on+c2F3YNghXUrtcqQSctncJpRrq17F9VQCTldOwtteX8HrCI551yoAzX3DyD4= X-Received: from oupton.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:404]) (user=oupton job=sendgmr) by 2002:a05:6214:146d:: with SMTP id c13mr6829626qvy.46.1631816161461; Thu, 16 Sep 2021 11:16:01 -0700 (PDT) Date: Thu, 16 Sep 2021 18:15:49 +0000 In-Reply-To: <20210916181555.973085-1-oupton@google.com> Message-Id: <20210916181555.973085-4-oupton@google.com> Mime-Version: 1.0 References: <20210916181555.973085-1-oupton@google.com> X-Mailer: git-send-email 2.33.0.464.g1972c5931b-goog Subject: [PATCH v8 3/9] selftests: KVM: Fix kvm device helper ioctl assertions From: Oliver Upton To: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu Cc: Paolo Bonzini , Sean Christopherson , Marc Zyngier , Peter Shier , Jim Mattson , David Matlack , Ricardo Koller , Jing Zhang , Raghavendra Rao Anata , James Morse , Alexandru Elisei , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, Andrew Jones , Will Deacon , Catalin Marinas , Oliver Upton Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The KVM_CREATE_DEVICE and KVM_{GET,SET}_DEVICE_ATTR ioctls are defined to return a value of zero on success. As such, tighten the assertions in the helper functions to only pass if the return code is zero. Suggested-by: Andrew Jones Reviewed-by: Andrew Jones Signed-off-by: Oliver Upton --- tools/testing/selftests/kvm/lib/kvm_util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 10a8ed691c66..0ffc2d39c80d 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -1984,7 +1984,7 @@ int kvm_device_check_attr(int dev_fd, uint32_t group, uint64_t attr) { int ret = _kvm_device_check_attr(dev_fd, group, attr); - TEST_ASSERT(ret >= 0, "KVM_HAS_DEVICE_ATTR failed, rc: %i errno: %i", ret, errno); + TEST_ASSERT(!ret, "KVM_HAS_DEVICE_ATTR failed, rc: %i errno: %i", ret, errno); return ret; } @@ -2008,7 +2008,7 @@ int kvm_create_device(struct kvm_vm *vm, uint64_t type, bool test) ret = _kvm_create_device(vm, type, test, &fd); if (!test) { - TEST_ASSERT(ret >= 0, + TEST_ASSERT(!ret, "KVM_CREATE_DEVICE IOCTL failed, rc: %i errno: %i", ret, errno); return fd; } @@ -2036,7 +2036,7 @@ int kvm_device_access(int dev_fd, uint32_t group, uint64_t attr, { int ret = _kvm_device_access(dev_fd, group, attr, val, write); - TEST_ASSERT(ret >= 0, "KVM_SET|GET_DEVICE_ATTR IOCTL failed, rc: %i errno: %i", ret, errno); + TEST_ASSERT(!ret, "KVM_SET|GET_DEVICE_ATTR IOCTL failed, rc: %i errno: %i", ret, errno); return ret; } -- 2.33.0.464.g1972c5931b-goog