3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-20 19:12:33 +01:00

autotests: exit if connect fails

This commit is contained in:
Rahul Rahul 2016-05-16 17:02:29 -07:00 committed by Denis Kenzior
parent 242e6d19e8
commit 10d9be35ee

View File

@ -10,7 +10,7 @@ import os
from random import randrange from random import randrange
from subprocess import Popen from subprocess import Popen
import sys 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 import utility
def defineAgentVars(): def defineAgentVars():
@ -37,6 +37,7 @@ class TestConnectDisconnect(unittest.TestCase):
# so that the network list is updated. Alternatively, we can scan # so that the network list is updated. Alternatively, we can scan
# for networks. # for networks.
if (networkToConnect == ""): if (networkToConnect == ""):
time.sleep(2)
logger.debug("RESTART PROGRAM") logger.debug("RESTART PROGRAM")
os.execl(sys.executable, sys.executable, * sys.argv) 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", network = dbus.Interface(bus.get_object("net.connman.iwd",
networkToConnect), networkToConnect),
"net.connman.iwd.Network") "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", logger.info("Currently connected to: %s",
utility.getCurrentlyConnectedNetworkName()) utility.getCurrentlyConnectedNetworkName())