[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e667198e-6940-4702-ac9c-7745f07dbf38@amd.com>
Date: Mon, 26 May 2025 14:16:13 +0530
From: "Sapkal, Swapnil" <swapnil.sapkal@....com>
To: Shuah Khan <skhan@...uxfoundation.org>, Viresh Kumar
<viresh.kumar@...aro.org>
CC: <rafael@...nel.org>, <shuah@...nel.org>, <gautham.shenoy@....com>,
<narasimhan.v@....com>, <linux-pm@...r.kernel.org>,
<linux-kselftest@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] selftests/cpufreq: Fix cpufreq basic read and update
testcases
Hi Shuah,
On 5/22/2025 8:47 PM, Shuah Khan wrote:
> 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?
>
I ran the basic tests with the following command:
./main.sh -t basic
>>>
>>> Reported-by: Narasimhan V <narasimhan.v@....com>
>>> Signed-off-by: Swapnil Sapkal <swapnil.sapkal@....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
--
Thanks and Regards,
Swapnil
Powered by blists - more mailing lists