aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrendan Jackman <brendan.jackman@arm.com>2017-07-21 12:13:02 +0100
committerPatrick Bellasi <derkling@gmail.com>2017-07-21 14:59:38 +0100
commit89facb762f30211ab0b6915d6ef7d3f38a7f39cc (patch)
treecc3c7dc9dc83dde67d9039187b00252e3f254a9e /tests
parent24d04d403c04e907470c26e8a5333b35cb940f05 (diff)
downloadlisa-89facb762f30211ab0b6915d6ef7d3f38a7f39cc.tar.gz
rta: Disallow invalid composition of delayed tasks
This example: wl = RTA(te.target, 'mywl', calibration=calib) wl.conf('profile', params = {'t': Periodic(delay_s=3, duration_s=1) + Periodic(delay_s=2, duration_s=1)).get()}) Should semantically result in 1. 3s delay 2. 1s of periodic behaviour 3. 2s delay 4. 1s of periodic behaviour. But part 3 (the second delay) will be ignored due to the way we use the "delay" field. We could probably fix this using a "sleep" event, but to keep things simple let's just disallow this type of composition, unless we later find that we need that feature.
Diffstat (limited to 'tests')
-rw-r--r--tests/lisa/test_wlgen_rtapp.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/lisa/test_wlgen_rtapp.py b/tests/lisa/test_wlgen_rtapp.py
index 8513af4..3984d31 100644
--- a/tests/lisa/test_wlgen_rtapp.py
+++ b/tests/lisa/test_wlgen_rtapp.py
@@ -216,6 +216,21 @@ class TestRTAComposition(RTABase):
self.assert_output_file_exists('rt-app-task_ramp-0.log')
self.assert_can_read_logfile(exp_tasks=['task_ramp'])
+ def test_invalid_composition(self):
+ """Test that you can't compose tasks with a delay in the second task"""
+ t1 = Periodic()
+ t2 = Periodic(delay_s=1)
+
+ # Should work fine if delayed task is the first one
+ try:
+ t3 = t2 + t1
+ except Exception as e:
+ raise AssertionError("Couldn't compose tasks: {}".format(e))
+
+ # But not the other way around
+ with self.assertRaises(ValueError):
+ t3 = t1 + t2
+
class TestRTACustom(RTABase):
def _test_custom_smoke(self, calibration):