aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2012-07-02 14:17:39 +0300
committerJohan Hedberg <johan.hedberg@intel.com>2012-07-02 14:17:39 +0300
commitb0c6296b6f7d38a58a6849120d83092290ca6861 (patch)
tree14280a5b03fe31dba0724ef3ef76c9d6e1ac65d5
parent8d4c083435bfed1c47532530924b33c44b4b3df7 (diff)
downloadbluez-b0c6296b6f7d38a58a6849120d83092290ca6861.tar.gz
bluez-b0c6296b6f7d38a58a6849120d83092290ca6861.tar.xz
bluez-b0c6296b6f7d38a58a6849120d83092290ca6861.zip
test: Pass remote address and port number to test-sap-server
This allows to pass remote SAP server address and optional port number. Also exit script error if not able to connect SAP client to server.
-rwxr-xr-xtest/test-sap-server15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/test-sap-server b/test/test-sap-server
index fc0cde96..ff178af2 100755
--- a/test/test-sap-server
+++ b/test/test-sap-server
@@ -4,6 +4,7 @@ from __future__ import absolute_import, print_function, unicode_literals
from sap_client import *
import time
+import sys
def connect_disconnect_by_client(sap):
@@ -124,13 +125,23 @@ def power_sim_off_on(sap):
if __name__ == "__main__":
- host = "00:00:00:00:00:0" # server bd_addr
+ host = None # server bd_addr
port = 8 # sap server port
+ if (len(sys.argv) < 2):
+ print("Usage: %s <address> [port]" % (sys.argv[0]))
+ sys.exit(1)
+
+ host = sys.argv[1]
+
+ if (len(sys.argv) == 3):
+ port = sys.argv[2]
+
try:
s = SAPClient(host, port)
except BluetoothError as e:
- print("Error " + str(e))
+ print("Error: " + str(e))
+ sys.exit(1)
connect_disconnect_by_client(s)
connect_disconnect_by_server_gracefully(s)