Currently, the suspend test module is disabled by default, but
make the suspend scripts more POSIX-compliant to be consistent
with other scripts.

Signed-off-by: Lisa Nguyen <lisa.ngu...@linaro.org>
---
 include/suspend_functions.sh |   20 +++++++++-----------
 suspend/suspend_01.sh        |    9 ++++-----
 suspend/suspend_02.sh        |    9 ++++-----
 suspend/suspend_03.sh        |    9 ++++-----
 suspend/suspend_04.sh        |   11 +++++------
 suspend/suspend_05.sh        |   11 +++++------
 suspend/suspend_sanity.sh    |    4 ++--
 7 files changed, 33 insertions(+), 40 deletions(-)

diff --git a/include/suspend_functions.sh b/include/suspend_functions.sh
index d5c8e2b..d59d4df 100644
--- a/include/suspend_functions.sh
+++ b/include/suspend_functions.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Script to automate suspend / resume
 #
@@ -33,7 +33,7 @@
 #  - hongbo.zh...@linaro.org, March, 2012
 #
 
-source ./functions.sh
+. ../include/functions.sh
 
 LOGDIR='/var/lib/pm-utils'
 LOGFILE="$LOGDIR/stress.log"
@@ -115,7 +115,7 @@ suspend_system ()
        retry=30
 
        while [ "$retry" -gt 0 ]; do
-               let "retry=$retry-1"
+               retry=$((retry - 1))
 
                # Accumulate the dmesg delta.
                dmesg >"$LOGFILE.dmesg.B"
@@ -237,7 +237,7 @@ ac_online()
 
 ac_check()
 {
-       typeset ac_current=`ac_online`
+       ac_current=`ac_online`
 
        if [ "$ac_becomes" -ne -1 -a "$ac_current" -ne -1 -a \
                        "$ac_current" -ne "$ac_becomes" ]; then
@@ -254,9 +254,7 @@ phase_interactive=1
 
 phase()
 {
-       typeset sleep
-
-       let phase="$phase+1"
+       phase=$((phase + 1))
 
        if [ "$ac_needed" -ne "$ac_is" ]; then
                case "$ac_needed" in
@@ -267,12 +265,12 @@ phase()
        fi
        
        if [ "$timer_sleep" -gt 60 ]; then
-               let sleep="$timer_sleep / 60"
-               sleep="$sleep minutes"
+               sleep_calculated="$timer_sleep / 60"
+               sleep_calculated="$sleep_calculated minutes"
        else
-               sleep="$timer_sleep seconds"
+               sleep_calculated="$timer_sleep seconds"
        fi
-       echo "*** machine will suspend for $sleep"
+       echo "*** machine will suspend for $sleep_calculated"
 
        if [ "$auto" -eq 1 ]; then
                :
diff --git a/suspend/suspend_01.sh b/suspend/suspend_01.sh
index 6ba8d41..8668d02 100755
--- a/suspend/suspend_01.sh
+++ b/suspend/suspend_01.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # PM-QA validation test suite for the power management on Linux
 #
@@ -22,16 +22,15 @@
 #     Hongbo ZHANG <hongbo.zh...@linaro.org> (ST-Ericsson Corporation)
 #       - initial API and implementation
 #
-
 # URL : 
https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/PmQaSpecification#suspend_01
 
 
-source ../include/functions.sh
-source ../include/suspend_functions.sh
+. ../include/functions.sh
+. ../include/suspend_functions.sh
 
 if [ "$suspend_dbus" -eq 0 ]; then
        log_skip "dbus message suspend test not enabled"
-       exit 0
+       return 0
 fi
 
 if [ -x /usr/bin/dbus-send ]; then
diff --git a/suspend/suspend_02.sh b/suspend/suspend_02.sh
index 666b6a5..ad6b3cb 100755
--- a/suspend/suspend_02.sh
+++ b/suspend/suspend_02.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # PM-QA validation test suite for the power management on Linux
 #
@@ -26,12 +26,12 @@
 # URL : 
https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/PmQaSpecification#suspend_02
 
 
-source ../include/functions.sh
-source ../include/suspend_functions.sh
+. ../include/functions.sh
+. ../include/suspend_functions.sh
 
 if [ "$suspend_pmsuspend" -eq 0 ]; then
        log_skip "pm-suspend test not enabled"
-       exit 0
+       return 0
 fi
 
 if [ -x /usr/sbin/pm-suspend ]; then
@@ -47,4 +47,3 @@ fi
 restore_trace
 test_status_show
 rm -f "$LOGFILE"
-
diff --git a/suspend/suspend_03.sh b/suspend/suspend_03.sh
index 474d3f5..90f54cf 100755
--- a/suspend/suspend_03.sh
+++ b/suspend/suspend_03.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # PM-QA validation test suite for the power management on Linux
 #
@@ -22,16 +22,15 @@
 #     Hongbo ZHANG <hongbo.zh...@linaro.org> (ST-Ericsson Corporation)
 #       - initial API and implementation
 #
-
 # URL : 
https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/PmQaSpecification#suspend_03
 
 
-source ../include/functions.sh
-source ../include/suspend_functions.sh
+. ../include/functions.sh
+. ../include/suspend_functions.sh
 
 if [ "$suspend_mem" -eq 0 ]; then
        log_skip "suspend to ram via sysfs not enabled"
-       exit 0
+       return 0
 fi
 
 supported=$(cat /sys/power/state | grep "mem")
diff --git a/suspend/suspend_04.sh b/suspend/suspend_04.sh
index 1f62cab..e2e0ff4 100755
--- a/suspend/suspend_04.sh
+++ b/suspend/suspend_04.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # PM-QA validation test suite for the power management on Linux
 #
@@ -22,21 +22,20 @@
 #     Hongbo ZHANG <hongbo.zh...@linaro.org> (ST-Ericsson Corporation)
 #       - initial API and implementation
 #
-
 # URL : 
https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/PmQaSpecification#suspend_04
 
 
-source ../include/functions.sh
-source ../include/suspend_functions.sh
+. ../include/functions.sh
+. ../include/suspend_functions.sh
 
 if [ "$suspend_ac" -eq 0 ]; then
        log_skip "suspend test involving ac power remove"
-       exit 0
+       return 0
 fi
 
 if [ ! -d /proc/acpi/battery/ ]; then
        log_skip "acpi interface is not there"
-       exit 0
+       return 0
 fi
 
 battery_count=`battery_count`
diff --git a/suspend/suspend_05.sh b/suspend/suspend_05.sh
index 9d5793e..98067cc 100755
--- a/suspend/suspend_05.sh
+++ b/suspend/suspend_05.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # PM-QA validation test suite for the power management on Linux
 #
@@ -22,23 +22,22 @@
 #     Hongbo ZHANG <hongbo.zh...@linaro.org> (ST-Ericsson Corporation)
 #       - initial API and implementation
 #
-
 # URL : 
https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/PmQaSpecification#suspend_05
 
 
-source ../include/functions.sh
-source ../include/suspend_functions.sh
+. ../include/functions.sh
+. ../include/suspend_functions.sh
 
 args_power_sleep=60
 
 if [ "$suspend_power" -eq 0 ]; then
        log_skip "battery consumption test while suspend"
-       exit 0
+       return 0
 fi
 
 if [ ! -d /proc/acpi/battery/ ]; then
        log_skip "acpi interface is not there"
-       exit 0
+       return 0
 fi
 
 battery_count=`battery_count`
diff --git a/suspend/suspend_sanity.sh b/suspend/suspend_sanity.sh
index 0f2b5d5..f37eccb 100755
--- a/suspend/suspend_sanity.sh
+++ b/suspend/suspend_sanity.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # PM-QA validation test suite for the power management on Linux
 #
@@ -23,7 +23,7 @@
 #       - initial API and implementation
 #
 
-source ../include/functions.sh
+. ../include/functions.sh
 
 is_root
 if [ $? -ne 0 ]; then
-- 
1.7.9.5


_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to