From 1684586ae81015c55707d8fa493c255d4d7e70a4 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 1 May 2015 14:02:31 +0800 Subject: [PATCH] test: add unittest for core device watchdog --- artiq/test/full_stack.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/artiq/test/full_stack.py b/artiq/test/full_stack.py index 93da32e15..ae273c62d 100644 --- a/artiq/test/full_stack.py +++ b/artiq/test/full_stack.py @@ -181,6 +181,9 @@ class _Exceptions(AutoDB): class _RPCExceptions(AutoDB): + class DBKeys: + core = Device() + def build(self): self.success = False @@ -199,6 +202,17 @@ class _RPCExceptions(AutoDB): 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") class ExecutionCase(unittest.TestCase): def test_primes(self): @@ -259,6 +273,10 @@ class ExecutionCase(unittest.TestCase): finally: comm.close() + def test_watchdog(self): + with self.assertRaises(IOError): + _run_on_device(_Watchdog) + class _RTIOLoopback(AutoDB): class DBKeys: