Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1573732iog; Sat, 25 Jun 2022 13:07:08 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ve1/UJmcZ2KiPXQYSRZ6Rp23XZKDneSKx9QDTI20PSCyqlnoBT4TecN7m15HJTYdTow3ii X-Received: by 2002:a65:6499:0:b0:3fc:dcaa:ad62 with SMTP id e25-20020a656499000000b003fcdcaaad62mr4780521pgv.63.1656187628053; Sat, 25 Jun 2022 13:07:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656187628; cv=none; d=google.com; s=arc-20160816; b=kFy+UQOyk3XBL634WEfFWa8/hOqQw7Y1nNc+G/bztv/ZUQzPJ62CexZpl2zkLWg4Eq FefL4ivV7ayZz9Ng65yRT832wzrP7VvcG7pGhaHbiCQtnmZeACU0o/9b1Piaev9BGD/n /C3KfP/XOR1uskMt5Bz4KIjkdzY4WYDZQPbtHsZ2GCFm3kZnbii2UtwhzDiFtxl9uzCZ 7bX7N/AhE5sMtxVMNLS7Jy7bYrxtQphDDjTTkRiV0CY9ZT5drBHr3CkDmAgbUCdRhcZr H1DbHE9oka2lGR8FJGxttEPrGGUa4rRrZOSgOeYNqsLLTwmlUZrfOeP4kobrCwf40L1q 9KEw== 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=LBICSrZ7ZTWE0aGK5zqnffAevM2FyYaErZq8jVNzZXA=; b=yslGKM19FIYpztWTiA8pxku1jfZRG243S96WJmvMBmU6XpUX4lITm0xVB4dkf+NSMY GoDwjscbiM+4/jeJy0nF11mrfgpMPWyo5xrWQyX5lYKjm1DEomu+qWRWqQxgS+O435AG iZKtPjEzdoFVC7wRTd/i42dJ74KRK6oFfJbwyyLZnj4KHcD8yf4kcSpABTHRQT02qiXf NfdRT7Hg0lJCC9MVB8tqAnOWwe1r2kqRDx7RZPc/AYEeFKqpKNx8072tEDpdrYJZtYin Z76CcF2c+LG3Hd8Q3ki2d5lNEcwdFabGLDafTyWgBamB21d2UsnTFdNj/MC1ZCPbzPKr uKkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QMQzLC22; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d4-20020a170902aa8400b0016a639db6e9si8603296plr.183.2022.06.25.13.06.56; Sat, 25 Jun 2022 13:07:08 -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=@gmail.com header.s=20210112 header.b=QMQzLC22; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233317AbiFYTw6 (ORCPT + 99 others); Sat, 25 Jun 2022 15:52:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231474AbiFYTw6 (ORCPT ); Sat, 25 Jun 2022 15:52:58 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AEDEDA9; Sat, 25 Jun 2022 12:52:57 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id p3-20020a17090a428300b001ec865eb4a2so8700516pjg.3; Sat, 25 Jun 2022 12:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LBICSrZ7ZTWE0aGK5zqnffAevM2FyYaErZq8jVNzZXA=; b=QMQzLC22KyQXzmmmmZz6u5dIeDl23a/ENie1aFh9995ukEC0MzKuKszLQl+8mcAwh7 YPKbC09oROeAK125AYXWnHmXsgWRoXfx+hOnTgmX8IlzsG8fzyxSysbZDzzzIi7PNqlE ZMtA6mW04ey2gLGM024Tb1B3yrV0jH6nb1RWXbSzfyPvEN7V2fkwrVYgLJk82PjCmMSe fynTwVvBKtSrzi+F4ReP+VRyL1jzCvXsVAPVWKBkPB/nJskPURhNwm+WaM3WuhXNfECo M/PaGWCraxwncSPxHxZyoFxMQ0wpSdqvjl27d7uUiF3ZZHK0dh5oEHkOpuNkhzzjRdYa +u/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LBICSrZ7ZTWE0aGK5zqnffAevM2FyYaErZq8jVNzZXA=; b=wD/AoMr2RVaIsVlBLjLZ3kUC+1XiLDSKfNqjQQeUhMEpkcoaEW6h35h6G1uYdF3NK3 iOfiyuTyfK08jpjXqAaVTzGbj4hLQoGTLuaQFMxMAYc8B+CyuoAqfpMlzPftVGrP3nYe BRMeRfHpfGMcM0xSNlofj9ae7g5Dj6qAGK7J8Z6GnWdLbiSF0HOpKbnmjY6FAfoZ2nG+ xCO6xDqAU3336ycy3PgZOEcDe43NmSw9CHQTuRZb6b73oGhA+kF4KsA+dz1406DOyXki uf+Sq7i2tyEKG3PhxJ2fUiL0kGSLZ09laqOYOYMokK2+qsxO52/MfpBPrfkfnnPrni4m FLdQ== X-Gm-Message-State: AJIora/A47Wx8Tf/UBp3vclys9ZtFjyR6R8/KrPoMEj9Zq41WXisXdPm x5+W+57dTE7EYHFyFsvnsMk= X-Received: by 2002:a17:902:b083:b0:16a:2ce3:ffe6 with SMTP id p3-20020a170902b08300b0016a2ce3ffe6mr5703160plr.151.1656186776808; Sat, 25 Jun 2022 12:52:56 -0700 (PDT) Received: from fedora.. ([2409:4042:261d:8029:35f0:415b:b9b4:3fcb]) by smtp.gmail.com with ESMTPSA id c12-20020a624e0c000000b005258df61ceesm1335163pfb.90.2022.06.25.12.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Jun 2022 12:52:55 -0700 (PDT) From: Gautam To: sj@kernel.org, shuah@kernel.org Cc: Gautam , damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4] kselftests/damon: add support for cases where debugfs cannot be read Date: Sun, 26 Jun 2022 01:22:45 +0530 Message-Id: <20220625195245.4368-1-gautammenghani201@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220625185501.85168-1-sj@kernel.org> References: <20220625185501.85168-1-sj@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 The kernel is in lockdown mode when secureboot is enabled and hence debugfs cannot be used. Add support for this and other general cases where debugfs cannot be read and communicate the same to the user before running tests. Signed-off-by: Gautam --- Changes in v2: 1. Modify the error message to account for general cases. 2. Change the return code so that the test is skipped. Changes in v3: 1. Change the name of variable holding the error message. Changes in v4: 1. Correct the mode of the source file. tools/testing/selftests/damon/_chk_dependency.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/testing/selftests/damon/_chk_dependency.sh b/tools/testing/selftests/damon/_chk_dependency.sh index 0189db81550b..0328ac0b5a5e 100644 --- a/tools/testing/selftests/damon/_chk_dependency.sh +++ b/tools/testing/selftests/damon/_chk_dependency.sh @@ -26,3 +26,13 @@ do exit 1 fi done + +permission_error="Operation not permitted" +for f in attrs target_ids monitor_on +do + status=$( cat "$DBGFS/$f" 2>&1 ) + if [ "${status#*$permission_error}" != "$status" ]; then + echo "Permission for reading $DBGFS/$f denied; maybe secureboot enabled?" + exit $ksft_skip + fi +done -- 2.36.1