Skip to content
Snippets Groups Projects
Commit 5a3fdc3f authored by Jörn Künsemöller's avatar Jörn Künsemöller
Browse files

Task SW-111: signal is enabled for some tile tests as well on request by...

Task SW-111: signal is enabled for some tile tests as well on request by Henri. Status check is now less strict and expects ok-status to be one of the lines of the command output.
parent 29ea996b
No related branches found
No related tags found
No related merge requests found
...@@ -414,9 +414,10 @@ def wait_for_test_signal_status(status_cmd, status, timeout=30): ...@@ -414,9 +414,10 @@ def wait_for_test_signal_status(status_cmd, status, timeout=30):
for _ in range(timeout): for _ in range(timeout):
out = check_output(status_cmd, shell=True) out = check_output(status_cmd, shell=True)
out = out.strip() out = out.strip()
if out == status: for line in out.split('\n'):
logger.info("Status ok.") if line.strip() == status:
return status logger.info("Status ok.")
return status
else: else:
logger.info('Wrong status: %s != %s. Try again...'% (out, status)) logger.info('Wrong status: %s != %s. Try again...'% (out, status))
time.sleep(1) time.sleep(1)
...@@ -670,6 +671,7 @@ def main(): ...@@ -670,6 +671,7 @@ def main():
# if 'RCU%d' % mode in args or 'S%d' % mode in args: # if 'RCU%d' % mode in args or 'S%d' % mode in args:
if 'S%d' % mode in args: if 'S%d' % mode in args:
safely_start_test_signal_from_ParameterSet(tile_settings)
hba.check_rf_power(mode=mode, parset=tile_settings) hba.check_rf_power(mode=mode, parset=tile_settings)
runtime = (time.time() - runstart) runtime = (time.time() - runstart)
......
...@@ -147,6 +147,10 @@ oscillation.min-peak-pwr= 6.0 ...@@ -147,6 +147,10 @@ oscillation.min-peak-pwr= 6.0
oscillation.passband= 1:511 oscillation.passband= 1:511
spurious.min-peak-pwr= 3.0 spurious.min-peak-pwr= 3.0
spurious.passband= 1:511 spurious.passband= 1:511
testsignal.start-cmd= echo set config 56.0 -10 | nc ncu 8093
testsignal.stop-cmd= echo bye | nc ncu 8093
testsignal.status-cmd= echo get config | nc ncu 8093
testsignal.ok-status= Frequency: 56 MHz Power level: -10 dBm RF: ON
[rcumode.5.element] [rcumode.5.element]
rf.subbands= 105 rf.subbands= 105
...@@ -164,7 +168,7 @@ spurious.passband= 1:511 ...@@ -164,7 +168,7 @@ spurious.passband= 1:511
testsignal.start-cmd= echo set config 56.0 -10 | nc ncu 8093 testsignal.start-cmd= echo set config 56.0 -10 | nc ncu 8093
testsignal.stop-cmd= echo bye | nc ncu 8093 testsignal.stop-cmd= echo bye | nc ncu 8093
testsignal.status-cmd= echo get config | nc ncu 8093 testsignal.status-cmd= echo get config | nc ncu 8093
testsignal.ok-status= 56.0 -10 testsignal.ok-status= Frequency: 56 MHz Power level: -10 dBm RF: ON
[rcumode.6.tile] [rcumode.6.tile]
short.mean-pwr.min= 55.0 short.mean-pwr.min= 55.0
......
...@@ -61,7 +61,7 @@ class TestCheckHardware(unittest.TestCase): ...@@ -61,7 +61,7 @@ class TestCheckHardware(unittest.TestCase):
check_hardware.start_watchdog_daemon.assert_called_with(os.getpid(), stop_cmd) check_hardware.start_watchdog_daemon.assert_called_with(os.getpid(), stop_cmd)
def test_safely_start_test_signal_from_ParameterSet(self): def test_safely_start_test_signal_from_ParameterSet(self):
""" Verify that the provided command is executed and handlers are registered correctly""" """ Verify that the commands from ParameterSet are passed on to safely_start_test_signal"""
start_cmd = 'echo set config 56.0 -10 | nc ncu 8093' start_cmd = 'echo set config 56.0 -10 | nc ncu 8093'
stop_cmd = 'echo bye | nc ncu 8093' stop_cmd = 'echo bye | nc ncu 8093'
...@@ -113,7 +113,7 @@ class TestCheckHardware(unittest.TestCase): ...@@ -113,7 +113,7 @@ class TestCheckHardware(unittest.TestCase):
# test value # test value
status_cmd = 'mockme' status_cmd = 'mockme'
responses = ['ne', 'ja', 'ne'] responses = ['ne', 'garbage\n ja \n moregarbage', 'ne']
waitfor = 'ja' waitfor = 'ja'
with patch.object(check_hardware, 'check_output', MagicMock(side_effect=responses)): with patch.object(check_hardware, 'check_output', MagicMock(side_effect=responses)):
...@@ -123,7 +123,7 @@ class TestCheckHardware(unittest.TestCase): ...@@ -123,7 +123,7 @@ class TestCheckHardware(unittest.TestCase):
# assert correct behavior # assert correct behavior
check_hardware.check_output.called_with(status_cmd, shell=True) # command is executed check_hardware.check_output.called_with(status_cmd, shell=True) # command is executed
self.assertEqual(check_hardware.check_output.call_count, responses.index(waitfor) + 1) self.assertEqual(check_hardware.check_output.call_count, 2)
def test_register_signal_handlers_stops_test_signal_on_POSIX_signal(self): def test_register_signal_handlers_stops_test_signal_on_POSIX_signal(self):
""" Verify that the provided command is executed and os._exit is called with correct return code """ """ Verify that the provided command is executed and os._exit is called with correct return code """
...@@ -224,8 +224,8 @@ class TestCheckHardware(unittest.TestCase): ...@@ -224,8 +224,8 @@ class TestCheckHardware(unittest.TestCase):
# test_values # test_values
expected_start_cmd = "echo set config 56.0 -10 | nc ncu 8093" expected_start_cmd = "echo set config 56.0 -10 | nc ncu 8093"
expected_stop_cmd = "echo bye | nc ncu 8093" expected_stop_cmd = "echo bye | nc ncu 8093"
expected_status_cmd = "echo 56.0 -10" expected_status_cmd = "echo 'Frequency: 56 MHz Power level: -10 dBm RF: ON'"
expected_ok_status = "56.0 -10" expected_ok_status = "Frequency: 56 MHz Power level: -10 dBm RF: ON"
# read settings # read settings
f = os.environ.get('srcdir')+'/test-check_hardware.conf' f = os.environ.get('srcdir')+'/test-check_hardware.conf'
...@@ -275,7 +275,7 @@ class TestCheckHardware(unittest.TestCase): ...@@ -275,7 +275,7 @@ class TestCheckHardware(unittest.TestCase):
# -TST (test mode) # -TST (test mode)
# -e5: (element test in mode 5) # -e5: (element test in mode 5)
# Names optimized for disk space # Names optimized for disk space
testargs = ["check_hardware.py", '-TST', '-e5'] testargs = ["check_hardware.py", '-TST', '-s5']
with patch.object(sys, 'argv', testargs): with patch.object(sys, 'argv', testargs):
# trigger action # trigger action
check_hardware.main() # Warning: Something acts as a fork bomb when mocks are not setup properly! check_hardware.main() # Warning: Something acts as a fork bomb when mocks are not setup properly!
......
...@@ -147,6 +147,10 @@ oscillation.min-peak-pwr= 6.0 ...@@ -147,6 +147,10 @@ oscillation.min-peak-pwr= 6.0
oscillation.passband= 1:511 oscillation.passband= 1:511
spurious.min-peak-pwr= 3.0 spurious.min-peak-pwr= 3.0
spurious.passband= 1:511 spurious.passband= 1:511
testsignal.start-cmd= echo set config 56.0 -10 | nc ncu 8093
testsignal.stop-cmd= echo bye | nc ncu 8093
testsignal.status-cmd= echo 'Frequency: 56 MHz Power level: -10 dBm RF: ON'
testsignal.ok-status= Frequency: 56 MHz Power level: -10 dBm RF: ON
[rcumode.5.element] [rcumode.5.element]
rf.subbands= 105 rf.subbands= 105
...@@ -163,8 +167,8 @@ spurious.min-peak-pwr= 3.0 ...@@ -163,8 +167,8 @@ spurious.min-peak-pwr= 3.0
spurious.passband= 1:511 spurious.passband= 1:511
testsignal.start-cmd= echo set config 56.0 -10 | nc ncu 8093 testsignal.start-cmd= echo set config 56.0 -10 | nc ncu 8093
testsignal.stop-cmd= echo bye | nc ncu 8093 testsignal.stop-cmd= echo bye | nc ncu 8093
testsignal.status-cmd= echo 56.0 -10 testsignal.status-cmd= echo 'Frequency: 56 MHz Power level: -10 dBm RF: ON'
testsignal.ok-status= 56.0 -10 testsignal.ok-status= Frequency: 56 MHz Power level: -10 dBm RF: ON
[rcumode.6.tile] [rcumode.6.tile]
short.mean-pwr.min= 55.0 short.mean-pwr.min= 55.0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment