summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2012-11-10 19:02:54 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-11-10 19:06:52 +0100
commitf338470da970fc063616f44e470e658f09f01c6a (patch)
tree795d8686f1d025934cb854768357bdcc56905a0a
parent27bfbde0b5b8d44c8b822513a744352cbc8ff116 (diff)
sms: Fix the test for sending SMS (still not verifying the result)
Handle failures to cancel a SMS gracefully (as the SMS could have been submitted from query to delete), handle registeration failures properly by ignoring them (the modem has a valid SIM card and eventually should be able to register).
-rw-r--r--ofono-end-to-end/osmocom/nitb_test.py9
-rwxr-xr-x[-rw-r--r--]ofono-end-to-end/sms_sending_test.py11
2 files changed, 15 insertions, 5 deletions
diff --git a/ofono-end-to-end/osmocom/nitb_test.py b/ofono-end-to-end/osmocom/nitb_test.py
index 641ecdd..da30573 100644
--- a/ofono-end-to-end/osmocom/nitb_test.py
+++ b/ofono-end-to-end/osmocom/nitb_test.py
@@ -36,16 +36,19 @@ class NitbTest(object):
imsi = mod.sim().imsi()
if not self.socket.imsi_present(imsi):
- print("Modem('%s') doesn't have a provisioned SIM" % mod.name)
+ print("Modem('%s') doesn't have a provisioned SIM('%s')" % (mod.name, imsi))
continue
- self.avail_modems.add(mod)
+ self.avail_modems.append(mod)
ext = self.socket.extension(imsi)
self.ext2mod[ext] = mod
self.mod2ext[mod] = ext
# Now register
- mod.register()
+ try:
+ mod.register()
+ except:
+ print("Registering %s failed. Continuing anyway" % mod)
# TODO: Check if all modems are registered? But this would delay the
# test further. But the modem's SIM card is inside the NITB HLR so it
diff --git a/ofono-end-to-end/sms_sending_test.py b/ofono-end-to-end/sms_sending_test.py
index aa1274d..7bb5fb8 100644..100755
--- a/ofono-end-to-end/sms_sending_test.py
+++ b/ofono-end-to-end/sms_sending_test.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python
# Copyright (C) 2012 Holger Hans Peter Freyther
#
# This program is free software: you can redistribute it and/or modify
@@ -36,14 +37,20 @@ class SmsMassTest(NitbTest):
# Now wait.... TODO. We could connect to the MessageAdded/Removed
# signal and enter the event loop here...
- print("Queued a lot of SMS... now waiting")
+ if len(self.avail_modems) > 0:
+ print("Queued a lot of SMS... now waiting.")
+ else:
+ print("No SMS queued due lack of modems.")
def clear_all_sms(self):
# Clear all SMS so we can easily verify we get SMS..
for modem in self.avail_modems:
sms = modem.sms()
for msg in sms.all_message_names():
- sms.get_message(sms).cancel()
+ try:
+ sms.get_message(msg).cancel()
+ except:
+ print("Deleting SMS('%s') failed. Continuing." % msg)
def send_sms(self, nr, modem, extension_lists):
# Send a SMS to all extensions