Skip to contentSkip to conversation

runpwtests03:skip read check for cpufreq/stats/reset file

PATCH New [email protected] 2 participants 3 messages Nov 20, 2017 – Nov 21, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 runpwtests03:skip read check for cpufreq/stats/reset file

From: Shuang Qiu <[email protected]>

According to the cpufreq-stats doc,cpufreq/stats/reset is write-only attribute of cpu freq sysfs file.
So skip the cat checking for this file.

---
 testcases/kernel/power_management/runpwtests03.sh |    1 +
 1 file changed, 1 insertion(+)
testcases/kernel/power_management/runpwtests03.sh +1 -0
index d4ea88b..00f6e02 100755
@@ -35,6 +35,7 @@ check_cpufreq_sysfs_files() {
 			-name "*" -type f)
 		for files in ${cpufiles}
 		do
+			[ "$files" = "/sys/devices/system/cpu/cpu${cpu}/cpufreq/stats/reset" ] && continue
 			cat ${files} >/dev/null 2>&1
 			if [ $? -ne 0 ] ; then
 				echo "${0}: FAIL: cat ${files}"
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 runpwtests03:skip read check for cpufreq/stats/reset file

Quoted 16 lines · On 11/20/2017 11:01 AM, [email protected] wrote:

From: Shuang Qiu <[email protected]>

According to the cpufreq-stats doc,cpufreq/stats/reset is write-only attribute of cpu freq sysfs file.
So skip the cat checking for this file.

---
 testcases/kernel/power_management/runpwtests03.sh |    1 +
 1 file changed, 1 insertion(+)
testcases/kernel/power_management/runpwtests03.sh +0 -0
index d4ea88b..00f6e02 100755

testcases/kernel/power_management/runpwtests03.sh check_cpufreq_sysfs_files() { · line 39

Quoted 5 lines
testcases/kernel/power_management/runpwtests03.sh +1 -0
@@ -35,6 +35,7 @@ check_cpufreq_sysfs_files() {
 			-name "*" -type f)
 		for files in ${cpufiles}
 		do
+			[ "$files" = "/sys/devices/system/cpu/cpu${cpu}/cpufreq/stats/reset" ] && continue
 			cat ${files} >/dev/null 2>&1

May be better update the above 'find' command to match only files that have read permission, e.g. add '-readable' option?

Thanks,
Alexey

author
#2 lore raw

PATCH 1/1 runpwtests03:skip read check for cpufreq/stats/reset file

Quoted 12 lines · Alexey Kodanev
Quoted 11 lines · On 11/20/2017 11:01 AM, [email protected] wrote:

From: Shuang Qiu <[email protected]>

According to the cpufreq-stats doc,cpufreq/stats/reset is write-only attribute of cpu freq sysfs file.
So skip the cat checking for this file.

---
  testcases/kernel/power_management/runpwtests03.sh |    1 +
  1 file changed, 1 insertion(+)
Quoted 12 lines

testcases/kernel/power_management/runpwtests03.sh check_cpufreq_sysfs_files() { · line 39

Quoted 10 lines
testcases/kernel/power_management/runpwtests03.sh +1 -0
index d4ea88b..00f6e02 100755
@@ -35,6 +35,7 @@ check_cpufreq_sysfs_files() {
  			-name "*" -type f)
  		for files in ${cpufiles}
  		do
+			[ "$files" = "/sys/devices/system/cpu/cpu${cpu}/cpufreq/stats/reset" ] && continue
  			cat ${files} >/dev/null 2>&1

May be better update the above 'find' command to match only files that have read permission, e.g. add '-readable' option?

Thanks Alexey.

That is a better solution.
-readable option takes into account access control lists and other permissions artefacts which the -perm test ignores,may not work here. -perm /400 option should work.
I will send another patch.

Thanks
Shuang

Quoted 4 lines

Thanks,
Alexey