Skip to contentSkip to conversation

test: Add unified test for mesh node example app

PATCH Superseded Inga Stotland 1 participant 1 message Mar 9, 2019 Bluetooth drivers

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 test: Add unified test for mesh node example app

This adds one script, test-mesh, to replace three test-join, example-onoff-server and example-onoff-client.
This is menu driven test that allows provisioning (join) and/or connecting existing (attach) nodes.

---
 test/agent.py             |  14 +-
 test/example-onoff-client | 288 ----------------
 test/example-onoff-server | 365 --------------------
 test/test-mesh            | 706 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 717 insertions(+), 656 deletions(-)
 delete mode 100644 test/example-onoff-client
 delete mode 100644 test/example-onoff-server
 create mode 100755 test/test-mesh
test/agent.py +11 -3
index 22c92f952..778dbe092 100755
@@ -1,9 +1,16 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 import sys
 import dbus
 import dbus.service
-import dbus.mainloop.glib
+
+try:
+  from termcolor import colored, cprint
+  set_green = lambda x: colored(x, 'green', attrs=['bold'])
+  set_cyan = lambda x: colored(x, 'cyan', attrs=['bold'])
+except ImportError:
+  set_green = lambda x: x
+  set_cyan = lambda x: x
 
 AGENT_IFACE = 'org.bluez.mesh.ProvisionAgent1'
 AGENT_PATH = "/mesh/test/agent"
@@ -37,4 +44,5 @@ class Agent(dbus.service.Object):
 
 	@dbus.service.method(AGENT_IFACE, in_signature="su", out_signature="")
 	def DisplayNumeric(self, type, value):
-		print("DisplayNumeric type=", type, " number=", value)
+		print(set_cyan('DisplayNumeric ('), type,
+				set_cyan(') number ='), set_green(value))
test/example-onoff-client deleted +0 -288

288 lines not on this page · raw message

test/example-onoff-server deleted +0 -365

365 lines not on this page · raw message

test/test-mesh new file +706 -0

706 lines not on this page · raw message

Signature · 1 line
2.17.2