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))