Merge "Fixes for mastership failover test"
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 7541780..3a29d00 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -830,7 +830,7 @@
                     isReachable = main.FALSE
         except pexpect.TIMEOUT:
             main.log.exception( self.name + ": TIMEOUT exception" )
-            self.exitFromCmd( self.hostPrompt )
+            self.exitFromCmd( [ self.hostPrompt, self.bashPrompt ] )
             isReachable = main.FALSE
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -2234,7 +2234,9 @@
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":     " + self.handle.before )
-            main.cleanAndExit()
+            # Do not exit the entire test when pexpect.EOF is caught
+            # FIXME: We might need to do something else here
+            return main.ERROR
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanAndExit()
diff --git a/TestON/drivers/common/clidriver.py b/TestON/drivers/common/clidriver.py
index 6f8e257..fbd6bd8 100644
--- a/TestON/drivers/common/clidriver.py
+++ b/TestON/drivers/common/clidriver.py
@@ -561,18 +561,19 @@
         command. It will retry multiple times until the running command is
         completely killed and expected string is returned from the handle.
         Required:
-            expect: the expected string which indicates that the previous command
-                    was killed successfully.
+            expect: expected string or list of strings which indicates that the
+                    previous command was killed successfully.
         Optional:
             retry: maximum number of ctrl+c that will be sent.
         """
+        expect = [ expect ] if isinstance( expect, str ) else expect
         try:
             while retry >= 0:
                 main.log.debug( self.name + ": sending ctrl+c to kill the command" )
                 self.handle.send( "\x03" )
-                i = self.handle.expect( [ expect, pexpect.TIMEOUT ], timeout=3 )
+                i = self.handle.expect( expect + [ pexpect.TIMEOUT ], timeout=3 )
                 main.log.debug( self.handle.before )
-                if i == 0:
+                if i < len( expect ):
                     main.log.debug( self.name + ": successfully killed the command" )
                     return main.TRUE
                 retry -= 1