Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions test-case/check-suspend-resume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ set -e
## check kernel log and find no errors
##

source $(dirname ${BASH_SOURCE[0]})/../case-lib/lib.sh
# shellcheck source=case-lib/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")"/../case-lib/lib.sh

random_min=3 # wait time should >= 3 for other device wakeup from sleep
random_max=20
Expand All @@ -46,9 +47,12 @@ type=${OPT_VAL['T']}
# switch type
if [ "$type" ]; then
# check for type value effect
[[ ! "$(cat /sys/power/mem_sleep|grep $type)" ]] && dloge "useless type option" && exit 2
dlogc "sudo bash -c 'echo $type > /sys/power/mem_sleep'"
sudo bash -c "'echo $type > /sys/power/mem_sleep'"
grep -q "$type" /sys/power/mem_sleep || {
grep -H '^' /sys/power/mem_sleep
die "Unsupported sleep type argument: $type"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two changes on the same thing? Feels odd but okay...

Copy link
Collaborator Author

@marc-hb marc-hb May 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first commit here is a no-change cleanup that will stay. The second one switches the SKIP to a FAIL, it could be reverted if it is found to break "backwards compatibility" somewhere.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the following line do here?
grep -H '^' /sys/power/mem_sleep

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just a very fancy cat; try it on any file and you will see every line is prefixed by the file name.

}
dlogc "echo $type > /sys/power/mem_sleep"
echo "$type" | >/dev/null sudo tee -a /sys/power/mem_sleep
fi
dlogi "Current suspend/resume type mode: $(cat /sys/power/mem_sleep)"

Expand Down Expand Up @@ -82,8 +86,8 @@ do
setup_kernel_check_point
sleep_count=$(cat /sys/power/wakeup_count)
dlogc "Run the command: rtcwake -m mem -s ${sleep_lst[$i]}"
sudo rtcwake -m mem -s ${sleep_lst[$i]}
[[ $? -ne 0 ]] && die "rtcwake return value error"
sudo rtcwake -m mem -s "${sleep_lst[$i]}" ||
die "rtcwake returned $?"
dlogc "sleep for ${wait_lst[$i]}"
sleep ${wait_lst[$i]}
dlogi "Check for the kernel log status"
Expand Down