Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp27367rdb; Wed, 29 Nov 2023 18:38:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3nc052bcxrWxTs5MT5RnWnkVmr/xUlpaPkXlSmFaj4BVuX4mMuKHTNwT1C5qG5PUfiWeg X-Received: by 2002:a17:90b:380b:b0:285:da91:69d6 with SMTP id mq11-20020a17090b380b00b00285da9169d6mr11879770pjb.36.1701311915075; Wed, 29 Nov 2023 18:38:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701311915; cv=none; d=google.com; s=arc-20160816; b=egGpFtgWETH3Fg6j9On4QKHPVad14xZPxJt4apnSCDvbnb490YqNKmMovNdGGsbKit UsIqL5TOlCzK03k1qq+65CjP1fsahsmc+us4tfNvRYg9SBCW9oKDgz9NmagiRSLzBIKd +kxy1No3uQ6Lja67ZTWXZx5eXXBxADtmsSLhgrqCtBDJreVa4kxkT/qsl1GiF1WvKXuI tKB+3LbK+2zOc2zJZoCDcBDNpENHf5/YgAExUYUdr1z0+bTyG/dtDeZcm8hB/x+iH7xg HQ92gp4u5DPMdPrnyTtcgl/5UJCVPZrRpSx6/vU9KdrXp6qE45QBWRMEJD9+9S6j3Pk8 //1Q== 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 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id m6-20020a170902db8600b001d00ac1edd1si117910pld.651.2023.11.29.18.38.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 18:38:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; 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 23.128.96.38 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 99466803B71C; Wed, 29 Nov 2023 18:38:29 -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 Content-Transfer-Encoding: 8bit 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:29 -0800 (PST) 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() -- 2.34.1