diff options
Diffstat (limited to 'suspend')
-rwxr-xr-x | suspend/suspend_01.sh | 22 | ||||
-rwxr-xr-x | suspend/suspend_02.sh | 15 | ||||
-rwxr-xr-x | suspend/suspend_03.sh | 34 | ||||
-rw-r--r-- | suspend/suspend_03.txt | 2 | ||||
-rwxr-xr-x | suspend/suspend_04.sh | 77 | ||||
-rw-r--r-- | suspend/suspend_04.txt | 2 | ||||
-rwxr-xr-x | suspend/suspend_05.sh | 73 | ||||
-rw-r--r-- | suspend/suspend_05.txt | 2 | ||||
-rwxr-xr-x | suspend/suspend_06.sh | 56 | ||||
-rw-r--r-- | suspend/suspend_06.txt | 1 |
10 files changed, 126 insertions, 158 deletions
diff --git a/suspend/suspend_01.sh b/suspend/suspend_01.sh index 2b79c67..0149c70 100755 --- a/suspend/suspend_01.sh +++ b/suspend/suspend_01.sh @@ -27,23 +27,23 @@ source ../include/functions.sh -source ../include/suspend.sh +source ../include/suspend_functions.sh # test_dbus: switch on/off this test -test_dbus=1 -auto=1 +test_dbus=0 -if [ "$test_dbus" -eq 1 -a \ - \( "$SUDO_USER" = "" -o "$SUDO_USER" = "root" \) ]; then - ECHO "*** no primary user (via sudo) dbus tests skipped ..." -elif [ "$test_dbus" -eq 1 ]; then - ac_required 1 - suspend_dbus=1 +if [ "$test_dbus" -eq 0 ]; then + log_skip "dbus message suspend test not enabled" + exit 0 +fi + +if [ -x /usr/bin/dbus-send ]; then phase - check "suspend via dbus message" suspend_system + check "suspend by dbus message" suspend_system "dbus" if [ $? -eq 0 ]; then rm -f "$LOGFILE" fi - suspend_dbus=0 +else + log_skip "dbus-send command not exist" fi diff --git a/suspend/suspend_02.sh b/suspend/suspend_02.sh index 591e0cb..cb15801 100755 --- a/suspend/suspend_02.sh +++ b/suspend/suspend_02.sh @@ -27,18 +27,23 @@ source ../include/functions.sh -source ../include/suspend.sh +source ../include/suspend_functions.sh # test_pmsuspend: switch on/off this test test_pmsuspend=1 -auto=1 -if [ "$test_pmsuspend" -eq 1 ]; then - ac_required 1 +if [ "$test_pmsuspend" -eq 0 ]; then + log_skip "pm-suspend test not enabled" + exit 0 +fi + +if [ -x /usr/sbin/pm-suspend ]; then phase - check "suspend via pm-suspend" suspend_system + check "suspend via pm-suspend" suspend_system "pmsuspend" if [ $? -eq 0 ]; then rm -f "$LOGFILE" fi +else + log_skip "pm-suspend command not exist" fi diff --git a/suspend/suspend_03.sh b/suspend/suspend_03.sh index 0c40451..a782061 100755 --- a/suspend/suspend_03.sh +++ b/suspend/suspend_03.sh @@ -27,34 +27,24 @@ source ../include/functions.sh -source ../include/suspend.sh +source ../include/suspend_functions.sh -# test_ac: switch on/off this test -test_ac=0 -auto=1 +# test_mem: switch on/off this test +test_mem=0 -if [ "$test_ac" -eq 1 -a "$battery_count" -eq 0 ]; then - ECHO "*** no BATTERY detected ac tests skipped ..." -elif [ "$test_ac" -eq 1 ]; then - ac_required 0 - phase - check "suspend with AC disconnected" suspend_system - - ac_required 1 - phase - check "suspend with AC connected" suspend_system - - ac_transitions 1 0 - echo "*** please remove the AC cord while the machine is suspended" - phase - check "loss of AC while suspended" suspend_system +if [ "$test_mem" -eq 0 ]; then + log_skip "suspend to ram via sysfs not enabled" + exit 0 +fi - ac_transitions 0 1 - echo "*** please insert the AC cord while the machine is suspended" +supported=$(cat /sys/power/state | grep "mem") +if [ -n "$supported" ]; then phase - check "return of AC while suspended" suspend_system + check "suspend to ram via sysfs" suspend_system "mem" if [ $? -eq 0 ]; then rm -f "$LOGFILE" fi +else + log_skip "suspend to ram via sysfs not supported" fi diff --git a/suspend/suspend_03.txt b/suspend/suspend_03.txt index d9b682f..48daa6a 100644 --- a/suspend/suspend_03.txt +++ b/suspend/suspend_03.txt @@ -1 +1 @@ -perform tests involving removing ac power +perform a suspend to ram test via sysfs diff --git a/suspend/suspend_04.sh b/suspend/suspend_04.sh index 13c639a..ed8a580 100755 --- a/suspend/suspend_04.sh +++ b/suspend/suspend_04.sh @@ -27,57 +27,48 @@ source ../include/functions.sh -source ../include/suspend.sh +source ../include/suspend_functions.sh -# test_power: switch on/off this test -test_power=0 -auto=1 -args_power_sleep=60 +# test_ac: switch on/off this test +test_ac=0 -if [ "$test_power" -eq 1 -a "$battery_count" -eq 0 ]; then - ECHO "*** no BATTERY detected power test skipped ..." -elif [ "$test_power" -eq 1 ]; then - save_timer_sleep="$timer_sleep" - let timer_sleep="$args_power_sleep" +if [ "$test_ac" -eq 0 ]; then + log_skip "suspend test involving ac power remove" + exit 0 +fi + +if [ ! -d /proc/acpi/battery/ ]; then + log_skip "acpi interface is not there" + exit 0 +fi +battery_count=`battery_count` +if [ "$battery_count" -eq 0 ]; then + log_skip "no BATTERY detected for ac tests" +else ac_required 0 phase + sleep 2 + check "suspend with AC disconnected" suspend_system "mem" - # get start values - date_before=`date +%s` - bat_before=`battery_capacity` - - # Suspend - check "battery drain during suspend" suspend_system - if [ $? -eq 0 ]; then - rm -f "$LOGFILE" - fi - - # get end values - date_after=`date +%s` - bat_after=`battery_capacity` - - # do the calculations - let consumed="$bat_before - $bat_after" - let elapsed="$date_after - $date_before" - let usage="($consumed * 60*60) / $elapsed" + ac_required 1 + phase + sleep 2 + check "suspend with AC connected" suspend_system "mem" - # output the results - ECHO "before: $bat_before mWh" - ECHO "after: $bat_after mWh" - ECHO "consumed: $consumed mW" - ECHO "sleep seconds: $elapsed sec" - ECHO "overall usage: $usage mW" - - report_battery="$usage mW" + ac_transitions 1 0 + echo "*** please remove the AC cord while the machine is suspended" + phase + sleep 2 + check "loss of AC while suspended" suspend_system "mem" - if [ $elapsed -lt 600 ] - then - ECHO "WARNING: the suspend was less than 10 minutes" - ECHO " to get reliable numbers increase the sleep time" - report_battery="$report_battery (unreliable)" + ac_transitions 0 1 + echo "*** please insert the AC cord while the machine is suspended" + phase + sleep 2 + check "return of AC while suspended" suspend_system "mem" + if [ $? -eq 0 ]; then + rm -f "$LOGFILE" fi - - timer_sleep="$save_timer_sleep" fi diff --git a/suspend/suspend_04.txt b/suspend/suspend_04.txt index 1ade451..d9b682f 100644 --- a/suspend/suspend_04.txt +++ b/suspend/suspend_04.txt @@ -1 +1 @@ -perform a battery consumption test +perform tests involving removing ac power diff --git a/suspend/suspend_05.sh b/suspend/suspend_05.sh index 661adf4..767eec1 100755 --- a/suspend/suspend_05.sh +++ b/suspend/suspend_05.sh @@ -27,28 +27,67 @@ source ../include/functions.sh -source ../include/suspend.sh +source ../include/suspend_functions.sh -# test_timed: switch on/off this test -test_timed=1 -auto=1 +# test_power: switch on/off this test +test_power=0 +args_power_sleep=60 -if [ "$test_timed" -eq 1 ]; then - save_timer_delay="$timer_delay" - timer_delay=20 - sus_number=0 +if [ "$test_power" -eq 0 ]; then + log_skip "battery consumption test while suspend" + exit 0 +fi + +if [ ! -d /proc/acpi/battery/ ]; then + log_skip "acpi interface is not there" + exit 0 +fi + +battery_count=`battery_count` +if [ "$battery_count" -eq 0 ]; then + log_skip "no BATTERY detected for power test" +else + save_timer_sleep="$timer_sleep" + let timer_sleep="$args_power_sleep" - ac_required 1 + ac_required 0 phase - while [ "$timer_delay" -gt 0 ]; do - check "iteration variable delay suspend/resume" suspend_system - delay_system - let timer_delay="$timer_delay - 5" - let sus_number="sus_number + 1" - done - if [ $? -eq 0 ]; then + + # get start values + date_before=`date +%s` + bat_before=`battery_capacity` + + # Suspend + check "battery drain during suspend" suspend_system "mem" + if [ $? -eq 0 ]; then rm -f "$LOGFILE" fi - timer_delay="$save_timer_delay" + + # get end values + date_after=`date +%s` + bat_after=`battery_capacity` + + # do the calculations + let consumed="$bat_before - $bat_after" + let elapsed="$date_after - $date_before" + let usage="($consumed * 60*60) / $elapsed" + + # output the results + ECHO "before: $bat_before mWh" + ECHO "after: $bat_after mWh" + ECHO "consumed: $consumed mW" + ECHO "sleep seconds: $elapsed sec" + ECHO "overall usage: $usage mW" + + report_battery="$usage mW" + + if [ $elapsed -lt 600 ] + then + ECHO "WARNING: the suspend was less than 10 minutes" + ECHO " to get reliable numbers increase the sleep time" + report_battery="$report_battery (unreliable)" + fi + + timer_sleep="$save_timer_sleep" fi diff --git a/suspend/suspend_05.txt b/suspend/suspend_05.txt index 4735d94..1ade451 100644 --- a/suspend/suspend_05.txt +++ b/suspend/suspend_05.txt @@ -1 +1 @@ -perform a variable delay suspend/resume test +perform a battery consumption test diff --git a/suspend/suspend_06.sh b/suspend/suspend_06.sh deleted file mode 100755 index 59cc7ec..0000000 --- a/suspend/suspend_06.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -# -# PM-QA validation test suite for the power management on Linux -# -# Copyright (C) 2012, Linaro Limited. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# Contributors: -# Hongbo ZHANG <hongbo.zhang@linaro.org> (ST-Ericsson Corporation) -# - initial API and implementation -# - -# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#suspend_06 - - -source ../include/functions.sh -source ../include/suspend.sh - -# test_repeat: switch on/off this test -test_repeat=1 -auto=1 -args_repeat_iterations=5 - -if [ "$test_repeat" -eq 1 ]; then - ac_required 1 - - CNT=1 - TOTAL=$args_repeat_iterations - - phase - while [ "$CNT" -le "$TOTAL" ] - do - ECHO "Suspend iteration $CNT of $TOTAL" - check "iteration suspend/resume stress test" suspend_system - delay_system - - (( CNT++ )) - done - if [ $? -eq 0 ]; then - rm -f "$LOGFILE" - fi -fi - diff --git a/suspend/suspend_06.txt b/suspend/suspend_06.txt deleted file mode 100644 index 6511c23..0000000 --- a/suspend/suspend_06.txt +++ /dev/null @@ -1 +0,0 @@ -perform a longer repeat suspend/resume test |