#!/bin/sh
set -euC

# check if this machine supports powertop
if ! powertop --csv --time=1 2>&1; then
    echo "SKIP: machine does not support powertop"
    exit 0
fi

OUT=`power-usage-report`

check_log() {
    if ! echo "$OUT" | grep -q "$1"; then
        echo "$1 not found in log:" >&2
        echo "===================" >&2
        cat $LOG >&2
        echo "===================" >&2
        exit 1
    fi
}

# this is just a simple smoketest, but guards against bugs like LP#1265142
check_log "== Wakeups =="
