LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jeffrin Jose T <ahiliation@yahoo.co.in>
To: shuah@kernel.org, kstewart@linuxfoundation.org,
	daniel.diaz@linaro.org, pombredanne@nexb.com,
	gregkh@linuxfoundation.org, thomas@m3y3r.de
Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jeffrin Jose T <ahiliation@yahoo.co.in>,
	Jeffrin Jose T <jeffrin@rajagiritech.edu.in>
Subject: [PATCH] selftests:intel_pstate: fixes typical crash of a testing script for Intel P-State driver
Date: Mon, 30 Apr 2018 00:42:26 +0530	[thread overview]
Message-ID: <20180429191226.14242-1-ahiliation@yahoo.co.in> (raw)

 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 | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/intel_pstate/run.sh b/tools/testing/selftests/intel_pstate/run.sh
index c670359becc6..cd32aca8806f 100755
--- a/tools/testing/selftests/intel_pstate/run.sh
+++ b/tools/testing/selftests/intel_pstate/run.sh
@@ -27,6 +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
 
@@ -101,12 +102,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

             reply	other threads:[~2018-04-29 19:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-29 19:12 Jeffrin Jose T [this message]
2018-05-04 19:47 ` Shuah Khan
2018-05-08 20:21   ` Shuah Khan
2018-05-09 14:27     ` Jeffrin Thalakkottoor

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=20180429191226.14242-1-ahiliation@yahoo.co.in \
    --to=ahiliation@yahoo.co.in \
    --cc=daniel.diaz@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jeffrin@rajagiritech.edu.in \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=pombredanne@nexb.com \
    --cc=shuah@kernel.org \
    --cc=thomas@m3y3r.de \
    --subject='Re: [PATCH] selftests:intel_pstate: fixes typical crash of a testing script for Intel P-State driver' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).