From patchwork Thu Nov 30 02:36:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 171698 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp113815vqy; Wed, 29 Nov 2023 18:38:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IERgCxRWxBVG555CRuHBpPhNaVI8PYdzOzXkvkh/CA5DW2inrnXFNPe7SJ5BBm9Wm/Xn/IV X-Received: by 2002:a9d:6356:0:b0:6d8:4c77:795 with SMTP id y22-20020a9d6356000000b006d84c770795mr4938886otk.20.1701311905278; Wed, 29 Nov 2023 18:38:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701311905; cv=none; d=google.com; s=arc-20160816; b=t1Gpk8RQRVFR6tm6l4Bpv0GDMgNUZaj1qBudTkJ2jqsJfcPhr/ItlSqWvB5wHTxEHL mOOnn+Q47lmTi2/VKVjOmEENyeS5KLNGMCQIuPVnlwovnOnLSzaVVvAyhFZDcOlRUpmD TDkKuJ9g7uc5w5p0SLUzElzTv3lXx8lM/21u241jkJbyJp7EgNnjld9gJnDroUj4N1Ch Sf4PReeuUp8yhoCfniTgFDWbe1NA743CZpj17tBDoDMAjccOLq5HPlVpQH/78/QTICQ8 go5yMpU+uoX48T5Cji8pEhlq4NQeuMebVBUDSKvqWQEtSuge5T3SFl9YOV3S0++ZMTNP ETFQ== 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=smsCDfkqa8LsuAqRj5y7TvHYHkhdv6jMiB4jYS248x8=; fh=9H4z7/o7y4OLn0xLmjdSk9Pth53+ED/R+iGnGlnIr7g=; b=UJVwuzGP0zRFTbdOdMPxlHGmqxLrMF80RnCJF7C20e/DySJkJlrZJp+Sh9UvmVvhtc 3YJL00UBLubsxVKVO3p53kb5WrdXUi/12OC927h/a+3tIrpuImyMgPJ1pBG4ZLCNSpwG p7i3ExDi/v+H9tQpW4wkXv3j25qBAq8aJGK5XLP0IvfE89DXMCKpZzPi8bTS7nNo19dd 6Q17qZfq7f+8xhSrD1JTwXcw4sLpTiGv28txFZxfLW0JgYC4IxTkwZ591u3ToQLcGm6w GZyUNgvMoBTOiac5Mc/RneNqTwEdaGFpxnrqXxNXbH9npqLKrtTI7NbvR5bryRYbRDOq xkSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mF2NM7qE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id y64-20020a636443000000b005b909e93e2dsi250127pgb.522.2023.11.29.18.38.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 18:38:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mF2NM7qE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 66F56803B71E; Wed, 29 Nov 2023 18:38:20 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344173AbjK3CiJ (ORCPT + 99 others); Wed, 29 Nov 2023 21:38:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234985AbjK3Ch7 (ORCPT ); Wed, 29 Nov 2023 21:37:59 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C42E1171D for ; Wed, 29 Nov 2023 18:37:34 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E14DAC433C9; Thu, 30 Nov 2023 02:37:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701311823; bh=tm53i8GhYDRGpRCnZgtLIn7P8jIf3OMjFqv6O/swkJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mF2NM7qEDR2eJeiTCxOHD0A+5NunTLYKc63iE0l9/ywqjnaj6xo8D0yGnT6Gmvw/A xD91IpuQUYOBVVCxDiJe4H16CJesJnVJ21lgmggfbUD5S3QxJiJkLZszoLmYDHMXxz PEj1zqFucaACRUuOXA3oPuDzdJy8kYEUBSv5OE8pBMbxrZHe2uJjsTidqJEOFmS8eR 0AGIKl4PgJVr/z5eQ3zv6EABddpoQCRpnRrDVKwL/lnsjlaZ0+Ma9teMxzaf/ccZz7 fo0/hMTsCfM4rXGNO0cNf6rXSkHmTF7AkE30ORjDwm4TF23bo0hVD688vrMHNQ/Vku s9Kd4TI4Fn6xQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/9] selftests/damon: test quota goals directory Date: Thu, 30 Nov 2023 02:36:49 +0000 Message-Id: <20231130023652.50284-7-sj@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231130023652.50284-1-sj@kernel.org> References: <20231130023652.50284-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 29 Nov 2023 18:38:20 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783954832361337442 X-GMAIL-MSGID: 1783954832361337442 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()