Prevent a syntax error when running the test which leads to an exception in the script and exiting wildely the loop.
The cpuburn stays running in background.
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org --- include/functions.sh | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/include/functions.sh b/include/functions.sh index 2cc44b3..f003414 100644 --- a/include/functions.sh +++ b/include/functions.sh @@ -109,8 +109,18 @@ get_governor() { wait_latency() { local cpu=$1 local dirpath=$CPU_PATH/$cpu/cpufreq - local latency=$(cat $dirpath/cpuinfo_transition_latency) - local nrfreq=$(cat $dirpath/scaling_available_frequencies | wc -w) + local latency= + local nrfreq= + + latency=$(cat $dirpath/cpuinfo_transition_latency) + if [ $? != 0 ]; then + return $? + fi + + nrfreq=$(cat $dirpath/scaling_available_frequencies | wc -w) + if [ $? != 0 ]; then + return $? + fi
nrfreq=$((nrfreq + 1)) ../utils/nanosleep $(($nrfreq * $latency))
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org --- cpufreq/Makefile | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/cpufreq/Makefile b/cpufreq/Makefile index 9c9133e..e9050e4 100644 --- a/cpufreq/Makefile +++ b/cpufreq/Makefile @@ -28,7 +28,8 @@ LOG=$(TST:.sh=.log) check: uncheck $(LOG)
%.log: %.sh - @echo -e "###\n### $(<:.sh=):" + @echo "###" + @echo "### $(<:.sh=):" @echo -n "### "; cat $(<:.sh=.txt); echo "###" @./$< 2> $@