Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6615809rwb; Mon, 5 Dec 2022 15:12:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf4KxbkXafuYP2/5hax6zV9cbwdMGV42IvVjAXZY+ksxDoUX8oe8me7q6DTjZm+k2c5HHCRG X-Received: by 2002:a17:90a:a095:b0:218:e358:12d2 with SMTP id r21-20020a17090aa09500b00218e35812d2mr61791518pjp.208.1670281958741; Mon, 05 Dec 2022 15:12:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670281958; cv=none; d=google.com; s=arc-20160816; b=hCVwAiaNBsFXbkFuK3ALVwj3Xoid/2Votelz2zyNa3nN25+uJuMuzXwRGEV/lO/RM0 fHrhU3G4f1ng/3gtBgbkCwBIsKh7rspjB/6HSyjKaLttSIOtu/ZqlLD9/WFojj/rm2QV NeGlQUR0RWmVRbn91qFm3I2VBDkFrYBICJEarrylrZoypftSRyxwzl+rxTWI0Mo25zgq kLNy66P1l2EyF3w+VwjZMOwq9dtTx2dyCLsBwyDpbSSIjDAR+lWiFLeDT4k5g8I0JJVg C78RzPugbYX3D02QIaxtNjWImE9npKymrh07ZyRuJibx3A4Z02t9/K+JE5HYefHlgBnE pXnA== 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=+OTj21n3Wg9gwrrIBxAx4NidZtXBp6SPjJpmtwVGK9A=; b=B7ugVzFyzYRvPsmtzEoCyOA/m4KbIhgKjFgg7i2XsRwF/ezImg3V2us0luuSXqWGWN Q5LaFHRxqf0ooDU8oMByV6v8SBrUpmrdBpVITs7BMqNprAsrRHZb29B9XlEN4dxirKBo 3OQzKz0ESUqCpsJaRpVeucce/D8K4TIcQy4ePeBEgkeAh9HUEwYy0PSozx0cwrypKD9t jeq4Q17623ZSxZak404JdKIHh6zbsqXXJ1/zANVnlgYMzeNyg8JE2P+yc2N7Ts46aiOT hwbNWu9emCaXG5wKWllP/ERXptV5a1r6ErnwFADpjvXu9H8Jt9QczBd2nnp5D4kzADGY 57EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k78k7YEx; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w12-20020a63fb4c000000b0043941763eadsi15503831pgj.835.2022.12.05.15.12.27; Mon, 05 Dec 2022 15:12:38 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=k78k7YEx; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233863AbiLEXJk (ORCPT + 79 others); Mon, 5 Dec 2022 18:09:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232604AbiLEXIq (ORCPT ); Mon, 5 Dec 2022 18:08:46 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E1EEFACE; Mon, 5 Dec 2022 15:08:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CDA5E614C5; Mon, 5 Dec 2022 23:08:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28A3AC433D6; Mon, 5 Dec 2022 23:08:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670281721; bh=qgpIYxCoLxiSbmookPCEJSX95mijzZoDksXEWue5IhI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k78k7YExuF6/YEEvcLQCrdPFVM8+qZ66Sw1wGSQt1vOP6nrkfOevcW9LvmA+peVW5 aDGsFBfIOyR+pD6XRfeyIyNJq6d6quIA1qUV451ks6L5wwqGhGcaPKXvj6Pg0kIFn8 BATF7tCEg6mGkduLufzPqMOvR3R8PoZDrrnIHcIW9nNoWcaXgzH/V7/0z03ujbr1AS Azx5pHsw1fGteX+pc6NdS8LbE1lyO4RXhdINeyGAhRwyiQMBg+5EleKrTIgEnfU5Nk zfHofzo5dszklOcY3XDH/svZ9cz0X2+TqTsRq03hk8zd9m38KcvvTi3p0Bke4T1KDM bGdKopAY9JjLQ== From: SeongJae Park To: Andrew Morton Cc: Shuah Khan , damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH 09/11] selftests/damon/sysfs: test filters directory Date: Mon, 5 Dec 2022 23:08:28 +0000 Message-Id: <20221205230830.144349-10-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221205230830.144349-1-sj@kernel.org> References: <20221205230830.144349-1-sj@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Add simple test cases for scheme filters of DAMON sysfs interface. The test cases check if the files are populated as expected, receives some valid inputs, and refuses some invalid inputs. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/sysfs.sh | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tools/testing/selftests/damon/sysfs.sh b/tools/testing/selftests/damon/sysfs.sh index db4942383a50..a00336ffdcad 100644 --- a/tools/testing/selftests/damon/sysfs.sh +++ b/tools/testing/selftests/damon/sysfs.sh @@ -96,6 +96,34 @@ test_stats() done } +test_filter() +{ + filter_dir=$1 + ensure_file "$filter_dir/type" "exist" "600" + ensure_write_succ "$filter_dir/type" "anon" "valid input" + ensure_write_succ "$filter_dir/type" "memcg" "valid input" + ensure_write_fail "$filter_dir/type" "foo" "invalid input" + ensure_file "$filter_dir/matching" "exist" "600" + ensure_file "$filter_dir/memcg_path" "exist" "600" +} + +test_filters() +{ + filters_dir=$1 + ensure_dir "$filters_dir" "exist" + ensure_file "$filters_dir/nr_filters" "exist" "600" + ensure_write_succ "$filters_dir/nr_filters" "1" "valid input" + test_filter "$filters_dir/0" + + ensure_write_succ "$filters_dir/nr_filters" "2" "valid input" + test_filter "$filters_dir/0" + test_filter "$filters_dir/1" + + ensure_write_succ "$filters_dir/nr_filters" "0" "valid input" + ensure_dir "$filters_dir/0" "not_exist" + ensure_dir "$filters_dir/1" "not_exist" +} + test_watermarks() { watermarks_dir=$1 @@ -143,6 +171,7 @@ test_scheme() test_access_pattern "$scheme_dir/access_pattern" test_quotas "$scheme_dir/quotas" test_watermarks "$scheme_dir/watermarks" + test_filters "$scheme_dir/filters" test_stats "$scheme_dir/stats" test_tried_regions "$scheme_dir/tried_regions" } -- 2.25.1