From patchwork Wed Jul 12 07:59:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 118907 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp985699vqm; Wed, 12 Jul 2023 01:06:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlGVyTh6/eCoQFW0snh7KkYJpL9Py3j3A/nlLvghHuSSRWmBHPs9Wx5TPGtmIA/85608QdSI X-Received: by 2002:aa7:d302:0:b0:51d:d1af:df15 with SMTP id p2-20020aa7d302000000b0051dd1afdf15mr19268837edq.23.1689149169712; Wed, 12 Jul 2023 01:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689149169; cv=none; d=google.com; s=arc-20160816; b=WS7wIiLTh1goZWhan4mbWbzz2V9NQpUgUMRoVjvxvfwBQzaBaeo0YxhCg8cpnyLCTE iQ3fL+UNY4pgaIpRcQkgN8WBoIrqTZitR45RLW3JGxHJLFYlYaGHyNsoOgIF/WBqVJDa c/ppMa1cdeg+HZrDwL8x2P+Weruvd9UDDiWmnYFqfZtmCfa6E0BuJwrjq84vU54u49xo WiA5jmD9JZV8gAGP4b5X3sRHKcu0Gi1vQoLnhw/QI5Hfd9IOwx616Eby8UQLibCZ3ENv 8VDnV0wvyXNvbb7IVBNqizdpNbEbF75WzuhM/fab+zXC/frrkASg8hMns2OyPJOmm/F3 b2Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Pvw4j2K8XqOylaArL4/E5ue75t8iqRSsLMUN6UWuxgI=; fh=CoqLVoHqzprQiJNt8WDryjpq4BuBxl6+dCSpUOnVgUQ=; b=jygPphL6QHK5SuGVe2+Yvww/H2G5F1jygrJ5C4/sQFCkPEKltXmWH9OpreVNBY1U28 goSjQMMT8LhJ9byLvfBqPNZ/rvTlc8KxnidUb74j5fL1JX1m4S9o3CovaBTJ/eaBikg+ 3qxIeX3EvQa6kTRwr3memMBdhaRGrWF2lu01lzPj/2Lt1PN9iRZHd3ny/k/w8l3Msliq I2sJD8QbSs6Wd10bKN1TfehaoGejhhBwfR1y8k8AcWNl2tArZlBTnylZl0hybCZTB9cJ U6umqjXtor/UjxNza/Id8+0KsxZ0xyArCuBd1aVRXaK8SyGxhDIPKwg7hLRmb+VkPPlx ge9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CMj+ygwJ; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i26-20020a50fc1a000000b0051ddbb7c57csi4214447edr.460.2023.07.12.01.05.46; Wed, 12 Jul 2023 01:06:09 -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=@redhat.com header.s=mimecast20190719 header.b=CMj+ygwJ; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231241AbjGLIAh (ORCPT + 99 others); Wed, 12 Jul 2023 04:00:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231260AbjGLIAQ (ORCPT ); Wed, 12 Jul 2023 04:00:16 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 004EF198A for ; Wed, 12 Jul 2023 00:59:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689148765; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pvw4j2K8XqOylaArL4/E5ue75t8iqRSsLMUN6UWuxgI=; b=CMj+ygwJznGeplTyxl2PMYuU+DDZwLqYO+2Izi3tLuwIaM++Kb4oEfQXHSYXfC8XN5eSiT XNNVmBuFgVx5r7Uh5wc05cRVpgWz7O04PL7q8l7NobKAVsNHxp51UvndkFtnZKm7TDnSUy iqa8sz31YVhWqR3V5cwTbB5hddFvnlc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-623-8hIItBy_PVCdm0HVPdI0AQ-1; Wed, 12 Jul 2023 03:59:21 -0400 X-MC-Unique: 8hIItBy_PVCdm0HVPdI0AQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 07887800CAF; Wed, 12 Jul 2023 07:59:21 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id A52F5492C13; Wed, 12 Jul 2023 07:59:19 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: linux-kselftest@vger.kernel.org, David Matlack Subject: [PATCH 4/4] KVM: selftests: x86: Use TAP interface in the userspace_msr_exit test Date: Wed, 12 Jul 2023 09:59:10 +0200 Message-Id: <20230712075910.22480-5-thuth@redhat.com> In-Reply-To: <20230712075910.22480-1-thuth@redhat.com> References: <20230712075910.22480-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771201280164105077 X-GMAIL-MSGID: 1771201280164105077 Use the kselftest_harness.h interface in this test to get TAP output, so that it is easier for the user to see what the test is doing. Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé --- .../kvm/x86_64/userspace_msr_exit_test.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c b/tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c index 3533dc2fbfeeb..9843528bba0c6 100644 --- a/tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c +++ b/tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c @@ -8,6 +8,7 @@ #define _GNU_SOURCE /* for program_invocation_short_name */ #include +#include "kselftest_harness.h" #include "test_util.h" #include "kvm_util.h" #include "vmx.h" @@ -527,7 +528,7 @@ static void run_guest_then_process_ucall_done(struct kvm_vcpu *vcpu) process_ucall_done(vcpu); } -static void test_msr_filter_allow(void) +TEST(msr_filter_allow) { struct kvm_vcpu *vcpu; struct kvm_vm *vm; @@ -646,7 +647,7 @@ static void handle_wrmsr(struct kvm_run *run) } } -static void test_msr_filter_deny(void) +TEST(msr_filter_deny) { struct kvm_vcpu *vcpu; struct kvm_vm *vm; @@ -693,7 +694,7 @@ static void test_msr_filter_deny(void) kvm_vm_free(vm); } -static void test_msr_permission_bitmap(void) +TEST(msr_permission_bitmap) { struct kvm_vcpu *vcpu; struct kvm_vm *vm; @@ -786,7 +787,7 @@ static void run_msr_filter_flag_test(struct kvm_vm *vm) } /* Test that attempts to write to the unused bits in a flag fails. */ -static void test_user_exit_msr_flags(void) +TEST(user_exit_msr_flags) { struct kvm_vcpu *vcpu; struct kvm_vm *vm; @@ -804,13 +805,5 @@ static void test_user_exit_msr_flags(void) int main(int argc, char *argv[]) { - test_msr_filter_allow(); - - test_msr_filter_deny(); - - test_msr_permission_bitmap(); - - test_user_exit_msr_flags(); - - return 0; + return test_harness_run(argc, argv); }