From 10d9be35ee2ea8f9ba1240afc210370d85d9053b Mon Sep 17 00:00:00 2001 From: Rahul Rahul Date: Mon, 16 May 2016 17:02:29 -0700 Subject: [PATCH] autotests: exit if connect fails --- autotests/test1AP/connectDisconnectTest.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/autotests/test1AP/connectDisconnectTest.py b/autotests/test1AP/connectDisconnectTest.py index a793cc66..2f7fb312 100755 --- a/autotests/test1AP/connectDisconnectTest.py +++ b/autotests/test1AP/connectDisconnectTest.py @@ -10,7 +10,7 @@ import os from random import randrange from subprocess import Popen import sys -sys.path.append('../utility') #needed to import all the utlilty modules +sys.path.append('../utility') #needed to import all the utility modules import utility def defineAgentVars(): @@ -37,6 +37,7 @@ class TestConnectDisconnect(unittest.TestCase): # so that the network list is updated. Alternatively, we can scan # for networks. if (networkToConnect == ""): + time.sleep(2) logger.debug("RESTART PROGRAM") os.execl(sys.executable, sys.executable, * sys.argv) @@ -47,7 +48,11 @@ class TestConnectDisconnect(unittest.TestCase): network = dbus.Interface(bus.get_object("net.connman.iwd", networkToConnect), "net.connman.iwd.Network") - utility.connect(networkToConnect, self, mainloop, bus) + status = utility.connect(networkToConnect, self, mainloop, bus) + if status == False: + #terminate proc + proc.terminate() + return logger.info("Currently connected to: %s", utility.getCurrentlyConnectedNetworkName())