[Python-Dev] tests failing on irix65
Flying Cougar Burnette
tommy@ilm.com
Wed, 21 Mar 2001 09:08:49 -0800 (PST)
Hey Thomas,
with these changes to test_pty.py I now get:
test_pty
The actual stdout doesn't match the expected stdout.
This much did match (between asterisk lines):
**********************************************************************
test_pty
**********************************************************************
Then ...
We expected (repr): 'I wish to buy a fish license.\nFor my pet fish, Eric.\n'
But instead we got: 'I wish to buy a fish license.\r\nFor my pet fish, Eric.\r\n'
test test_pty failed -- Writing: 'I wish to buy a fish license.\r\nFor my pet fish, Eric.\r\n', expected: 'I wish to buy a fish license.\nFor my pet fish, Eric.\n'
but when I import test.test_pty that blank line is gone. Sounds like
the test verification just needs to be a bit more flexible, maybe?
test_openpty passes without a problem, BTW.
Thomas Wouters writes:
| On Tue, Mar 20, 2001 at 11:37:00PM -0800, Flying Cougar Burnette wrote:
|
| > ------------%< snip %<----------------------%< snip %<------------
|
| > test_pty
| > The actual stdout doesn't match the expected stdout.
| > This much did match (between asterisk lines):
| > **********************************************************************
| > test_pty
| > **********************************************************************
| > Then ...
| > We expected (repr): 'I'
| > But instead we got: '\n'
| > test test_pty failed -- Writing: '\n', expected: 'I'
| >
| >
| > importing test_pty into an interactive interpreter gives this:
| >
| > Python 2.1b2 (#27, Mar 20 2001, 23:21:17) [C] on irix6
| > Type "copyright", "credits" or "license" for more information.
| > >>> import test.test_pty
| > Calling master_open()
| > Got master_fd '4', slave_name '/dev/ttyq6'
| > Calling slave_open('/dev/ttyq6')
| > Got slave_fd '5'
| > Writing to slave_fd
| >
| > I wish to buy a fish license.For my pet fish, Eric.
| > calling pty.fork()
| > Waiting for child (16654) to finish.
| > Child (16654) exited with status 1024.
| > >>>
|
| Hmm. This is probably my test that is a bit gaga. It tries to test the pty
| module, but since I can't find any guarantees on how pty's should work, it
| probably relies on platform-specific accidents. It does the following:
|
| ---
| TEST_STRING_1 = "I wish to buy a fish license."
| TEST_STRING_2 = "For my pet fish, Eric."
|
| [..]
|
| debug("Writing to slave_fd")
| os.write(slave_fd, TEST_STRING_1) # should check return value
| print os.read(master_fd, 1024)
|
| os.write(slave_fd, TEST_STRING_2[:5])
| os.write(slave_fd, TEST_STRING_2[5:])
| print os.read(master_fd, 1024)
| ---
|
| Apparently, irix buffers the first write somewhere. Can you test if the
| following works better:
|
| ---
| TEST_STRING_1 = "I wish to buy a fish license.\n"
| TEST_STRING_2 = "For my pet fish, Eric.\n"
|
| [..]
|
| debug("Writing to slave_fd")
| os.write(slave_fd, TEST_STRING_1) # should check return value
| sys.stdout.write(os.read(master_fd, 1024))
|
| os.write(slave_fd, TEST_STRING_2[:5])
| os.write(slave_fd, TEST_STRING_2[5:])
| sys.stdout.write(os.read(master_fd, 1024))
| ---
|
| (There should be no need to regenerate the output file, but if it still
| fails on the same spot, try running it in verbose and see if you still have
| the blank line after 'writing to slave_fd'.)
|
| Note that the pty module is working fine, it's just the test that is screwed
| up. Out of curiosity, is the test_openpty test working, or is it skipped ?
|
| I see I also need to fix some other stuff in there, but I'll wait with that
| until I hear that this works better :)
|
| --
| Thomas Wouters <thomas@xs4all.net>
|
| Hi! I'm a .signature virus! copy me into your .signature file to help me spread!