Jason Lowe-Power has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/17449

Change subject: ext,test: Provide default terminal size
......................................................................

ext,test: Provide default terminal size

When creating the separator for printing things to the terminal (=.*) we
use an ioctl that isn't supported in some sandboxed environments. When
running on the Google jenkins server (kokoro) it errors with an IOError.

Change-Id: I148dd87cffe6e93d6723a386aecf9a9ea6c5b455
Signed-off-by: Jason Lowe-Power <ja...@lowepower.com>
---
M ext/testlib/terminal.py
1 file changed, 10 insertions(+), 4 deletions(-)



diff --git a/ext/testlib/terminal.py b/ext/testlib/terminal.py
index 3afbb42..bdb20ed 100644
--- a/ext/testlib/terminal.py
+++ b/ext/testlib/terminal.py
@@ -106,10 +106,16 @@

 def terminal_size():
     '''Return the (width, heigth) of the terminal screen.'''
-    h, w, hp, wp = struct.unpack('HHHH',
-        fcntl.ioctl(0, termios.TIOCGWINSZ,
-        struct.pack('HHHH', 0, 0, 0, 0)))
-    return w, h
+    try:
+        h, w, hp, wp = struct.unpack('HHHH',
+            fcntl.ioctl(0, termios.TIOCGWINSZ,
+            struct.pack('HHHH', 0, 0, 0, 0)))
+        return w, h
+    except IOError:
+ # It's possible that in sandboxed environments the above ioctl is not
+        # allowed (e.g., some jenkins setups)
+        return 80, 24
+

 def separator(char=default_separator, color=None):
     '''

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/17449
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I148dd87cffe6e93d6723a386aecf9a9ea6c5b455
Gerrit-Change-Number: 17449
Gerrit-PatchSet: 1
Gerrit-Owner: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to