How to use wait_output method in lisa

Best Python code snippet using lisa_python

timer_calib.py

Source:timer_calib.py Github

copy

Full Screen

...5# Check timers behavior6#7import time8def one_pass(helper):9 helper.wait_output("=== Timer calibration ===")10 res = helper.wait_output("back-to-back get_time : (?P<lat>[0-9]+) us",11 use_re=True)["lat"]12 minlat = int(res)13 helper.trace("get_time latency %d us\n" % minlat)14 helper.wait_output("sleep 1s")15 t0 = time.time()16 second = helper.wait_output("done. delay = (?P<second>[0-9]+) us",17 use_re=True)["second"]18 t1 = time.time()19 secondreal = t1 - t020 secondlat = int(second) - 100000021 helper.trace("1s timer latency %d us / real time %f s\n" % (secondlat,22 secondreal))23 us = {}24 for pow2 in range(7):25 delay = 1 << (7-pow2)26 us[delay] = helper.wait_output("%d us => (?P<us>[0-9]+) us" % delay,27 use_re=True)["us"]28 helper.wait_output("Done.")29 return minlat, secondlat, secondreal30def test(helper):31 one_pass(helper)32 helper.ec_command("reboot")33 helper.wait_output("--- UART initialized")34 # get the timing results on the second pass35 # to avoid binary translation overhead36 minlat, secondlat, secondreal = one_pass(helper)37 # check that the timings somewhat make sense38 if minlat > 220 or secondlat > 500 or abs(secondreal-1.0) > 0.200:39 helper.fail("imprecise timings " +40 "(get_time %d us sleep %d us / real time %.3f s)" %41 (minlat, secondlat, secondreal))...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful