summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Mark W. Eichin <eichin@thok.org>2009-04-26 06:11:07 +0000
committerGravatar Mark W. Eichin <eichin@thok.org>2009-04-26 06:11:07 +0000
commit42795e737f9b8df92399309e29ded61b9b1a79d8 (patch)
tree39352a88c1d1880513e17b87c164dd303234a43c /lib
parent44d4fec1254b7448adf75e0e52cd5db1b6102f78 (diff)
draft packet tests - using pipe trick turns out not to work, though.
Diffstat (limited to 'lib')
-rwxr-xr-xlib/zephyr_tests.py2
-rw-r--r--lib/zephyr_tests.txt23
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/zephyr_tests.py b/lib/zephyr_tests.py
index 5855238..e44652e 100755
--- a/lib/zephyr_tests.py
+++ b/lib/zephyr_tests.py
@@ -340,6 +340,8 @@ class libZephyr(object):
"ZMakeAscii",
"ZMakeZcode",
"ZGetDestAddr",
+ "ZSetFD",
+ "ZPending",
]
def __init__(self, library_path=None):
"""connect to the library and build the wrappers"""
diff --git a/lib/zephyr_tests.txt b/lib/zephyr_tests.txt
index e54a1e9..d7679fa 100644
--- a/lib/zephyr_tests.txt
+++ b/lib/zephyr_tests.txt
@@ -241,6 +241,29 @@ Same thing with ZMakeZcode, a compact binary format that is still NUL-terminated
>>> assert outbuf.value == ref, "%r != %r" % (outbuf.value, ref)
+Queued Packet Tests
+===================
+
+Eventually we'll want tests that install a realm (or several) and
+actually send and receive packets against them, so-called "system
+tests". In the meantime, a faster and more local test that
+synthesizes packets and feeds them through the queuing mechanism will
+get us some more coverage.
+
+ >>> read_end, write_end = os.pipe()
+ >>> assert _z.ZSetFD(read_end) == 0
+ >>> assert _z.ZPending() == 0
+
+TODO: cook up test-specific notices, but for now we've got some lying
+around from above...
+
+ >>> zwhole = string_at(zbuf, size=zbuflen)
+ >>> wrote = os.write(write_end, zwhole)
+ >>> assert wrote == zbuflen.value, "%s != %s" % (wrote, zbuflen.value)
+ >>> zcount = _z.ZPending()
+
+zcount ends up being -1, because recvfrom gives 'Socket operation on
+non-socket' (ENOTSOCK). Instead we need to actually create a local socket...
Coverage: