* [PATCH 1/2] test: Adapt voice call test scripts to multi-modem
@ 2014-06-10 8:27 Alfonso Sanchez-Beato
2014-06-10 8:27 ` [PATCH 2/2] test: Adapt data " Alfonso Sanchez-Beato
2014-06-11 4:37 ` [PATCH 1/2] test: Adapt voice call " Denis Kenzior
0 siblings, 2 replies; 3+ messages in thread
From: Alfonso Sanchez-Beato @ 2014-06-10 8:27 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 5581 bytes --]
Some tests scripts were not ready to handle situations with more than
one modem present. This change fixes the scripts that handle voice
calls.
---
test/create-multiparty | 12 +++++++-----
test/hangup-active | 10 ++++++++--
test/private-chat | 17 ++++++++---------
test/release-and-answer | 35 ++++++++++++++++++++++++++---------
test/release-and-swap | 35 ++++++++++++++++++++++++++---------
5 files changed, 75 insertions(+), 34 deletions(-)
diff --git a/test/create-multiparty b/test/create-multiparty
index b6395e8..1b76010 100755
--- a/test/create-multiparty
+++ b/test/create-multiparty
@@ -8,12 +8,14 @@ bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
'org.ofono.Manager')
-modems = manager.GetModems()
-
-path = modems[0][0]
-
-if (len(sys.argv) == 2):
+if (len(sys.argv) == 1):
+ modems = manager.GetModems()
+ path = modems[0][0]
+elif (len(sys.argv) == 2):
path = sys.argv[1]
+else:
+ print("Usage: %s [modem]" % (sys.argv[0]))
+ sys.exit(1)
manager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.VoiceCallManager')
diff --git a/test/hangup-active b/test/hangup-active
index 8e65bc4..82e0eb0 100755
--- a/test/hangup-active
+++ b/test/hangup-active
@@ -8,8 +8,14 @@ bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
'org.ofono.Manager')
-modems = manager.GetModems()
-path = modems[0][0]
+if (len(sys.argv) == 1):
+ modems = manager.GetModems()
+ path = modems[0][0]
+elif (len(sys.argv) == 2):
+ path = sys.argv[1]
+else:
+ print("Usage: %s [modem]" % (sys.argv[0]))
+ sys.exit(1)
manager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.VoiceCallManager')
diff --git a/test/private-chat b/test/private-chat
index 17d17d0..e7e5406 100755
--- a/test/private-chat
+++ b/test/private-chat
@@ -3,24 +3,23 @@
import sys
import dbus
+if (len(sys.argv) != 2):
+ print("Usage: %s [voicecall_path]" % (sys.argv[0]))
+ exit(1)
+
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
'org.ofono.Manager')
-modems = manager.GetModems()
-path = modems[0][0]
-
-if (len(sys.argv) == 3):
- path = sys.argv[1]
- callid = sys.argv[2]
-else:
- callid = sys.argv[1]
+call = sys.argv[1]
+sep = call.find("/", 1)
+path = call[0:sep]
manager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.VoiceCallManager')
-mpty = manager.PrivateChat(callid, timeout=100)
+mpty = manager.PrivateChat(call, timeout=100)
for path in mpty:
print(path)
diff --git a/test/release-and-answer b/test/release-and-answer
index 62eaa79..dec8e17 100755
--- a/test/release-and-answer
+++ b/test/release-and-answer
@@ -1,5 +1,6 @@
#!/usr/bin/python3
+import sys
import dbus
bus = dbus.SystemBus()
@@ -7,16 +8,32 @@ bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
'org.ofono.Manager')
-modems = manager.GetModems()
+if (len(sys.argv) == 1):
+ path = None
+ modems = manager.GetModems()
+ for path_i, properties in modems:
+ if "org.ofono.VoiceCallManager" in properties["Interfaces"]:
+ path = path_i
+ break
+ if (path is None):
+ exit(2)
+elif (len(sys.argv) == 2):
+ path = sys.argv[1]
+else:
+ print("Usage: %s [modem]" % (sys.argv[0]))
+ exit(1)
-for path, properties in modems:
- print("[ %s ]" % (path))
+modemapi = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.Modem')
+properties = modemapi.GetProperties()
- if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
- continue
+if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
+ print("org.ofono.VoiceCallManager not found")
+ exit(2)
- mgr = dbus.Interface(bus.get_object('org.ofono', path),
- 'org.ofono.VoiceCallManager')
+print("[ %s ]" % (path))
+
+mgr = dbus.Interface(bus.get_object('org.ofono', path),
+ 'org.ofono.VoiceCallManager')
+
+mgr.ReleaseAndAnswer()
- mgr.ReleaseAndAnswer()
- break
diff --git a/test/release-and-swap b/test/release-and-swap
index b4c0af1..cb8c84e 100755
--- a/test/release-and-swap
+++ b/test/release-and-swap
@@ -1,5 +1,6 @@
#!/usr/bin/python3
+import sys
import dbus
bus = dbus.SystemBus()
@@ -7,16 +8,32 @@ bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
'org.ofono.Manager')
-modems = manager.GetModems()
+if (len(sys.argv) == 1):
+ modem = None
+ modems = manager.GetModems()
+ for path, properties in modems:
+ if "org.ofono.VoiceCallManager" in properties["Interfaces"]:
+ modem = path
+ break
+ if (modem is None):
+ exit(2)
+elif (len(sys.argv) == 2):
+ modem = sys.argv[1]
+else:
+ print("Usage: %s [modem]" % (sys.argv[0]))
+ exit(1)
-for path, properties in modems:
- print("[ %s ]" % (path))
+modemapi = dbus.Interface(bus.get_object('org.ofono', modem), 'org.ofono.Modem')
+properties = modemapi.GetProperties()
- if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
- continue
+if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
+ print("org.ofono.VoiceCallManager not found")
+ exit(2)
- mgr = dbus.Interface(bus.get_object('org.ofono', path),
- 'org.ofono.VoiceCallManager')
+print("[ %s ]" % (modem))
+
+mgr = dbus.Interface(bus.get_object('org.ofono', modem),
+ 'org.ofono.VoiceCallManager')
+
+mgr.ReleaseAndSwap()
- mgr.ReleaseAndSwap()
- break
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] test: Adapt data test scripts to multi-modem
2014-06-10 8:27 [PATCH 1/2] test: Adapt voice call test scripts to multi-modem Alfonso Sanchez-Beato
@ 2014-06-10 8:27 ` Alfonso Sanchez-Beato
2014-06-11 4:37 ` [PATCH 1/2] test: Adapt voice call " Denis Kenzior
1 sibling, 0 replies; 3+ messages in thread
From: Alfonso Sanchez-Beato @ 2014-06-10 8:27 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 5305 bytes --]
Some tests scripts were not ready to handle situations with more than
one modem present. This change fixes the data context scripts.
---
test/activate-context | 66 +++++++++++++++++++++++++++++++------------------
test/deactivate-context | 64 ++++++++++++++++++++++++++++++-----------------
2 files changed, 83 insertions(+), 47 deletions(-)
diff --git a/test/activate-context b/test/activate-context
index 22ad173..9c00a17 100755
--- a/test/activate-context
+++ b/test/activate-context
@@ -5,36 +5,54 @@ import dbus
bus = dbus.SystemBus()
-manager = dbus.Interface(bus.get_object('org.ofono', '/'),
- 'org.ofono.Manager')
+manager = dbus.Interface(bus.get_object('org.ofono', '/'), 'org.ofono.Manager')
+
+if (len(sys.argv) == 3):
+ modem = sys.argv[1]
+ context_idx = int(sys.argv[2]) - 1
+else:
+ modem = None
+ modems = manager.GetModems()
+ for path, properties in modems:
+ if "org.ofono.ConnectionManager" in properties["Interfaces"]:
+ modem = path
+ break
+ if (modem is None):
+ exit(2)
+ if (len(sys.argv) == 1):
+ context_idx = 0
+ elif (len(sys.argv) == 2):
+ context_idx = int(sys.argv[1]) - 1
+ else:
+ print("Usage: %s [modem] [context_number]" % (sys.argv[0]))
+ exit(1)
-modems = manager.GetModems()
+modemapi = dbus.Interface(bus.get_object('org.ofono', modem), 'org.ofono.Modem')
+properties = modemapi.GetProperties()
-for path, properties in modems:
- if "org.ofono.ConnectionManager" not in properties["Interfaces"]:
- continue
+if "org.ofono.ConnectionManager" not in properties["Interfaces"]:
+ print("org.ofono.ConnectionManager not found")
+ exit(2)
- connman = dbus.Interface(bus.get_object('org.ofono', path),
- 'org.ofono.ConnectionManager')
+connman = dbus.Interface(bus.get_object('org.ofono', modem),
+ 'org.ofono.ConnectionManager')
- contexts = connman.GetContexts()
+contexts = connman.GetContexts()
- if (len(contexts) == 0):
- print("No context available")
- sys.exit(1)
+if (len(contexts) == 0):
+ print("No context available")
+ exit(1)
- connman.SetProperty("Powered", dbus.Boolean(1))
+connman.SetProperty("Powered", dbus.Boolean(1))
- if len(sys.argv) > 1:
- path = contexts[int(sys.argv[1])][0]
- else:
- path = contexts[0][0]
+path = contexts[context_idx][0]
- context = dbus.Interface(bus.get_object('org.ofono', path),
- 'org.ofono.ConnectionContext')
+context = dbus.Interface(bus.get_object('org.ofono', path),
+ 'org.ofono.ConnectionContext')
+
+try:
+ context.SetProperty("Active", dbus.Boolean(1), timeout = 100)
+except dbus.DBusException as e:
+ print("Error activating %s: %s" % (path, str(e)))
+ exit(2)
- try:
- context.SetProperty("Active", dbus.Boolean(1), timeout = 100)
- except dbus.DBusException as e:
- print("Error activating %s: %s" % (path, str(e)))
- exit(2)
diff --git a/test/deactivate-context b/test/deactivate-context
index bc2ffd3..24409cb 100755
--- a/test/deactivate-context
+++ b/test/deactivate-context
@@ -5,34 +5,52 @@ import dbus
bus = dbus.SystemBus()
-manager = dbus.Interface(bus.get_object('org.ofono', '/'),
- 'org.ofono.Manager')
+manager = dbus.Interface(bus.get_object('org.ofono', '/'), 'org.ofono.Manager')
+
+if (len(sys.argv) == 3):
+ modem = sys.argv[1]
+ context_idx = int(sys.argv[2]) - 1
+else:
+ modem = None
+ modems = manager.GetModems()
+ for path, properties in modems:
+ if "org.ofono.ConnectionManager" in properties["Interfaces"]:
+ modem = path
+ break
+ if (modem is None):
+ exit(2)
+ if (len(sys.argv) == 1):
+ context_idx = 0
+ elif (len(sys.argv) == 2):
+ context_idx = int(sys.argv[1]) - 1
+ else:
+ print("Usage: %s [modem] [context_number]" % (sys.argv[0]))
+ exit(1)
-modems = manager.GetModems()
+modemapi = dbus.Interface(bus.get_object('org.ofono', modem), 'org.ofono.Modem')
+properties = modemapi.GetProperties()
-for path, properties in modems:
- if "org.ofono.ConnectionManager" not in properties["Interfaces"]:
- continue
+if "org.ofono.ConnectionManager" not in properties["Interfaces"]:
+ print("org.ofono.ConnectionManager not found")
+ exit(2)
- connman = dbus.Interface(bus.get_object('org.ofono', path),
- 'org.ofono.ConnectionManager')
+connman = dbus.Interface(bus.get_object('org.ofono', modem),
+ 'org.ofono.ConnectionManager')
- contexts = connman.GetContexts()
+contexts = connman.GetContexts()
- if (len(contexts) == 0):
- print("No context available")
- sys.exit(1)
+if (len(contexts) == 0):
+ print("No context available")
+ sys.exit(1)
- if len(sys.argv) > 1:
- path = contexts[int(sys.argv[1])][0]
- else:
- path = contexts[0][0]
+path = contexts[context_idx][0]
- context = dbus.Interface(bus.get_object('org.ofono', path),
- 'org.ofono.ConnectionContext')
+context = dbus.Interface(bus.get_object('org.ofono', path),
+ 'org.ofono.ConnectionContext')
+
+try:
+ context.SetProperty("Active", dbus.Boolean(0))
+except dbus.DBusException as e:
+ print("Error deactivating %s: %s" % (path, str(e)))
+ exit(2)
- try:
- context.SetProperty("Active", dbus.Boolean(0))
- except dbus.DBusException as e:
- print("Error activating %s: %s" % (path, str(e)))
- exit(2)
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] test: Adapt voice call test scripts to multi-modem
2014-06-10 8:27 [PATCH 1/2] test: Adapt voice call test scripts to multi-modem Alfonso Sanchez-Beato
2014-06-10 8:27 ` [PATCH 2/2] test: Adapt data " Alfonso Sanchez-Beato
@ 2014-06-11 4:37 ` Denis Kenzior
1 sibling, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2014-06-11 4:37 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 630 bytes --]
Hi Alfonso,
On 06/10/2014 03:27 AM, Alfonso Sanchez-Beato wrote:
> Some tests scripts were not ready to handle situations with more than
> one modem present. This change fixes the scripts that handle voice
> calls.
> ---
> test/create-multiparty | 12 +++++++-----
> test/hangup-active | 10 ++++++++--
> test/private-chat | 17 ++++++++---------
> test/release-and-answer | 35 ++++++++++++++++++++++++++---------
> test/release-and-swap | 35 ++++++++++++++++++++++++++---------
> 5 files changed, 75 insertions(+), 34 deletions(-)
>
Both patches have been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-11 4:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-10 8:27 [PATCH 1/2] test: Adapt voice call test scripts to multi-modem Alfonso Sanchez-Beato
2014-06-10 8:27 ` [PATCH 2/2] test: Adapt data " Alfonso Sanchez-Beato
2014-06-11 4:37 ` [PATCH 1/2] test: Adapt voice call " Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.