From: Shuah Khan <skhan@linuxfoundation.org>
To: Viresh Kumar <viresh.kumar@linaro.org>,
Swapnil Sapkal <swapnil.sapkal@amd.com>
Cc: rafael@kernel.org, shuah@kernel.org, gautham.shenoy@amd.com,
narasimhan.v@amd.com, linux-pm@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] selftests/cpufreq: Fix cpufreq basic read and update testcases
Date: Thu, 22 May 2025 09:17:26 -0600 [thread overview]
Message-ID: <2b7acb5f-65c7-4787-aac5-ebcec83c8ac0@linuxfoundation.org> (raw)
In-Reply-To: <20250519075854.opnlhjlbybrkvd2k@vireshk-i7>
On 5/19/25 01:58, Viresh Kumar wrote:
> On 30-04-25, 17:14, Swapnil Sapkal wrote:
>> In cpufreq basic selftests, one of the testcases is to read all cpufreq
>> sysfs files and print the values. This testcase assumes all the cpufreq
>> sysfs files have read permissions. However certain cpufreq sysfs files
>> (eg. stats/reset) are write only files and this testcase errors out
>> when it is not able to read the file.
>> Similarily, there is one more testcase which reads the cpufreq sysfs
>> file data and write it back to same file. This testcase also errors out
>> for sysfs files without read permission.
>> Fix these testcases by adding proper read permission checks.
Can you share how you ran the test?
>>
>> Reported-by: Narasimhan V <narasimhan.v@amd.com>
>> Signed-off-by: Swapnil Sapkal <swapnil.sapkal@amd.com>
>> ---
>> tools/testing/selftests/cpufreq/cpufreq.sh | 15 +++++++++++----
>> 1 file changed, 11 insertions(+), 4 deletions(-)
>>
>> diff --git a/tools/testing/selftests/cpufreq/cpufreq.sh b/tools/testing/selftests/cpufreq/cpufreq.sh
>> index e350c521b467..3484fa34e8d8 100755
>> --- a/tools/testing/selftests/cpufreq/cpufreq.sh
>> +++ b/tools/testing/selftests/cpufreq/cpufreq.sh
>> @@ -52,7 +52,14 @@ read_cpufreq_files_in_dir()
>> for file in $files; do
>> if [ -f $1/$file ]; then
>> printf "$file:"
>> - cat $1/$file
>> + #file is readable ?
>> + local rfile=$(ls -l $1/$file | awk '$1 ~ /^.*r.*/ { print $NF; }')
>> +
>> + if [ ! -z $rfile ]; then
>> + cat $1/$file
>> + else
>> + printf "$file is not readable\n"
>> + fi
>
> What about:
>
> if [ -r $1/$file ]; then
> cat $1/$file
> else
> printf "$file is not readable\n"
> fi
>
>
thanks,
-- Shuah
next prev parent reply other threads:[~2025-05-22 15:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-30 17:14 [PATCH] selftests/cpufreq: Fix cpufreq basic read and update testcases Swapnil Sapkal
2025-05-19 7:58 ` Viresh Kumar
2025-05-22 8:37 ` Sapkal, Swapnil
2025-05-22 9:45 ` Viresh Kumar
2025-05-26 8:52 ` Sapkal, Swapnil
2025-05-22 15:17 ` Shuah Khan [this message]
2025-05-26 8:46 ` Sapkal, Swapnil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2b7acb5f-65c7-4787-aac5-ebcec83c8ac0@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=gautham.shenoy@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=narasimhan.v@amd.com \
--cc=rafael@kernel.org \
--cc=shuah@kernel.org \
--cc=swapnil.sapkal@amd.com \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox