harness: simplify exception handling in interactive test.
authorSimon Gerber <simon.gerber@inf.ethz.ch>
Mon, 17 Aug 2015 13:21:11 +0000 (15:21 +0200)
committerSimon Gerber <simon.gerber@inf.ethz.ch>
Mon, 17 Aug 2015 13:21:11 +0000 (15:21 +0200)
Signed-off-by: Simon Gerber <simon.gerber@inf.ethz.ch>

tools/harness/tests/common.py

index 095c7d6..cf02bd4 100644 (file)
@@ -255,14 +255,10 @@ class InteractiveTest(TestCommon):
             machine.force_write(self.console)
             try:
                 self.interact()
-            except pexpect.TIMEOUT, e:
+            except (pexpect.TIMEOUT, OSError), e:
                 self.console.logfile.seek(0)
                 print "Interaction timed out:"
-                print self.console.logfile.readlines()
-                raise e
-            except OSError, e:
-                self.console.logfile.seek(0)
-                print self.console.logfile.readlines()
+                print ''.join(self.console.logfile.readlines())
                 raise e
 
         self.console.logfile.seek(0)