From: Po-Hsu Lin <po-hsu.lin@canonical.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] runpwtests03: use expr to calculate total_cpus for runpwtests03
Date: Tue, 25 Jun 2019 18:03:51 +0800 [thread overview]
Message-ID: <20190625100351.19800-1-po-hsu.lin@canonical.com> (raw)
The arithmetic operation (( total_cpus-=1 )) does not work for dash,
which was symbolic linked to /bin/sh on some OS like Ubuntu.
In such case, people will see error like:
runpwtests03.sh: total_cpus-=1: not found
And this further leads to access for a non-existing file and cause
false-positive result in the end:
runpwtests03.sh: cannot create
/sys/devices/system/cpu/cpu8/cpufreq/scaling_governor: Directory nonexistent
runpwtests03.sh: FAIL: Unable to set governor -- powersave for cpu8
Power_Management03 2 TFAIL: Changing governors
Use expr instead for fix this issue.
Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
---
testcases/kernel/power_management/runpwtests03.sh | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/testcases/kernel/power_management/runpwtests03.sh b/testcases/kernel/power_management/runpwtests03.sh
index 11197937f..3fb85d273 100755
--- a/testcases/kernel/power_management/runpwtests03.sh
+++ b/testcases/kernel/power_management/runpwtests03.sh
@@ -25,8 +25,7 @@ export TST_TOTAL=4
. pm_include.sh
check_cpufreq_sysfs_files() {
- total_cpus=$(tst_ncpus)
- (( total_cpus-=1 ))
+ total_cpus=`expr $(tst_ncpus) - 1`
RC=0
for cpu in $(seq 0 "${total_cpus}" )
@@ -51,8 +50,7 @@ check_cpufreq_sysfs_files() {
change_govr() {
available_govr=$(get_supporting_govr)
- total_cpus=$(tst_ncpus)
- (( total_cpus-=1 ))
+ total_cpus=`expr $(tst_ncpus) - 1`
RC=0
for cpu in $(seq 0 "${total_cpus}" )
@@ -79,8 +77,7 @@ change_freq() {
available_govr=$(get_supporting_govr)
RC=0
- total_cpus=$(tst_ncpus)
- (( total_cpus-=1 ))
+ total_cpus=`expr $(tst_ncpus) - 1`
if ( echo ${available_govr} | grep -i "userspace" \
>/dev/null 2>&1 ); then
--
2.17.1
next reply other threads:[~2019-06-25 10:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-25 10:03 Po-Hsu Lin [this message]
2019-06-25 10:59 ` [LTP] [PATCH] runpwtests03: use expr to calculate total_cpus for runpwtests03 Xiao Yang
2019-06-25 16:13 ` Po-Hsu Lin
2019-06-26 2:54 ` Xiao Yang
2019-06-26 3:45 ` Po-Hsu Lin
2019-06-27 8:04 ` Xiao Yang
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=20190625100351.19800-1-po-hsu.lin@canonical.com \
--to=po-hsu.lin@canonical.com \
--cc=ltp@lists.linux.it \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.