fix error in script
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>
diff --git a/include/functions.sh b/include/functions.sh
index 2cc44b3..f2b6577 100644
--- a/include/functions.sh
+++ b/include/functions.sh
@@ -109,8 +109,18 @@
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 -1
+ fi
+
+ nrfreq=$(cat $dirpath/scaling_available_frequencies | wc -w)
+ if [ $? != 0 ]; then
+ return -1
+ fi
nrfreq=$((nrfreq + 1))
../utils/nanosleep $(($nrfreq * $latency))