summaryrefslogtreecommitdiff
path: root/wasp/boards
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-12-04 19:33:05 (GMT)
committerDaniel Thompson <daniel.thompson@linaro.org>2020-12-04 20:11:41 (GMT)
commitf1f5cc9e0c113bf44c7ca2ce58ed1c41089a1b7f (patch)
treece20d71a92ed1010759f1919b29aa87dd04e52f8 /wasp/boards
parent3fb1faceab8c4067cf636e0628ab44fe77582f72 (diff)
simulator: Introduce fully automatic testint
Currently the tests do little more than fire up the simulator and switch into (and out of) the built in applications. However this is useful and allows us to fully integrate as a CI job. Unfortunately the numpy warning from pysdl2 mean we have been forced to disable all warnings to prevent pytest from collecting and reporting them. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Diffstat (limited to 'wasp/boards')
-rw-r--r--wasp/boards/simulator/test_smoke.py64
1 files changed, 64 insertions, 0 deletions
diff --git a/wasp/boards/simulator/test_smoke.py b/wasp/boards/simulator/test_smoke.py
new file mode 100644
index 0000000..6dd2757
--- /dev/null
+++ b/wasp/boards/simulator/test_smoke.py
@@ -0,0 +1,64 @@
+import pytest
+import time
+import wasp
+
+def step():
+ wasp.system._tick()
+ wasp.machine.deepsleep()
+wasp.system.step = step
+
+def play(appname):
+ system = wasp.system
+ system.switch(system.apps[appname])
+ for i in range(4):
+ system.step()
+ time.sleep(0.125)
+ system.switch(system.quick_ring[0])
+wasp.system.play = play
+
+wasp.system.apps = {}
+for app in wasp.system.quick_ring + wasp.system.launcher_ring:
+ wasp.system.apps[app.NAME] = app
+
+@pytest.fixture
+def system():
+ system = wasp.system
+ if system.app != system.quick_ring[0]:
+ system.switch(system.quick_ring[0])
+ system.step()
+
+ return system
+
+def test_step(system):
+ system.step()
+
+def test_quick_ring(system):
+ names = [ x.NAME for x in system.quick_ring ]
+ assert('Clock' in names)
+ assert('Steps' in names)
+ assert('Timer' in names)
+ assert('Heart' in names)
+
+def test_launcher_ring(system):
+ names = [ x.NAME for x in system.launcher_ring ]
+ assert('Self Test' in names)
+ assert('Settings' in names)
+ assert('Torch' in names)
+
+def test_steps(system):
+ system.play('Steps')
+
+def test_timer(system):
+ system.play('Timer')
+
+def test_heart(system):
+ system.play('Heart')
+
+def test_self_test(system):
+ system.play('Self Test')
+
+def test_settings(system):
+ system.play('Settings')
+
+def test_torch(system):
+ system.play('Torch')