From patchwork Sun Nov 12 19:46:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13453387 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EFE6C072AB for ; Sun, 12 Nov 2023 19:46:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1277C8D001D; Sun, 12 Nov 2023 14:46:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0975A8D0023; Sun, 12 Nov 2023 14:46:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D5F7F8D001D; Sun, 12 Nov 2023 14:46:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id B295B8D0021 for ; Sun, 12 Nov 2023 14:46:22 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 82B4414068B for ; Sun, 12 Nov 2023 19:46:22 +0000 (UTC) X-FDA: 81450333804.19.C0EBA4B Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf04.hostedemail.com (Postfix) with ESMTP id 85E0440009 for ; Sun, 12 Nov 2023 19:46:20 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XXNBzq2z; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf04.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1699818381; a=rsa-sha256; cv=none; b=N9aCJ27XQ0Se4aGzDb479m4J1dNwiNB8vVSrFT8g26F9BQ0fQfuCa67jmRD/1LlQa8Qo9Y GElt3xx6zjIlumle3vWDk3olEoG6J2KL2Vn9XvjsJ3YgKfyZQ5hH0t+u8QPnrfEnd7haI5 xWpjt8K8NvjrOZr9n5Ieil/tX8q7eaE= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XXNBzq2z; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf04.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1699818381; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=smsCDfkqa8LsuAqRj5y7TvHYHkhdv6jMiB4jYS248x8=; b=6p2cT4EVZ0CLl4p+umtGC5dxbNei3VTbrCr38lgY6hmpSKK/vQitN9sg9NPBXlnrrxsYlS pbc3U1FKE9cWmqOopNDEtnTzeFZ48LSNn6YFMqxKMqPg8xbnPGZIn2phCcR8ilSa4Yg81T ST1239HtKJWCuhHzVnMnySiQTs3a420= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id C4AB9CE0EC1; Sun, 12 Nov 2023 19:46:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79A10C433C8; Sun, 12 Nov 2023 19:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699818377; bh=tm53i8GhYDRGpRCnZgtLIn7P8jIf3OMjFqv6O/swkJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XXNBzq2zCZgn2UYIGKvFcCBBjZM3OsXnwYAYjfdnuvAc7vizTJiNCl+uyVVJ6WyIm Cfgcc3kzBfeZ3Jb5Tckg+aiaCEnG/DcKQxoVCzBEwRPhaIgEZYt1XfmOrheu95cfLH OGw+GOLfmabiO+SZ/+OReGQK7XVM2GUG8Q0FZEyEtHLjcauH9QISo0m2+uBSHkttxd t7TGcn79ZD6lqANkN6R6bAfwexg2lNxX+DqYtmWqIygswnmKYtfczhmiNjZBWJyY/h 99/hFUjkYThSkmQk2NsHbl+q8HGW8K0e1YEk7+QzlP5FY4ocV5B+Q/nD9Me0FxYIvI X9b4MAHnJ6GjA== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , Shuah Khan , damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 6/8] selftests/damon: test quota goals directory Date: Sun, 12 Nov 2023 19:46:05 +0000 Message-Id: <20231112194607.61399-7-sj@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231112194607.61399-1-sj@kernel.org> References: <20231112194607.61399-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 85E0440009 X-Stat-Signature: 3w41jyhjnq4nn98zonkckd3yztw3o4y6 X-HE-Tag: 1699818380-158726 X-HE-Meta: U2FsdGVkX1+ITZHL/L8yNynYm0EwIcF6BJxk2uy0+xx2kMeBQxUX8Ea/3nVa5bvCstm5T3lN15fET6fhjMZIE4y70tNg8tr8eaQW3g9Kff0BB0alZsvhYgp6lyVyNApkYkm7/fE9Fb7sOYXcvengFZl/HaXcZvwnvjBrDFAJPMaENAHu/wJr2MILkLgH7D7DJ8kPYvYUbjB6IUj0H1G3s1/rgp3zz3hWVoBXbNdgCxeeqW24NdJSM/w1Xswah01ez0BD9Vh/uPFpBVLALkUr19oe7lqYz1qY6gNtu09Nk60yU0cQoeIH7svd7V4YN6XKpjbwO9MBvKh2ikuKSCSXuuCTJn2ytOTTv7aBdRSGwTiYb9TewYrWcwLu6bkr2jIzrm0kbAoiyaHRJc/5G25PZKCcAFcLelmy9AUimrj2H2xr8pjW0Zt7+9Cv2uP3TQLqhxQ3h6XVU28zOBm3ThmqO0IL5jKfO07wlRb6e4wmpwsDnQgM5aXZ/9pfYWb8NTJfViRML4IQ6prK4KG55sEKVZQcI3tcuSG0v1f2RDl1EQUTT2oHYBp7gfYVorbKzNQmNyFcq3huvqyiJr82ZYcURmln3Ng0kF3hDZ/mgPFOMnszgn2EfWN6/jyDhvWsqOL3ZRdnfcmCBCwfInpSjSvG2T1e4f5fzreimBD9hKCV/2bcCPOJWZD1nWtJn/5JBEvoP8RUMi7JukuKuT0HRXGI0bI1idiUXO71KCrXo0rlE1zt1yxPlFpx+xKfNcK/qeuWwBVfeEEnSFHhiL2IqjTZVm09zGUGyJ3dVl2ldTjplLxnVeAtqOLlVCqBR7GYFANpI+zbCjWlxaFc8xdYvaEPrHI6l4PchU86zq70ME08EXvnpDHZ8XJ0dfNNbqEvH0vAl4k8XbCrUDcdZ1hcZWsut9UbLtRB2w/IwSOy5P6gHxGeGdhRrYYoPKz8QRYB9EnR7hRbqaKlqBEA+uGmqwD k+f5R8Dr 4QWkYVj2qE1zRcs5b3vlToiTuqZOrqSnoEQaQCbwk9bERVZWYYKGX8sO9rTruZGNHhWuLoiOKnEaFOl9c7K2uFRmPrnZ1vJSf35FpACDWs83NueeuTAWCtAY0jmfRFCGdmjYx6Nw9fj7j/ER1w4KEyhvypgXwYMWAlsXdf4nV2LVbS3Qzjvpsms/RDqHaiW+vITOXgkwBT6K4QvOUgauKa14AZ74BjJ0CmYxWIa80444qWRgSqTOXb2hEc00HTGmaso9O X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add DAMON selftests for testing creation/existence of quota goals directories and files, and simple valid input writes. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/sysfs.sh | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tools/testing/selftests/damon/sysfs.sh b/tools/testing/selftests/damon/sysfs.sh index 56f0230a8b92..e9a976d296e2 100755 --- a/tools/testing/selftests/damon/sysfs.sh +++ b/tools/testing/selftests/damon/sysfs.sh @@ -150,6 +150,32 @@ test_weights() ensure_file "$weights_dir/age_permil" "exist" "600" } +test_goal() +{ + goal_dir=$1 + ensure_dir "$goal_dir" "exist" + ensure_file "$goal_dir/target_value" "exist" "600" + ensure_file "$goal_dir/current_value" "exist" "600" +} + +test_goals() +{ + goals_dir=$1 + ensure_dir "$goals_dir" "exist" + ensure_file "$goals_dir/nr_goals" "exist" "600" + + ensure_write_succ "$goals_dir/nr_goals" "1" "valid input" + test_goal "$goals_dir/0" + + ensure_write_succ "$goals_dir/nr_goals" "2" "valid input" + test_goal "$goals_dir/0" + test_goal "$goals_dir/1" + + ensure_write_succ "$goals_dir/nr_goals" "0" "valid input" + ensure_dir "$goals_dir/0" "not_exist" + ensure_dir "$goals_dir/1" "not_exist" +} + test_quotas() { quotas_dir=$1 @@ -158,6 +184,7 @@ test_quotas() ensure_file "$quotas_dir/bytes" "exist" 600 ensure_file "$quotas_dir/reset_interval_ms" "exist" 600 test_weights "$quotas_dir/weights" + test_goals "$quotas_dir/goals" } test_access_pattern()