summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/tricode/gsmselftest-website2.py
diff options
context:
space:
mode:
authorTriatmoko2011-10-27 00:18:20 +0200
committerTriatmoko2011-10-27 00:18:20 +0200
commitbb9fbcac24dd531cf14ce16e97a1ecd7782a7fda (patch)
tree0add3ef9403cfd68daaf29a516e374de19af11bb /For Weekly Test/tricode/gsmselftest-website2.py
parentReport writing (diff)
downloadgsm-selftest-bb9fbcac24dd531cf14ce16e97a1ecd7782a7fda.tar.gz
gsm-selftest-bb9fbcac24dd531cf14ce16e97a1ecd7782a7fda.tar.xz
gsm-selftest-bb9fbcac24dd531cf14ce16e97a1ecd7782a7fda.zip
timeout devconf
Diffstat (limited to 'For Weekly Test/tricode/gsmselftest-website2.py')
-rwxr-xr-xFor Weekly Test/tricode/gsmselftest-website2.py47
1 files changed, 35 insertions, 12 deletions
diff --git a/For Weekly Test/tricode/gsmselftest-website2.py b/For Weekly Test/tricode/gsmselftest-website2.py
index 04366ab..5d4a683 100755
--- a/For Weekly Test/tricode/gsmselftest-website2.py
+++ b/For Weekly Test/tricode/gsmselftest-website2.py
@@ -25,6 +25,8 @@ class bcolors:
self.WARNING = ''
self.FAIL = ''
self.ENDC = ''
+class TimeoutException(Exception):
+ pass
global resultsList
resultsList = list()
@@ -32,6 +34,9 @@ resultsList = list()
GSMListPrefix = [['GSMExt.Tm','0151'],['GSMExt.Tm','0160'],['GSMExt.Tm','0170'],['GSMExt.Tm','0171'],['GSMExt.Tm','0175'],['GSMExt.Voda','0152'],['GSMExt.Voda','0162'],['GSMExt.Voda','0172'],['GSMExt.Voda','0173'],['GSMExt.Voda','0174'],['GSMExt.Eplus','0157'],['GSMExt.Eplus','0177'],['GSMExt.Eplus','0155'],['GSMExt.Eplus','0163'],['GSMExt.Eplus','0178'],['GSMExt.O2','0159'],['GSMExt.O2','0176'],['GSMExt.O2','0179'],['GSMRZ1','0761']]
+def timeout_handler(signum, frame):
+ raise TimeoutException()
+
def allPing(): #ping all existing devices
global sipGate
@@ -327,22 +332,40 @@ def initDevice(deviceName):
def autoUpdateDevice(status):
i = 0
x = 0
+ count = 0
while i !=10:
portName ='ttyUSB'+str(i) #checking usb connection
findPort(portName)
i=i+1
- if connect == 1:
- for listNum in GSMListPrefix:
- if prefix == listNum[1]:
- print 'Device Name :',listNum[0]
- print 'IMEI :',IMEI
- print 'Phone Number :',num
- print 'Port Name : /dev/'+portName
- x=x+1
- newPortName = '/dev/'+portName
- portClass.initUpdate(listNum[0], newPortName, num)
- print '\n'
- if status == True:
+ old_handler = signal.signal(signal.SIGALRM, timeout_handler)
+ signal.alarm(15)
+ try:
+ if connect == 1:
+ for listNum in GSMListPrefix:
+ if prefix == listNum[1]:
+ print 'Device Name :',listNum[0]
+ print 'IMEI :',IMEI
+ print 'Phone Number :',num
+ print 'Port Name : /dev/'+portName
+ x=x+1
+ newPortName = '/dev/'+portName
+ portClass.initUpdate(listNum[0], newPortName, num)
+ print '\n'
+ except TimeoutException:
+ signal.signal(signal.SIGALRM, old_handler)
+ signal.alarm(0)
+ count = count + 1
+ message = "Timeout"
+ if status == True:
+ message = listNum[0]+' - /dev/'+portName+' - '+num+ ' update'
+
+ if status == True:
+ if count != 0:
+ message = 'Found '+str(x)+' devices, with '+str(count)+' error'
+ else:
+ message = 'Found '+str(x)+' devices'
+ sendResultWebsite(messages)
+ sleep(0.5)
sendFinishMessage()
else: