On login print all lines without doing further processing
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Sat, 21 Apr 2018 11:16:15 +0000 (13:16 +0200)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Sat, 21 Apr 2018 11:16:15 +0000 (13:16 +0200)
We increase the speed by 5 when we print all lines which are terminated
by \n when we get the full boot log. The line we a re logging for is not
terminated by \n

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
test.py

diff --git a/test.py b/test.py
index 53f0052..f7f7c66 100755 (executable)
--- a/test.py
+++ b/test.py
@@ -274,17 +274,33 @@ class connection():
             print("We are  not logged in")
             return False
 
+    def print_lines_in_buffer(self):
+        while True:
+            self.log.debug("Fill buffer ...")
+            self.peek(len(self.buffer) + self.in_waiting)
+            self.log.debug("Current buffer length: {}".format(len(self.buffer)))
+            if self.line_in_buffer() == True:
+                while self.line_in_buffer() == True:
+                    data = self.readline()
+                    self.log_console_line(data.decode())
+            else:
+                self.log.debug("We have printed all lines in the buffer")
+                break
+
     def login(self, password):
         if self.username == None:
             self.log.error("Username cannot be blank")
             return False
 
+        self.print_lines_in_buffer()
+
         # Hit enter to see what we get
         self.con.write(b'\n')
         # We get two new lines \r\n ?
         data = self.readline()
         self.log_console_line(data.decode())
 
+        self.print_lines_in_buffer()
 
         if self.back_at_prompt():
             self.log.debug("We are already logged in.")