summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Mark W. Eichin <eichin@thok.org>2009-04-24 04:17:51 +0000
committerGravatar Mark W. Eichin <eichin@thok.org>2009-04-24 04:17:51 +0000
commitaa706b41aba93656194347be6cddd9601a286925 (patch)
treed0591f69689c780f0058f44f3b66f7e90abad75c
parentdbe56255ca42205ec9031a47f00245d5c1304fa4 (diff)
test ZGetDestAddr
-rwxr-xr-xlib/zephyr_tests.py3
-rw-r--r--lib/zephyr_tests.txt8
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/zephyr_tests.py b/lib/zephyr_tests.py
index bfd2901..043ed2b 100755
--- a/lib/zephyr_tests.py
+++ b/lib/zephyr_tests.py
@@ -339,6 +339,7 @@ class libZephyr(object):
"ZClosePort",
"ZMakeAscii",
"ZMakeZcode",
+ "ZGetDestAddr",
]
def __init__(self, library_path=None):
"""connect to the library and build the wrappers"""
@@ -480,6 +481,8 @@ class libZephyr(object):
c_int, # num
]
+ # struct sockaddr_in ZGetDestAddr (void) {
+ self.ZGetDestAddr.restype = sockaddr_in
# library-specific setup...
self.ZInitialize()
diff --git a/lib/zephyr_tests.txt b/lib/zephyr_tests.txt
index 8bd5e0b..906399a 100644
--- a/lib/zephyr_tests.txt
+++ b/lib/zephyr_tests.txt
@@ -177,14 +177,18 @@ Trivial test of ZOpenPort and ZClosePort:
>>> assert st == 0
>>> assert _z.ZGetFD() != -1
>>> assert port != 0
+ >>> zephyr_tests.ctypes_pprint(_z.ZGetDestAddr())
+ ... # doctest: +ELLIPSIS
+ sin_family AF_INET(2)
+ sin_port ...
+ sin_addr 127.0.0.1
+ sin_zero [ignored]
TODO: consider checking that ZGetFD is returning a socket on that port.
>>> assert _z.ZClosePort() == 0
>>> assert _z.ZGetFD() == -1
-TODO: check that ZGetDestAddr points somewhere, too.
-
ZMakeAscii takes a target buffer and length and an input buffer and
length, and generates the "special" Zephyr encoding.