#!/bin/bash

# this file is auto-generated by generate-sensor-autotests, 
# DO NOT EDIT! Edit the generator script instead.

test "$1" = stop && exit 0
sensors=$(test-sensors | grep "type: " | awk "{print $2}")
if echo "$sensors" | grep -q Tam; then
    (
        flock 9
        test-sensors Tam&
    ) 9> /data/test-sensors.lock

    lock_ok=false
    for try in $(seq 1 10); do
        if (flock -n 9) 9> /data/test-sensors.lock; then
            lock_ok=true
            break
        else
            sleep 1
        fi
    done
    if test $try = 10; then
        killall test-sensors
        die "test-sensors did not exit in 10 seconds"
    fi    
else
    echo "Sensor ambient-temperature is not present on this device"
    die "So this case will fail, but you should double check it"
fi
