Commit e239d77b authored by Projects's avatar Projects

tests/pulse_rejection: more robust testing

- introduced a flag to indicate a continuous test
- increased the cooldown time
- more verbose output
parent 45565e3c
......@@ -24,7 +24,7 @@ address = cfg.HNAME if cfg.ENABLED and cfg.HNAME else raw_input("Hostname: ")
user = cfg.USER if cfg.ENABLED and cfg.USER else raw_input("User: ")
password = cfg.PWD if cfg.ENABLED and cfg.PWD else raw_input("Password: ")
slot = int(input("Slot number: "))
cooldown_time = 6 # 6 seconds of cool down time between tests
cooldown_time = 20 # number seconds of cool down time between tests
elma = Elma(address, user, password)
convttl = PyConvTTL(slot, elma)
......@@ -50,9 +50,9 @@ if(convttl.status.switch[1]):
{'freq': 1333333, 'seconds': 6.5},
{'freq': 1000000, 'seconds': 10},
{'freq': 800000, 'seconds': 26},
{'freq': 666667, 'seconds': 36.66},
{'freq': 571428.6, 'seconds': 120} # continuous, but waiting for infinite
) # number of seconds takes too long
{'freq': 666667, 'seconds': 36.6},
{'freq': 571428.6, 'seconds': 120, 'continuous': True}
)
else:
# long pulse
print("Running long pulse tests")
......@@ -63,14 +63,16 @@ else:
{'freq': 75757.8, 'seconds': 10},
{'freq': 69444.4, 'seconds': 20},
{'freq': 55555.6, 'seconds': 60},
{'freq': 52083.3, 'seconds': 120}, # continuous, but waiting for infinite
) # number of seconds takes too long
{'freq': 52083.3, 'seconds': 120, 'continuous': True},
)
# run tests
for test in tests:
old_counters = None
freq = test['freq']
pulses = test['freq'] * test['seconds']
seconds = test['seconds']
pulses = freq * seconds
continuous = True if 'continuous' in test and test['continous'] else False
#############################################################################################
# test if the guaranteed number of pulses is repeated
......@@ -83,7 +85,7 @@ for test in tests:
convttl.error.clear()
print("------")
print("TEST: accept %d pulses at %d Hz" % (pulses, freq))
print("TEST: accept %d pulses at %d Hz (%f s)" % (pulses, freq, seconds))
print("Start the pulse burst generator (%d pulses)" % int(pulses))
print(" ./pulsegen.py -c %d -f %F" % (pulses, freq))
print("")
......@@ -121,11 +123,14 @@ for test in tests:
test_run = False
break
print("waiting %d seconds of cool-down period" % cooldown_time)
time.sleep(cooldown_time)
#############################################################################################
# test if pulses are rejected after the counter threshold has been reached
print("waiting %d seconds of cool-down period" % cooldown_time)
time.sleep(cooldown_time)
if continuous: # we cannot perform this test for frequencies that
continue # are meant to repeat pulses without rejecting any
# clear counters
for ch in range(1, 7):
......@@ -144,7 +149,7 @@ for test in tests:
print("Pulse counters:")
test_run = True
passed = [False for _ in range(6)]
passed = [False for _ in range(6)] # passed test flags for each channel
# test if pulses are rejected after a certain threshold
while(test_run):
......@@ -178,5 +183,8 @@ for test in tests:
sys.exit(2)
test_run = False
if any(passed):
print("TEST PASSED")
print("waiting %d seconds of cool-down period" % cooldown_time)
time.sleep(cooldown_time)
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