All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] selftests:intel_pstate: fixes typical crash of a testing script for Intel P-State driver [New and correct] [ignore previous mail]
@ 2018-05-03 16:58 Jeffrin Jose T
  0 siblings, 0 replies; only message in thread
From: Jeffrin Jose T @ 2018-05-03 16:58 UTC (permalink / raw)
  To: shuah, kstewart, daniel.diaz, pombredanne, gregkh, thomas
  Cc: linux-kselftest, linux-kernel, Jeffrin Jose T, Jeffrin Jose T

 Testing script for Intel P-State driver crashes during the run.
 this patch fixes that crash and produce typical results.

Signed-off-by: Jeffrin Jose T <jeffrin@rajagiritech.edu.in>

---
 tools/testing/selftests/intel_pstate/run.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/intel_pstate/run.sh b/tools/testing/selftests/intel_pstate/run.sh
index c670359becc6..1c2c87b02429 100755
--- a/tools/testing/selftests/intel_pstate/run.sh
+++ b/tools/testing/selftests/intel_pstate/run.sh
@@ -27,7 +27,7 @@
 # and the test will error out in those cases.  The result.X file can be checked
 # for consistency and modified to remove the extra MHz values.  The result.X
 # files can be re-evaluated by setting EVALUATE_ONLY to 1 below.
-
+#set -xv
 EVALUATE_ONLY=0
 
 if ! uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ | grep -q x86; then
@@ -101,10 +101,13 @@ cpupower frequency-set -g powersave --max=${max_freq}MHz >& /dev/null
 echo "Target      Actual      Difference     MSR(0x199)     max_perf_pct"
 for freq in `seq $max_freq -100 $min_freq`
 do
-	result_freq=$(cat /tmp/result.${freq} | grep "cpu MHz" | awk ' { print $4 } ' | awk -F "." ' { print $1 } ')
+        result_freq=$(cat /tmp/result.${freq} | grep "cpu MHz" \
+	| awk ' { print $4 } ' | awk -F "." ' { print $1 } ')
+	result_freq=$(echo $result_freq | head -n1 | cut -d " " -f1)
 	msr=$(cat /tmp/result.${freq} | grep "msr" | awk ' { print $3 } ')
 	max_perf_pct=$(cat /tmp/result.${freq} | grep "max_perf_pct" | awk ' { print $2 } ' )
-	if [ $result_freq -eq $freq ]; then
+	if (( "$result_freq" == "$freq" ))
+	   then
 		echo " $freq        $result_freq             0          $msr         $(($max_perf_pct*3300))"
 	else
 		echo " $freq        $result_freq          $(($result_freq-$freq))          $msr          $(($max_perf_pct*$max_freq))"
-- 
2.17.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-05-03 16:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-03 16:58 [PATCH] selftests:intel_pstate: fixes typical crash of a testing script for Intel P-State driver [New and correct] [ignore previous mail] Jeffrin Jose T

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.