forked from M-Labs/artiq
1
0
Fork 0

test: add unittest for core device watchdog

This commit is contained in:
Sebastien Bourdeauducq 2015-05-01 14:02:31 +08:00
parent 4d31194343
commit 1684586ae8
1 changed files with 18 additions and 0 deletions

View File

@ -181,6 +181,9 @@ class _Exceptions(AutoDB):
class _RPCExceptions(AutoDB): class _RPCExceptions(AutoDB):
class DBKeys:
core = Device()
def build(self): def build(self):
self.success = False self.success = False
@ -199,6 +202,17 @@ class _RPCExceptions(AutoDB):
self.success = True self.success = True
class _Watchdog(AutoDB):
class DBKeys:
core = Device()
@kernel
def run(self):
with watchdog(50*ms):
while True:
pass
@unittest.skipUnless(core_device, "no hardware") @unittest.skipUnless(core_device, "no hardware")
class ExecutionCase(unittest.TestCase): class ExecutionCase(unittest.TestCase):
def test_primes(self): def test_primes(self):
@ -259,6 +273,10 @@ class ExecutionCase(unittest.TestCase):
finally: finally:
comm.close() comm.close()
def test_watchdog(self):
with self.assertRaises(IOError):
_run_on_device(_Watchdog)
class _RTIOLoopback(AutoDB): class _RTIOLoopback(AutoDB):
class DBKeys: class DBKeys: