Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2923792rwb; Wed, 30 Nov 2022 12:48:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf4SVmATRxV+PMF1m6yEjxkyHSoyprvq9CwFqV4eTP594qvFNzNkxUvZitnt7iJbJuN7GZgm X-Received: by 2002:aa7:cb09:0:b0:463:ff10:4ff with SMTP id s9-20020aa7cb09000000b00463ff1004ffmr46696192edt.290.1669841302582; Wed, 30 Nov 2022 12:48:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669841302; cv=none; d=google.com; s=arc-20160816; b=p9+QM+hbWxVVSyLfQuGrZDHVP1C9dqlPQNZp/AQkjFJlMkJ1cXevyc0P1e6rqZNUCc VVDYuOwbGg1l+CzK8bodlEBYKqEdTXKvkEpj6W7zRvgEyOU8JskmcmTGrlF+nipZDuxC fhRDi+U0z5VcxiTz+5T9v/Txk2INDJiY9igD0l5NG5J+/YXEwMQa9D5pvths0vvoM1dJ Sj4ScAoPxV8D1SzJjWwoTlD/6td84uw9jU3DiML0615HUizaGUdn7VNpBgXjN614A2Vg +pLnCIKAGBHqjm7BGP6BbO1bQkjajXHRVPWEkprK0FVqhDKOfTf+6Ufoo+KUQQ3qRL9S c9pg== 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=y11sjnPF/7JikuhrwVU/0v+hXJZhRjQwRK6PoVdo3xYcrkCreNEfGR1PErlIpXz6dF nrMHW3dbqdfhzCqUgh6xEtQPuttc4nXJLPGRs8Z9khrtp4uuaIUE3FFH+wkDFaBG6dVC GoGSsHJ7SKuhIYoPWOyajlrt7rtwVYIq4mVwN5vMhlp6A2Jtk3pg5AwU0ohHtFrUBnBH hQJdrDfpo1f5Zsmz93c0eA5vFWXLbNX0TQIqQeNruJ2+ThaiAYUD090sl3a5gyAlVUAW 6c+REUVb/uTrETr8poRpBoInxkVF82t4FBDJVN7sFmPsM0PrD/DtxhfBoOsXCWm74rMe jpjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ph1+PQPZ; 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 g2-20020a056402320200b0046b692e8c79si1987147eda.610.2022.11.30.12.47.59; Wed, 30 Nov 2022 12:48:22 -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=Ph1+PQPZ; 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 S229847AbiK3UKK (ORCPT + 83 others); Wed, 30 Nov 2022 15:10:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229827AbiK3UJs (ORCPT ); Wed, 30 Nov 2022 15:09:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3706B9135D; Wed, 30 Nov 2022 12:09:48 -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 C7CF361D9A; Wed, 30 Nov 2022 20:09:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99DDBC43144; Wed, 30 Nov 2022 20:09:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669838987; bh=qgpIYxCoLxiSbmookPCEJSX95mijzZoDksXEWue5IhI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ph1+PQPZYu6to+v4+E7MJsXG71DdCfottZMxf1eZpKiRNy4oCyTaMkgg7vIjsTWfd zMoWUqXoDWvNEBc0SXOkA4kCbcz8+t/yk+iMNwmT2Un1nhaDleVV8d+NV40r6ftxFj cxwH/mphoi9jaylPCjBmsFX3CMsKSYtVmfsXEzVqvsWNcpVFcrTW+ZEB67mk9YGLv3 W3mh7bEz/PuxeV5DmQzgOSjK/tDXQOeP7Ga1mIlO5ES80sVZ8vV4i+f8DRDnA3LTnS EtP2kTMnYfhQeCLR8axup+u4wdlSNN+bgwsXC3Q71oVMYx0c/72Z8Ngh4GMbBzYA1Y JDRI5XE0qxaHQ== From: SeongJae Park To: SeongJae Park , Andrew Morton Cc: Shuah Khan , damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v2 09/11] selftests/damon/sysfs: test filters directory Date: Wed, 30 Nov 2022 20:09:35 +0000 Message-Id: <20221130200937.118005-10-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221130200937.118005-1-sj@kernel.org> References: <20221130200937.118005-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