From patchwork Wed Oct 26 14:10:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 11285 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp294428wru; Wed, 26 Oct 2022 07:17:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Ye0J04eKv4LeZ8MMmWM1kXDEJy/s92hzGgc2t130UMn/mlAZv5GeMEbUbmLXHcVyCdoRq X-Received: by 2002:a63:b5d:0:b0:45f:d7d0:5808 with SMTP id a29-20020a630b5d000000b0045fd7d05808mr37139985pgl.330.1666793838994; Wed, 26 Oct 2022 07:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666793838; cv=none; d=google.com; s=arc-20160816; b=dnmJW3nwTPQPPNcUxT37LgVQ6ecZzK38BS2FpIIQt5p7OwLtmO+5UuWbzsVUO74lzw Su/aPfDWl/C36qAwMvwbJUfGWqLJ3uBMzP0E6q2fRFotFR2xg6zCCXHeGvuaGbNyzFxB oVJHcj3simOlkDVL51ydXhIKxgR1f0VlN8c1YGDqHPC67ZveNwYPckEbUfe+gqwStApg 2WEiXKmWFU7QUWcRahy0vwFHY2Po+eB9Dd2K2n4cjTclHB6FM1FCO810HQW/XjQV3Ziz axugkB+3u7N5JEiu1nPIC2Id98xct7tyeyloQV3AlvE73zRsHUb1V1OD1L2QnSmN7nK/ lk1Q== 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:mime-version:date :dkim-signature; bh=oVCnLyxMsU2FaLl3D+PS+uuU9HLGod0PTLLsMzXQBPI=; b=lRissRPG8N/Eac/pVXA/LbQByvHchDGUnmSZljWzUPUiHSNdJm0BY6KBgyG0sumbfM URK3S4Aq6v1P+QlnXqZaBvsGWDpQK5QZRh4TrOZsgQYhVKVjiWn9oVaiH24dBTqsDUKJ YNoY1ls9xg+IDqeSg0ENIQqJgZOYxIgqQdNZy46Lfzr+AQ6a5PsNgU2QmB5Yx/qy6J5z QX7eF1GUv1kFk2iGNTHqRc4oJnXRDQJaRNM41EA0ci/cQ44O1NUjWr3E4eXcwiLf136+ Rdi0oF2MWc/ReIzMXrTN0PfDyIJPRh3MKi3paNvkMVlFikiXQXioFBUX7sqf74Nzbi11 0Kew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=MpZihCZI; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z6-20020a170902d54600b001768876fc87si6535867plf.362.2022.10.26.07.17.04; Wed, 26 Oct 2022 07:17:18 -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=20210112 header.b=MpZihCZI; 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 S234170AbiJZOKt (ORCPT + 99 others); Wed, 26 Oct 2022 10:10:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233806AbiJZOKs (ORCPT ); Wed, 26 Oct 2022 10:10:48 -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 2A24B8BB86 for ; Wed, 26 Oct 2022 07:10:47 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id h7-20020a252107000000b006cbb0e24adaso871965ybh.13 for ; Wed, 26 Oct 2022 07:10:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=oVCnLyxMsU2FaLl3D+PS+uuU9HLGod0PTLLsMzXQBPI=; b=MpZihCZI6V0d3vjHzoWFyZNUGKtaDmyQeeQjONz5yCsLwixNRtRYH8kVbw4IAj071I RtI5ylTTr0HmD103lHtW8GBjStpSSNk7D2IdMVsYQ4YozdkznqH/iHzaYWETb+Gb4s5A clqSzqiPC21fxU4gz1CciKwcJqKxXl6U66oOiuk6W/D6fsilKWyi7v/PxHeAQjRdQ0Yl 4f194yEaUt9VdJlHvDFcDgIl2/GU9prcdlsKivsUZaYe/wLHWO3865s7Q2e79/zhVqKq 42x/T7UNAP0Etik7BBFtJ8htlIYmUX4A55kRJXFgloxuG60P3M+tySMy5GQjuqin4mzn Y+ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=oVCnLyxMsU2FaLl3D+PS+uuU9HLGod0PTLLsMzXQBPI=; b=mNMLiYCWGCH2wIA4CD4fn5KMzJKHB/OWx9XYrWyUf5+rvZMOVPm4k4KX+9bCqoC9IS +1nUzL0eQ5zPFfTrJnWqHDSPfYmZBYLcDvSxL3AMjiliMv+/9JVu6Xq2s3m80v2YckIM lxhtKawMmOj1toDeL03LXPMkZW8F0EGuXD7gK1jBlmLEWPB9f4Z35rz9A67XHo55/EdK 9SXpiHw4dTl5YgZn6L7eSCjuL8A7CyRK3qpi3X+yIcjHDTLpiHOgIfJFC43oUv3c9gnk 0EtD+nFtjRYO79PEmlzYDK044KW8JgnjvJP059ghbV2YvYrUHjgTB0edAAw6TUt/OCwn 4Dwg== X-Gm-Message-State: ACrzQf0zPQ6fZpbPsXqCijT7PCZcSMoWiMQGX5orLqphqOPrPbiW/ET1 mnNQfMAR8WcjApxcrA718MUCrzxzIXeNbQ== X-Received: from slicestar.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:20a1]) (user=davidgow job=sendgmr) by 2002:a0d:d857:0:b0:36f:c0f7:f0ec with SMTP id a84-20020a0dd857000000b0036fc0f7f0ecmr7838435ywe.82.1666793446446; Wed, 26 Oct 2022 07:10:46 -0700 (PDT) Date: Wed, 26 Oct 2022 22:10:40 +0800 Mime-Version: 1.0 X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog Message-ID: <20221026141040.1609203-1-davidgow@google.com> Subject: [PATCH] perf/hw_breakpoint: test: Skip the test if dependencies unmet From: David Gow To: Marco Elver , Peter Zijlstra , Ingo Molnar , Dmitry Vyukov Cc: David Gow , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, Brendan Higgins , Daniel Latypov , kasan-dev@googlegroups.com 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,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=ham 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747760016307549511?= X-GMAIL-MSGID: =?utf-8?q?1747760016307549511?= Running the test currently fails on non-SMP systems, despite being enabled by default. This means that running the test with: ./tools/testing/kunit/kunit.py run --arch x86_64 hw_breakpoint results in every hw_breakpoint test failing with: # test_one_cpu: failed to initialize: -22 not ok 1 - test_one_cpu Instead, use kunit_skip(), which will mark the test as skipped, and give a more comprehensible message: ok 1 - test_one_cpu # SKIP not enough cpus This makes it more obvious that the test is not suited to the test environment, and so wasn't run, rather than having run and failed. Signed-off-by: David Gow Acked-by: Marco Elver Reviewed-by: Daniel Latypov --- kernel/events/hw_breakpoint_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/events/hw_breakpoint_test.c b/kernel/events/hw_breakpoint_test.c index 5ced822df788..c57610f52bb4 100644 --- a/kernel/events/hw_breakpoint_test.c +++ b/kernel/events/hw_breakpoint_test.c @@ -295,11 +295,11 @@ static int test_init(struct kunit *test) { /* Most test cases want 2 distinct CPUs. */ if (num_online_cpus() < 2) - return -EINVAL; + kunit_skip(test, "not enough cpus"); /* Want the system to not use breakpoints elsewhere. */ if (hw_breakpoint_is_used()) - return -EBUSY; + kunit_skip(test, "hw breakpoint already in use"); return 0; }