Пример #1
0
    else:
        message = "It was expected that the sensor would record only 0 values. " +\
            "Returned values were: {}".format(values)
        print_test_result(False, message)
        VERDICT = FAILURE
    OUTPUT = message


# test execution
VERDICT = FAILURE
OUTPUT = ""
COMP_CONF = TC_PARAMETERS('COMP_CONF')
COMP_CONF = COMP_CONF[1:-1]

try:
    sensor_info = get_sensor_hal_info(COMP_CONF)
    sensor_id = sensor_info["index"]
    sensor_type = sensor_info["type"]
except:
    OUTPUT = "Sensor was not found"
    print_test_result(False, OUTPUT)
    exit_test()

menu_items = [
    "Press enter when you are ready to begin the test", {
        "Put the device in a no light environment": check_light_value_is_0
    }, {
        "Do you want repeat the test (y/n)": validate_result
    }
]
Пример #2
0
    limitations under the License.
'''

import os
import sys
from sensors_util import get_sensor_hal_info
from sensors_util import poll_for_events
from sensors_util import get_axis_values
from sensors_util import is_sd_as_expected
from util import print_test_result
from util import exit_test

arg = sys.argv

try:
    sensor_info = get_sensor_hal_info(arg[1])
    sensor_id = sensor_info["index"]
    sensor_type = sensor_info["type"]
except:
    print_test_result(False, "Sensor was not found")
    exit_test()

axis = arg[2]
sensor_freq = 1000000 / sensor_info["maxDelay"]
poll_time = 3
timeout = poll_time * 2 + 5
events_list = poll_for_events(sensor_id, sensor_freq, timeout, poll_time)

if (len(events_list) > 0):
    values = get_axis_values(axis, events_list, sensor_type)
    result = is_sd_as_expected(values)