forked from M-Labs/artiq
test: add unittest for core device watchdog
This commit is contained in:
parent
4d31194343
commit
1684586ae8
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue