Commit e7c0cb17 authored by Federico Vaga's avatar Federico Vaga

tst: fix timeout computation

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent a5547c2a
...@@ -36,7 +36,7 @@ def fmcfd_tdc(request, fmcfd): ...@@ -36,7 +36,7 @@ def fmcfd_tdc(request, fmcfd):
def timeout_compute(start, period_ps, count): def timeout_compute(start, period_ps, count):
proportional = ((count * period_ps)/1000000000000.0) proportional = ((count * period_ps)/1000000000000.0)
return time.time() + proportional + start.seconds + 10 return time.time() + proportional + start + 5
class TestFmcfdLoop(object): class TestFmcfdLoop(object):
""" """
...@@ -73,10 +73,10 @@ class TestFmcfdLoop(object): ...@@ -73,10 +73,10 @@ class TestFmcfdLoop(object):
channel. channel.
""" """
ts = [] ts = []
start_s = 2
start = fmcfd.time + FmcFineDelayTime(2, 0, 0) start = fmcfd.time + FmcFineDelayTime(start_s, 0, 0)
fmcfd_chan.pulse_generate(start, width, period, count) fmcfd_chan.pulse_generate(start, width, period, count)
timeout = timeout_compute(start, period, count) timeout = timeout_compute(start_s, period, count)
while len(ts) < count and time.time() < timeout: while len(ts) < count and time.time() < timeout:
if len(fmcfd_tdc.poll()) == 0: if len(fmcfd_tdc.poll()) == 0:
continue continue
...@@ -97,12 +97,12 @@ class TestFmcfdLoop(object): ...@@ -97,12 +97,12 @@ class TestFmcfdLoop(object):
""" """
pending = count pending = count
ts = [] ts = []
start_s = 2
start = FmcFineDelayTime(2, 0, 0) start = FmcFineDelayTime(start_s, 0, 0)
fmcfd_chan.pulse_generate(fmcfd_chan.dev.time + start, fmcfd_chan.pulse_generate(fmcfd_chan.dev.time + start,
width, period, count) width, period, count)
timeout = timeout_compute(start, period, count) timeout = timeout_compute(start_s, period, count)
while pending > 0 and time.time() < timeout: while pending > 0 and time.time() < timeout:
if len(fmcfd_tdc.poll()) == 0: if len(fmcfd_tdc.poll()) == 0:
continue continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment