1*0a6a1f1dSLionel Sambuc# $NetBSD: t_swsensor.sh,v 1.9 2015/04/23 23:23:28 pgoyette Exp $ 211be35a1SLionel Sambuc 311be35a1SLionel Sambucget_sensor_info() { 411be35a1SLionel Sambuc rump.envstat -x | \ 511be35a1SLionel Sambuc sed -e "\;swsensor;,\;/array;p" -e "d" 611be35a1SLionel Sambuc} 711be35a1SLionel Sambuc 811be35a1SLionel Sambucget_sensor_key() { 9*0a6a1f1dSLionel Sambuc local v 10*0a6a1f1dSLionel Sambuc v=$(get_sensor_info | grep -A1 $1 | grep integer | \ 11*0a6a1f1dSLionel Sambuc sed -e 's;<[/a-z]*>;;g') 12*0a6a1f1dSLionel Sambuc if [ -z "$v" ] ; then 13*0a6a1f1dSLionel Sambuc v="key_$1_not_found" 14*0a6a1f1dSLionel Sambuc fi 15*0a6a1f1dSLionel Sambuc echo $v 1611be35a1SLionel Sambuc} 1711be35a1SLionel Sambuc 1811be35a1SLionel Sambucget_powerd_event_count() { 1911be35a1SLionel Sambuc grep "not running" powerd.log | wc -l 2011be35a1SLionel Sambuc} 2111be35a1SLionel Sambuc 2211be35a1SLionel Sambucget_rnd_bits_count() { 2311be35a1SLionel Sambuc env RUMPHIJACK=blanket=/dev/random:/dev/urandom \ 2411be35a1SLionel Sambuc RUMP_SERVER=unix://t_swsensor_socket \ 2511be35a1SLionel Sambuc LD_PRELOAD=/usr/lib/librumphijack.so rndctl -l | \ 2611be35a1SLionel Sambuc grep "swsensor-sensor" | \ 2711be35a1SLionel Sambuc awk '{print $2}' 2811be35a1SLionel Sambuc} 2911be35a1SLionel Sambuc 3011be35a1SLionel Sambuccheck_powerd_event() { 3111be35a1SLionel Sambuc event=$(grep "not running" powerd.log | \ 3211be35a1SLionel Sambuc sed -e "$1p" -e "d" ) 3311be35a1SLionel Sambuc event=${event##*//} 3411be35a1SLionel Sambuc script=${event%% *} 3511be35a1SLionel Sambuc event=${event#* } 3611be35a1SLionel Sambuc device=${event%% *} 3711be35a1SLionel Sambuc event=${event#* } 3811be35a1SLionel Sambuc state=${event%% *} 3911be35a1SLionel Sambuc sensor=${event#* } 4011be35a1SLionel Sambuc sensor=${sensor% *} 4111be35a1SLionel Sambuc 4211be35a1SLionel Sambuc if [ "${script}" != "sensor_indicator" ] ; then 4311be35a1SLionel Sambuc echo "Event uses wrong script: ${script}" 4411be35a1SLionel Sambuc elif [ "${device}" != "swsensor" ] ; then 4511be35a1SLionel Sambuc echo "Event uses wrong device: ${device}" 4611be35a1SLionel Sambuc elif [ "${sensor}" != "sensor" ] ; then 4711be35a1SLionel Sambuc echo "Event uses wrong sensor: ${sensor}" 4811be35a1SLionel Sambuc elif [ "${state}" != "$2" ] ; then 4911be35a1SLionel Sambuc echo "Event uses wrong state: ${state}" 5011be35a1SLionel Sambuc fi 5111be35a1SLionel Sambuc} 5211be35a1SLionel Sambuc 5311be35a1SLionel Sambuc# Start the rump server, then load the swsensor module with the 5411be35a1SLionel Sambuc# requested properties 5511be35a1SLionel Sambuc 5611be35a1SLionel Sambucstart_rump() { 5711be35a1SLionel Sambuc rump_allserver -l rumpvfs -l rumpdev -l rumpdev_sysmon ${RUMP_SERVER} 5811be35a1SLionel Sambuc if [ $( get_sensor_info | wc -l ) -ne 0 ] ; then 5911be35a1SLionel Sambuc rump.modunload swsensor 6011be35a1SLionel Sambuc rump.modload -f $1 swsensor 6111be35a1SLionel Sambuc else 6211be35a1SLionel Sambuc rump.modload $1 swsensor 6311be35a1SLionel Sambuc fi 6411be35a1SLionel Sambuc return $? 6511be35a1SLionel Sambuc} 6611be35a1SLionel Sambuc 6711be35a1SLionel Sambuccommon_head() { 6811be35a1SLionel Sambuc atf_set descr "$1" 69*0a6a1f1dSLionel Sambuc atf_set timeout 120 7011be35a1SLionel Sambuc atf_set require.progs rump.powerd rump.envstat rump.modload \ 7111be35a1SLionel Sambuc rump.halt rump.sysctl rump_server \ 7211be35a1SLionel Sambuc sed grep awk \ 7311be35a1SLionel Sambuc rndctl expr 7411be35a1SLionel Sambuc} 7511be35a1SLionel Sambuc 7611be35a1SLionel Sambuccommon_cleanup() { 7711be35a1SLionel Sambuc rump.modunload swsensor 7811be35a1SLionel Sambuc rump.halt 7911be35a1SLionel Sambuc} 8011be35a1SLionel Sambuc 8111be35a1SLionel Sambuccreate_envsys_conf_files() { 8211be35a1SLionel Sambuc cat << ENV0 > env0.conf 8311be35a1SLionel Sambuc swsensor { 8411be35a1SLionel Sambuc refresh-timeout = 2s; 8511be35a1SLionel Sambuc } 8611be35a1SLionel SambucENV0 8711be35a1SLionel Sambuc cat << ENV1 > env1.conf 8811be35a1SLionel Sambuc swsensor { 8911be35a1SLionel Sambuc sensor0 { critical-min = $(( $1 - $2 )); } 9011be35a1SLionel Sambuc } 9111be35a1SLionel SambucENV1 9211be35a1SLionel Sambuc cat << ENV2 > env2.conf 9311be35a1SLionel Sambuc swsensor { 9411be35a1SLionel Sambuc sensor0 { critical-min = $1; } 9511be35a1SLionel Sambuc } 9611be35a1SLionel SambucENV2 9711be35a1SLionel Sambuc} 9811be35a1SLionel Sambuc 9911be35a1SLionel Sambuc# Test body common to all sensors 10011be35a1SLionel Sambuc# $1 sensor mode 10111be35a1SLionel Sambuc# $2 initial sensor value 10211be35a1SLionel Sambuc# $3 initial limit 10311be35a1SLionel Sambuc# $4 amount to lower limit 10411be35a1SLionel Sambuc# $5 difference from limit to trigger event 10511be35a1SLionel Sambuc# $6 sensor flags, for FHAS_ENTROPY and FMONNOTSUPP 10611be35a1SLionel Sambuc 10711be35a1SLionel Sambuccommon_body() { 10811be35a1SLionel Sambuc # Start the rump-server process and load the module 10911be35a1SLionel Sambuc modload_args="-i mode=$1 -i value=$2 -i limit=$3 ${6:+-i flags=$6}" 11011be35a1SLionel Sambuc start_rump "$modload_args" 11111be35a1SLionel Sambuc 11211be35a1SLionel Sambuc # create configuration files for updates 11311be35a1SLionel Sambuc create_envsys_conf_files $3 $4 11411be35a1SLionel Sambuc 11511be35a1SLionel Sambuc if [ $? -ne 0 ] ; then 11611be35a1SLionel Sambuc atf_skip "Cannot set-up rump environment" 11711be35a1SLionel Sambuc fi 11811be35a1SLionel Sambuc 11911be35a1SLionel Sambuc # start powerd so we can detect sensor events 12011be35a1SLionel Sambuc rump.powerd -n -d > powerd.log 2>&1 & 12111be35a1SLionel Sambuc if [ -z "$(jobs)" ] ; then 12211be35a1SLionel Sambuc skip_events=1 12311be35a1SLionel Sambuc echo "Skipping event sub-tests - powerd did not start" 12411be35a1SLionel Sambuc else 12511be35a1SLionel Sambuc skip_events=0 12611be35a1SLionel Sambuc expected_event=1 12711be35a1SLionel Sambuc fi 12811be35a1SLionel Sambuc 12911be35a1SLionel Sambuc # Step 0 - verify that sensor is registered 13011be35a1SLionel Sambuc get_sensor_info | grep -q swsensor || 13111be35a1SLionel Sambuc atf_fail "0: Device swsensor not registered" 13211be35a1SLionel Sambuc 13311be35a1SLionel Sambuc # Step 1 - update the refresh-timeout and verify 13411be35a1SLionel Sambuc # (use $(( ... )) since the timeout is displayed in hex!) 13511be35a1SLionel Sambuc rump.envstat -c env0.conf 13611be35a1SLionel Sambuc if [ $(( $( get_sensor_key refresh-timeout ) )) -ne 2 ] ; then 13711be35a1SLionel Sambuc atf_fail "1: Could not set refresh-timout to 2s" 13811be35a1SLionel Sambuc fi 13911be35a1SLionel Sambuc 14011be35a1SLionel Sambuc # Step 2 - verify that we can read sensor's value 14111be35a1SLionel Sambuc if [ $1 -ne 0 -a $( get_sensor_key cur-value ) -ne $2 ] ; then 14211be35a1SLionel Sambuc atf_fail "2: Value not available" 14311be35a1SLionel Sambuc fi 14411be35a1SLionel Sambuc 14511be35a1SLionel Sambuc # Step 3 - verify that changes in sensor value are seen 14611be35a1SLionel Sambuc rump.sysctl -w hw.swsensor.cur_value=$(( $2 + 1 )) 14711be35a1SLionel Sambuc if [ $( get_sensor_key cur-value ) -ne $(( $2 + 1 )) ] ; then 14811be35a1SLionel Sambuc atf_fail "3: Value not updated" 14911be35a1SLionel Sambuc fi 15011be35a1SLionel Sambuc 15111be35a1SLionel Sambuc # Step 4 - if sensor provides hw limit, make sure we can read it 15211be35a1SLionel Sambuc if [ $1 -ne 0 ] ; then 15311be35a1SLionel Sambuc if [ $( get_sensor_key critical-min ) -ne $3 ] ; then 15411be35a1SLionel Sambuc atf_fail "4: Limit not set by device" 15511be35a1SLionel Sambuc fi 15611be35a1SLionel Sambuc fi 15711be35a1SLionel Sambuc 15811be35a1SLionel Sambuc # Step 5 - if sensor provides hw limit, make sure it works 15911be35a1SLionel Sambuc if [ $1 -ne 0 -a ${skip_events} -eq 0 ] ; then 16011be35a1SLionel Sambuc rump.sysctl -w hw.swsensor.cur_value=$(( $3 - $5 )) 16111be35a1SLionel Sambuc sleep 5 16211be35a1SLionel Sambuc cnt=$(get_powerd_event_count) 16311be35a1SLionel Sambuc if [ ${cnt} -lt ${expected_event} ] ; then 16411be35a1SLionel Sambuc atf_fail "5: No event triggered" 16511be35a1SLionel Sambuc elif [ ${cnt} -gt ${expected_event} ] ; then 16611be35a1SLionel Sambuc atf_fail "5: Multiple events triggered" 16711be35a1SLionel Sambuc fi 16811be35a1SLionel Sambuc evt=$( check_powerd_event ${cnt} "critical-under") 16911be35a1SLionel Sambuc if [ -n "${evt}" ] ; then 17011be35a1SLionel Sambuc atf_fail "5: ${evt}" 17111be35a1SLionel Sambuc fi 17211be35a1SLionel Sambuc expected_event=$(( 1 + ${expected_event} )) 17311be35a1SLionel Sambuc fi 17411be35a1SLionel Sambuc 17511be35a1SLionel Sambuc # Step 6 - verify that we return to normal state 17611be35a1SLionel Sambuc if [ $1 -ne 0 -a ${skip_events} -eq 0 ] ; then 17711be35a1SLionel Sambuc rump.sysctl -w hw.swsensor.cur_value=$(( $3 + $5 )) 17811be35a1SLionel Sambuc sleep 5 17911be35a1SLionel Sambuc cnt=$(get_powerd_event_count) 18011be35a1SLionel Sambuc if [ ${cnt} -lt ${expected_event} ] ; then 18111be35a1SLionel Sambuc atf_fail "6: No event triggered" 18211be35a1SLionel Sambuc elif [ ${cnt} -gt ${expected_event} ] ; then 18311be35a1SLionel Sambuc atf_fail "6: Multiple events triggered" 18411be35a1SLionel Sambuc fi 18511be35a1SLionel Sambuc evt=$( check_powerd_event ${cnt} "normal") 18611be35a1SLionel Sambuc if [ -n "${evt}" ] ; then 18711be35a1SLionel Sambuc atf_fail "6: ${evt}" 18811be35a1SLionel Sambuc fi 18911be35a1SLionel Sambuc expected_event=$(( 1 + ${expected_event} )) 19011be35a1SLionel Sambuc fi 19111be35a1SLionel Sambuc 19211be35a1SLionel Sambuc # Step 7 - verify that we can set our own limit 19311be35a1SLionel Sambuc 19411be35a1SLionel Sambuc # Steps 7 thru 12 are skipped if the sensor cannot be monitored 19511be35a1SLionel Sambuc if [ $( expr \( 0$6 / 2048 \) % 2 ) -ne 1 ] ; then 19611be35a1SLionel Sambuc rump.envstat -c env1.conf 19711be35a1SLionel Sambuc if [ $( get_sensor_key critical-min ) -ne $(( $3 - $4 )) ] ; then 19811be35a1SLionel Sambuc atf_fail "7: Limit not set by envstat -c" 19911be35a1SLionel Sambuc fi 20011be35a1SLionel Sambuc 20111be35a1SLionel Sambuc # Step 8 - make sure user-set limit works 20211be35a1SLionel Sambuc if [ ${skip_events} -eq 0 ] ; then 20311be35a1SLionel Sambuc rump.sysctl -w hw.swsensor.cur_value=$(( $3 - $4 - $5 )) 20411be35a1SLionel Sambuc sleep 5 20511be35a1SLionel Sambuc cnt=$(get_powerd_event_count) 20611be35a1SLionel Sambuc if [ ${cnt} -lt ${expected_event} ] ; then 20711be35a1SLionel Sambuc atf_fail "8: No event triggered" 20811be35a1SLionel Sambuc elif [ ${cnt} -gt ${expected_event} ] ; then 20911be35a1SLionel Sambuc atf_fail "8: Multiple events triggered" 21011be35a1SLionel Sambuc fi 21111be35a1SLionel Sambuc evt=$( check_powerd_event ${cnt} "critical-under") 21211be35a1SLionel Sambuc if [ -n "${evt}" ] ; then 21311be35a1SLionel Sambuc atf_fail "8: ${evt}" 21411be35a1SLionel Sambuc fi 21511be35a1SLionel Sambuc expected_event=$(( 1 + ${expected_event} )) 21611be35a1SLionel Sambuc fi 21711be35a1SLionel Sambuc 21811be35a1SLionel Sambuc # Step 9 - verify that we return to normal state 21911be35a1SLionel Sambuc if [ ${skip_events} -eq 0 ] ; then 22011be35a1SLionel Sambuc rump.sysctl -w hw.swsensor.cur_value=$(( $3 - $4 + $5 )) 22111be35a1SLionel Sambuc sleep 5 22211be35a1SLionel Sambuc cnt=$(get_powerd_event_count) 22311be35a1SLionel Sambuc if [ ${cnt} -lt ${expected_event} ] ; then 22411be35a1SLionel Sambuc atf_fail "9: No event triggered" 22511be35a1SLionel Sambuc elif [ ${cnt} -gt ${expected_event} ] ; then 22611be35a1SLionel Sambuc atf_fail "9: Multiple events triggered" 22711be35a1SLionel Sambuc fi 22811be35a1SLionel Sambuc evt=$( check_powerd_event ${cnt} "normal") 22911be35a1SLionel Sambuc if [ -n "${evt}" ] ; then 23011be35a1SLionel Sambuc atf_fail "9: ${evt}" 23111be35a1SLionel Sambuc fi 23211be35a1SLionel Sambuc expected_event=$(( 1 + ${expected_event} )) 23311be35a1SLionel Sambuc fi 23411be35a1SLionel Sambuc 23511be35a1SLionel Sambuc # Step 10 - reset to defaults 23611be35a1SLionel Sambuc rump.envstat -S 23711be35a1SLionel Sambuc if [ $1 -eq 0 ] ; then 23811be35a1SLionel Sambuc get_sensor_info | grep -q critical-min && 23911be35a1SLionel Sambuc atf_fail "10: Failed to clear a limit with envstat -S" 24011be35a1SLionel Sambuc else 24111be35a1SLionel Sambuc if [ $( get_sensor_key critical-min ) -ne $3 ] ; then 24211be35a1SLionel Sambuc atf_fail "10: Limit not reset to initial value" 24311be35a1SLionel Sambuc fi 24411be35a1SLionel Sambuc fi 24511be35a1SLionel Sambuc 24611be35a1SLionel Sambuc # Step 11 - see if more events occur 24711be35a1SLionel Sambuc if [ ${skip_events} -eq 0 ] ; then 24811be35a1SLionel Sambuc rump.envstat -c env0.conf 24911be35a1SLionel Sambuc rump.sysctl -w hw.swsensor.cur_value=$(( $3 - $4 - $5 )) 25011be35a1SLionel Sambuc sleep 5 25111be35a1SLionel Sambuc cnt=$(get_powerd_event_count) 25211be35a1SLionel Sambuc if [ ${cnt} -ge ${expected_event} ] ; then 25311be35a1SLionel Sambuc if [ $1 -ne 2 ] ; then 25411be35a1SLionel Sambuc atf_fail "11b Event triggered after reset" 25511be35a1SLionel Sambuc fi 25611be35a1SLionel Sambuc evt=$( check_powerd_event ${cnt} "critical-under") 25711be35a1SLionel Sambuc if [ -n "${evt}" ] ; then 25811be35a1SLionel Sambuc atf_fail "11a: ${evt}" 25911be35a1SLionel Sambuc fi 26011be35a1SLionel Sambuc fi 26111be35a1SLionel Sambuc fi 26211be35a1SLionel Sambuc 26311be35a1SLionel Sambuc # Step 12 - make sure we can set new limits once more 26411be35a1SLionel Sambuc rump.envstat -c env2.conf 26511be35a1SLionel Sambuc if [ $( get_sensor_key critical-min ) -ne $3 ] ; then 26611be35a1SLionel Sambuc atf_fail "12a: Limit not reset to same value" 26711be35a1SLionel Sambuc fi 26811be35a1SLionel Sambuc rump.envstat -c env1.conf 26911be35a1SLionel Sambuc if [ $( get_sensor_key critical-min ) -ne $(( $3 - $4 )) ] ; then 27011be35a1SLionel Sambuc atf_fail "12b: Limit not reset to new value" 27111be35a1SLionel Sambuc fi 27211be35a1SLionel Sambuc fi 27311be35a1SLionel Sambuc 27411be35a1SLionel Sambuc # Step 13 - confirm registration (or lack thereof) with rndctl 27511be35a1SLionel Sambuc rnd_bits=$( get_rnd_bits_count ) 27611be35a1SLionel Sambuc if [ $( expr \( 0$6 / 8192 \) % 2 ) -eq 1 ] ; then 27711be35a1SLionel Sambuc if [ -z "$rnd_bits" ] ; then 27811be35a1SLionel Sambuc atf_fail "13a: Not registered with rndctl" 27911be35a1SLionel Sambuc fi 28011be35a1SLionel Sambuc else 28111be35a1SLionel Sambuc if [ -n "$rnd_bits" ] ; then 28211be35a1SLionel Sambuc atf_fail "13b: Wrongly registered with rndctl" 28311be35a1SLionel Sambuc fi 28411be35a1SLionel Sambuc fi 28511be35a1SLionel Sambuc 28611be35a1SLionel Sambuc # Steps 14 and 15 are only if sensor is providing entropy 28711be35a1SLionel Sambuc if [ $( expr \( 0$6 / 8192 \) % 2 ) -ne 1 ] ; then 28811be35a1SLionel Sambuc return 28911be35a1SLionel Sambuc fi 29011be35a1SLionel Sambuc 29111be35a1SLionel Sambuc # Step 14 - make sure entropy collected when device is being polled 29211be35a1SLionel Sambuc rump.envstat -c env0.conf 29311be35a1SLionel Sambuc rump.sysctl -w hw.swsensor.cur_value=$3 29411be35a1SLionel Sambuc sleep 5 29511be35a1SLionel Sambuc rump.sysctl -w hw.swsensor.cur_value=$(( $3 + $4 )) 29611be35a1SLionel Sambuc sleep 5 29711be35a1SLionel Sambuc new_rnd_bits=$( get_rnd_bits_count ) 29811be35a1SLionel Sambuc if [ $new_rnd_bits -le $rnd_bits ] ; then 29911be35a1SLionel Sambuc atf_expect_fail "PR kern/47661" 30011be35a1SLionel Sambuc atf_fail "14a: entropy bits did not increase after polling" 30111be35a1SLionel Sambuc fi 30211be35a1SLionel Sambuc rnd_bits=$new_rnd_bits 30311be35a1SLionel Sambuc sleep 5 30411be35a1SLionel Sambuc new_rnd_bits=$( get_rnd_bits_count ) 30511be35a1SLionel Sambuc if [ $new_rnd_bits -gt $rnd_bits ] ; then 30611be35a1SLionel Sambuc atf_expect_fail "PR kern/47661" 30711be35a1SLionel Sambuc atf_fail "14b: entropy bits increased after poll with no value change" 30811be35a1SLionel Sambuc fi 30911be35a1SLionel Sambuc 31011be35a1SLionel Sambuc # Step 15 - make sure entropy collected when device is interrogated 31111be35a1SLionel Sambuc # 31211be35a1SLionel Sambuc rump.envstat -c env0.conf 31311be35a1SLionel Sambuc rump.sysctl -w hw.swsensor.cur_value=$3 31411be35a1SLionel Sambuc get_sensor_key cur-value 31511be35a1SLionel Sambuc rnd_bits=$( get_rnd_bits_count ) 31611be35a1SLionel Sambuc rump.sysctl -w hw.swsensor.cur_value=$(( $3 + $4 )) 31711be35a1SLionel Sambuc get_sensor_key cur-value 31811be35a1SLionel Sambuc new_rnd_bits=$( get_rnd_bits_count ) 31911be35a1SLionel Sambuc if [ $new_rnd_bits -le $rnd_bits ] ; then 32011be35a1SLionel Sambuc atf_expect_fail "PR kern/47661" 32111be35a1SLionel Sambuc atf_fail "15a: entropy bits did not increase after interrogation" 32211be35a1SLionel Sambuc fi 32311be35a1SLionel Sambuc rnd_bits=$new_rnd_bits 32411be35a1SLionel Sambuc get_sensor_key cur-value 32511be35a1SLionel Sambuc new_rnd_bits=$( get_rnd_bits_count ) 32611be35a1SLionel Sambuc if [ $new_rnd_bits -gt $rnd_bits ] ; then 32711be35a1SLionel Sambuc atf_expect_fail "PR kern/47661" 32811be35a1SLionel Sambuc atf_fail "15b: entropy bits increased after interrogation with no value change" 32911be35a1SLionel Sambuc fi 33011be35a1SLionel Sambuc} 33111be35a1SLionel Sambuc 33211be35a1SLionel Sambucatf_test_case simple_sensor cleanup 33311be35a1SLionel Sambucsimple_sensor_head() { 33411be35a1SLionel Sambuc common_head "Test a simple sensor" 33511be35a1SLionel Sambuc} 33611be35a1SLionel Sambuc 33711be35a1SLionel Sambucsimple_sensor_body() { 33811be35a1SLionel Sambuc common_body 0 50 30 10 1 33911be35a1SLionel Sambuc} 34011be35a1SLionel Sambuc 34111be35a1SLionel Sambucsimple_sensor_cleanup() { 34211be35a1SLionel Sambuc common_cleanup 34311be35a1SLionel Sambuc} 34411be35a1SLionel Sambuc 34511be35a1SLionel Sambucatf_test_case limit_sensor cleanup 34611be35a1SLionel Sambuclimit_sensor_head() { 34711be35a1SLionel Sambuc common_head "Test a sensor with internal limit" 34811be35a1SLionel Sambuc} 34911be35a1SLionel Sambuc 35011be35a1SLionel Sambuclimit_sensor_body() { 35111be35a1SLionel Sambuc common_body 1 45 25 8 2 35211be35a1SLionel Sambuc} 35311be35a1SLionel Sambuc 35411be35a1SLionel Sambuclimit_sensor_cleanup() { 35511be35a1SLionel Sambuc common_cleanup 35611be35a1SLionel Sambuc} 35711be35a1SLionel Sambuc 35811be35a1SLionel Sambucatf_test_case alarm_sensor cleanup 35911be35a1SLionel Sambucalarm_sensor_head() { 36011be35a1SLionel Sambuc common_head "Test a sensor with internal checking" 36111be35a1SLionel Sambuc} 36211be35a1SLionel Sambuc 36311be35a1SLionel Sambucalarm_sensor_body() { 36411be35a1SLionel Sambuc common_body 2 40 20 6 3 36511be35a1SLionel Sambuc} 36611be35a1SLionel Sambuc 36711be35a1SLionel Sambucalarm_sensor_cleanup() { 36811be35a1SLionel Sambuc common_cleanup 36911be35a1SLionel Sambuc} 37011be35a1SLionel Sambuc 37111be35a1SLionel Sambucatf_test_case entropy_polled_sensor cleanup 37211be35a1SLionel Sambucentropy_polled_sensor_head() { 37311be35a1SLionel Sambuc common_head "Test a simple sensor that provides entropy" 37411be35a1SLionel Sambuc} 37511be35a1SLionel Sambuc 37611be35a1SLionel Sambucentropy_polled_sensor_body() { 37711be35a1SLionel Sambuc common_body 0 50 30 10 1 8192 37811be35a1SLionel Sambuc} 37911be35a1SLionel Sambuc 38011be35a1SLionel Sambucentropy_polled_sensor_cleanup() { 38111be35a1SLionel Sambuc common_cleanup 38211be35a1SLionel Sambuc} 38311be35a1SLionel Sambuc 38411be35a1SLionel Sambucatf_test_case entropy_interrupt_sensor cleanup 38511be35a1SLionel Sambucentropy_interrupt_sensor_head() { 38611be35a1SLionel Sambuc common_head "Test a sensor that provides entropy without polling" 38711be35a1SLionel Sambuc} 38811be35a1SLionel Sambuc 38911be35a1SLionel Sambucentropy_interrupt_sensor_body() { 39011be35a1SLionel Sambuc common_body 0 50 30 10 1 10240 39111be35a1SLionel Sambuc} 39211be35a1SLionel Sambuc 39311be35a1SLionel Sambucentropy_interrupt_sensor_cleanup() { 39411be35a1SLionel Sambuc common_cleanup 39511be35a1SLionel Sambuc} 39611be35a1SLionel Sambuc 39711be35a1SLionel Sambucatf_init_test_cases() { 39811be35a1SLionel Sambuc RUMP_SERVER="unix://t_swsensor_socket" ; export RUMP_SERVER 39911be35a1SLionel Sambuc atf_add_test_case simple_sensor 40011be35a1SLionel Sambuc atf_add_test_case limit_sensor 40111be35a1SLionel Sambuc atf_add_test_case alarm_sensor 40211be35a1SLionel Sambuc atf_add_test_case entropy_polled_sensor 40311be35a1SLionel Sambuc atf_add_test_case entropy_interrupt_sensor 40411be35a1SLionel Sambuc} 405