Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp923556pxb; Fri, 22 Apr 2022 14:25:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymg6q2f/k4wVzNVo6MrfTMqSivIWhtSAkbOqMDs4bF8mz9cLGiHwAzAhIOqUs6/ldGiFky X-Received: by 2002:a63:224f:0:b0:399:4a1a:b01f with SMTP id t15-20020a63224f000000b003994a1ab01fmr5569650pgm.123.1650662742315; Fri, 22 Apr 2022 14:25:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650662742; cv=none; d=google.com; s=arc-20160816; b=qjk3WrlXV1IxjvvYUgFGs9Z1qVZthkeW8imINKrHsFhEQnvalV2nsqRHLX1QHMemVc qZfkskGYmYlxoz7BVM3tX2K7uHlDWe1Ra7EV+L7ltL+7bAIh60ErAPI1kp8nrWT727vO JGbhqe9oQazrAT0BZo3HW6+QO631UHgAQkGt8DULBEUPwwIHbxT2OHO4fxhWsBz82LDQ nGPJOC/ArjntXjuPWOxxwVlDkyqm4/QXEpXg1KSHclVHUXFzu9Z2Ns0gXTyK7MMhYtFe cXFZFonrErYot3kdqE5jjORt4Pnj0NxsiKfIrcmZn9fWjQOimfjPo6KVzpX5um++eo/O 7jZQ== 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=dFH0T0pXpNETbaNFYRkeQO7JMN8WlaRMY9DPSUKwh6Q=; b=nKOf/LPwVrIsnkkjMwo099S4NTYV/cYpePAa+y/qzork5wXd+mWMr//kDqJn3H1IDk ENEvwgi/FUdopGdV37vjDOsjkV9s2mxe/7Nz/BXA16g23nQ+kp3O6VB5K7UeLttKanzo T1ZhAUcUoKIumruMJVNKhbaOwEDdlNcKLmdLaJWGaGIWIs4WqWppTTGdtqj+JIpOwUyy rkMB6Z8EGOoiQd04yjllH0Lmnx4ITNHKWDezUgmOChPJlLXPQxUhJE8/EphPgtuayj28 s2SnGrd3WieKbh8c2p/HdvlhRBdLSulwE3FbJpYv0pZOiEEwceH5QM3KrsIYuTQsM/I/ kd1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QFWJGM+v; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 63-20020a630542000000b003aaa48153a3si5160361pgf.364.2022.04.22.14.25.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 14:25:42 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QFWJGM+v; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3D4CD2CF1D5; Fri, 22 Apr 2022 12:33:21 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357409AbiDSTE3 (ORCPT + 99 others); Tue, 19 Apr 2022 15:04:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357501AbiDSTC0 (ORCPT ); Tue, 19 Apr 2022 15:02:26 -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 ESMTP id 5AC303FBC8 for ; Tue, 19 Apr 2022 11:59:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650394772; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dFH0T0pXpNETbaNFYRkeQO7JMN8WlaRMY9DPSUKwh6Q=; b=QFWJGM+vabnL/ZiPd9Np6Ykm8P9O9x7c+cKDxXz+z603LxvKFtYp3XWek3FfbQ5u0BiGYk nQuicCB6M5cQy0dMU+cyrjlILdnf7PfJMRD0jWDRdaMZOAJsWOxa5vco3/w9XoO9YH1MJY IaVk9Het/ks/MnmshB0Emjph8FA2YMQ= 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-625-vJUDlclwOgKtzQjnvyfezQ-1; Tue, 19 Apr 2022 14:59:21 -0400 X-MC-Unique: vJUDlclwOgKtzQjnvyfezQ-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 1B00486B8A8; Tue, 19 Apr 2022 18:59:21 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id D3B66572321; Tue, 19 Apr 2022 18:59:16 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Christian Borntraeger , Janosch Frank , Claudio Imbrenda Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, David Hildenbrand , Paolo Bonzini , Shuah Khan , Janis Schoetterl-Glausch , linux-s390@vger.kernel.org Subject: [PATCH v2 4/4] KVM: s390: selftests: Use TAP interface in the reset test Date: Tue, 19 Apr 2022 20:58:57 +0200 Message-Id: <20220419185857.128351-5-thuth@redhat.com> In-Reply-To: <20220419185857.128351-1-thuth@redhat.com> References: <20220419185857.128351-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE 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 Let's standardize the s390x KVM selftest output to the TAP output generated via the kselftests.h interface. Signed-off-by: Thomas Huth --- tools/testing/selftests/kvm/s390x/resets.c | 38 +++++++++++++++++----- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/kvm/s390x/resets.c b/tools/testing/selftests/kvm/s390x/resets.c index b143db6d8693..1d649ec77260 100644 --- a/tools/testing/selftests/kvm/s390x/resets.c +++ b/tools/testing/selftests/kvm/s390x/resets.c @@ -12,6 +12,7 @@ #include "test_util.h" #include "kvm_util.h" +#include "kselftest.h" #define VCPU_ID 3 #define LOCAL_IRQS 32 @@ -202,7 +203,7 @@ static void inject_irq(int cpu_id) static void test_normal(void) { - pr_info("Testing normal reset\n"); + ksft_print_msg("Testing normal reset\n"); /* Create VM */ vm = vm_create_default(VCPU_ID, 0, guest_code_initial); run = vcpu_state(vm, VCPU_ID); @@ -225,7 +226,7 @@ static void test_normal(void) static void test_initial(void) { - pr_info("Testing initial reset\n"); + ksft_print_msg("Testing initial reset\n"); vm = vm_create_default(VCPU_ID, 0, guest_code_initial); run = vcpu_state(vm, VCPU_ID); sync_regs = &run->s.regs; @@ -247,7 +248,7 @@ static void test_initial(void) static void test_clear(void) { - pr_info("Testing clear reset\n"); + ksft_print_msg("Testing clear reset\n"); vm = vm_create_default(VCPU_ID, 0, guest_code_initial); run = vcpu_state(vm, VCPU_ID); sync_regs = &run->s.regs; @@ -266,14 +267,35 @@ static void test_clear(void) kvm_vm_free(vm); } +struct testdef { + const char *name; + void (*test)(void); + bool needs_cap; +} testlist[] = { + { "initial", test_initial, false }, + { "normal", test_normal, true }, + { "clear", test_clear, true }, +}; + int main(int argc, char *argv[]) { + bool has_s390_vcpu_resets = kvm_check_cap(KVM_CAP_S390_VCPU_RESETS); + int idx; + setbuf(stdout, NULL); /* Tell stdout not to buffer its content */ - test_initial(); - if (kvm_check_cap(KVM_CAP_S390_VCPU_RESETS)) { - test_normal(); - test_clear(); + ksft_print_header(); + ksft_set_plan(ARRAY_SIZE(testlist)); + + for (idx = 0; idx < ARRAY_SIZE(testlist); idx++) { + if (!testlist[idx].needs_cap || has_s390_vcpu_resets) { + testlist[idx].test(); + ksft_test_result_pass("%s\n", testlist[idx].name); + } else { + ksft_test_result_skip("%s - no VCPU_RESETS capability\n", + testlist[idx].name); + } } - return 0; + + ksft_finished(); } -- 2.27.0