Kaydet (Commit) d50a1877 authored tarafından Andrew M. Kuchling's avatar Andrew M. Kuchling

Fix for two problems on FreeBSD:

In test_poll1(), unregister file descriptors as they're closed,
    and also close the read end of the pipe
In test_poll2(), make the code assume less about the combinations of flag
    bits that will be returned
üst 78430b65
...@@ -57,7 +57,9 @@ def test_poll1(): ...@@ -57,7 +57,9 @@ def test_poll1():
buf = os.read(rd, MSG_LEN) buf = os.read(rd, MSG_LEN)
assert len(buf) == MSG_LEN assert len(buf) == MSG_LEN
print buf print buf
os.close(r2w[rd]) os.close(r2w[rd]) ; os.close( rd )
p.unregister( r2w[rd] )
p.unregister( rd )
writers.remove(r2w[rd]) writers.remove(r2w[rd])
poll_unit_tests() poll_unit_tests()
...@@ -145,13 +147,14 @@ def test_poll2(): ...@@ -145,13 +147,14 @@ def test_poll2():
fdlist = pollster.poll(tout) fdlist = pollster.poll(tout)
if (fdlist == []): if (fdlist == []):
continue continue
if fdlist[0] == (p.fileno(),select.POLLHUP): fd, flags = fdlist[0]
if flags & select.POLLHUP:
line = p.readline() line = p.readline()
if line != "": if line != "":
print 'error: pipe seems to be closed, but still returns data' print 'error: pipe seems to be closed, but still returns data'
continue continue
elif fdlist[0] == (p.fileno(),select.POLLIN): elif flags & select.POLLIN:
line = p.readline() line = p.readline()
if verbose: if verbose:
print `line` print `line`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment