summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/extmod/websocket_toobig.py28
-rw-r--r--tests/extmod/websocket_toobig.py.exp1
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/extmod/websocket_toobig.py b/tests/extmod/websocket_toobig.py
new file mode 100644
index 000000000..f4c5a74bb
--- /dev/null
+++ b/tests/extmod/websocket_toobig.py
@@ -0,0 +1,28 @@
+try:
+ import io
+ import errno
+ import websocket
+except ImportError:
+ print("SKIP")
+ raise SystemExit
+
+try:
+ buf = "x" * 65536
+except MemoryError:
+ print("SKIP")
+ raise SystemExit
+
+
+# do a websocket write and then return the raw data from the stream
+def ws_write(msg, sz):
+ s = io.BytesIO()
+ ws = websocket.websocket(s)
+ ws.write(msg)
+ s.seek(0)
+ return s.read(sz)
+
+
+try:
+ print(ws_write(buf, 1))
+except OSError as e:
+ print("ioctl: ENOBUFS:", e.errno == errno.ENOBUFS)
diff --git a/tests/extmod/websocket_toobig.py.exp b/tests/extmod/websocket_toobig.py.exp
new file mode 100644
index 000000000..3bbd95282
--- /dev/null
+++ b/tests/extmod/websocket_toobig.py.exp
@@ -0,0 +1 @@
+ioctl: ENOBUFS: True