Please note that the CVS and issue trackers have moved to GitHub. These Trac pages are no longer kept up-to-date.

root/seattle/branches/nacl_repy/seattlelib/tests/ut_lind_fs_broken_close.py

Revision 5140, 1.8 KB (checked in by justinc, 6 years ago)

removed circular imports and created a new Python testing mechanism called
lind_test_server. This removes the need for wrappers, etc.

Line 
1"""
2
3This test irritates a bug which causes the inode table to get
4mucked up.  After a socket operations, a regular file close
5will through an unexpected exception:
6
7Traceback (most recent call last):
8  File "ut_lind_fs_broken_close.py", line 52, in <module>
9    lind_test_server.close_syscall(myfd)
10  File "/home/lind/tmp/lind/repy/wrapped_lind_test_server.py", line 1370, in close_syscall
11    return _close_helper(fd)
12  File "/home/lind/tmp/lind/repy/wrapped_lind_test_server.py", line 1333, in _close_helper
13    fdsforinode = _lookup_fds_by_inode(inode)
14  File "/home/lind/tmp/lind/repy/wrapped_lind_test_server.py", line 1307, in _lookup_fds_by_inode
15    if filedescriptortable[fd]['inode'] == inode:
16KeyError: 'inode'
17
18
19"""
20
21
22from lind_fs_constants import *
23
24from emulmisc import exitall
25
26from time import sleep
27
28from lind_net_constants import *
29
30import lind_test_server
31
32SyscallError = lind_test_server.SyscallError
33
34# Try read / write of a file and see if it works...
35lind_test_server._blank_fs_init()
36
37myfd = lind_test_server.open_syscall('/foo', O_CREAT | O_EXCL | O_RDWR, S_IRWXA)
38
39
40
41# write should succeed
42assert(lind_test_server.write_syscall(myfd, 'hello there!') == 12)
43
44lind_test_server.close_syscall(myfd)
45
46# Now, re open the file
47
48myfd = lind_test_server.open_syscall('/foo', O_RDWR, S_IRWXA)
49
50lind_test_server.close_syscall(myfd)
51
52
53# let's do a few basic things with connect.   This will be UDP only for now...
54
55sockfd = lind_test_server.socket_syscall(AF_INET, SOCK_STREAM, 0)
56
57
58# bind will not be interesting...
59assert lind_test_server.bind_syscall(sockfd, '10.0.0.1', 50102) == 0
60try:
61    lind_test_server.setshutdown_syscall(sockfd, SHUT_RD)
62except:
63    pass
64
65myfd = lind_test_server.open_syscall('/foo', O_RDWR, S_IRWXA)
66lind_test_server.close_syscall(myfd)
67
68myfd = lind_test_server.open_syscall('/foo', O_RDWR, S_IRWXA)
69
70lind_test_server.close_syscall(myfd)
Note: See TracBrowser for help on using the browser.