forked from M-Labs/artiq
1
0
Fork 0

test: add test for seamless handover on exception termination

This commit is contained in:
Sebastien Bourdeauducq 2016-06-19 19:15:10 +08:00
parent 8e308481c1
commit 917cc056f4
1 changed files with 31 additions and 0 deletions

View File

@ -238,6 +238,31 @@ class Handover(EnvExperiment):
self.k("t2") self.k("t2")
class DummyException(Exception):
pass
class HandoverException(EnvExperiment):
def build(self):
self.setattr_device("core")
@kernel
def k(self, var):
self.set_dataset(var, now_mu())
delay_mu(1234)
raise DummyException()
def run(self):
try:
self.k("t1")
except DummyException:
pass
try:
self.k("t2")
except DummyException:
pass
class CoredeviceTest(ExperimentCase): class CoredeviceTest(ExperimentCase):
def test_loopback(self): def test_loopback(self):
self.execute(Loopback) self.execute(Loopback)
@ -314,6 +339,12 @@ class CoredeviceTest(ExperimentCase):
self.assertEqual(self.dataset_mgr.get("t1") + 1234, self.assertEqual(self.dataset_mgr.get("t1") + 1234,
self.dataset_mgr.get("t2")) self.dataset_mgr.get("t2"))
def test_handover_exception(self):
self.execute(HandoverException)
self.assertEqual(self.dataset_mgr.get("t1") + 1234,
self.dataset_mgr.get("t2"))
class RPCTiming(EnvExperiment): class RPCTiming(EnvExperiment):
def build(self, repeats=100): def build(self, repeats=100):