Skip to content
Snippets Groups Projects
Commit 13d27c50 authored by Laura Nao's avatar Laura Nao
Browse files

Merge branch 'wip/battery-ac-status' into 'master'

battery: add AC test, move battery status test

See merge request !8
parents 74eee64d b1dc1882
No related branches found
No related tags found
1 merge request!8battery: add AC test, move battery status test
...@@ -24,6 +24,18 @@ else ...@@ -24,6 +24,18 @@ else
test-exception "No battery detected; job exit" test-exception "No battery detected; job exit"
fi fi
if ac=$(grep -l Mains /sys/class/power_supply/*/type); then
test-result ac-present --result pass
if [ $(cat $(dirname $ac)/online) -eq 1 ]; then
test-result ac-online --result pass
else
test-result ac-online --result fail
fi
else
echo "Could not find any info about AC; check kernel configuration."
test-result ac-present --result skip
fi
for battery in $batteries; do for battery in $batteries; do
dir=$(basename $(dirname $battery)) dir=$(basename $(dirname $battery))
...@@ -33,6 +45,14 @@ for battery in $batteries; do ...@@ -33,6 +45,14 @@ for battery in $batteries; do
continue continue
fi fi
# report battery status
if status=$(cat $(dirname $battery)/status); then
echo "$dir status: $status"
test-result $dir-status --result pass
else
test-result $dir-status --result fail
fi
# test battery capacity # test battery capacity
if cap=$(cat $(dirname $battery)/capacity); then if cap=$(cat $(dirname $battery)/capacity); then
if [ "$cap" -gt "$threshold" ]; then if [ "$cap" -gt "$threshold" ]; then
...@@ -43,12 +63,4 @@ for battery in $batteries; do ...@@ -43,12 +63,4 @@ for battery in $batteries; do
else else
test-result $dir-capacity --result fail test-result $dir-capacity --result fail
fi fi
# report battery status
if status=$(cat $(dirname $battery)/status); then
echo "$dir status: $status"
test-result $dir-status --result pass
else
test-result $dir-status --result fail
fi
done done
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment