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_file_lseek_past_end.py

Revision 5140, 0.7 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 
1import lind_test_server
2
3
4from lind_fs_constants import *
5
6# Try read / write of a file and see if it works...
7lind_test_server._blank_fs_init()
8
9myfd = lind_test_server.open_syscall('/foo',O_CREAT | O_EXCL | O_RDWR,S_IRWXA)
10
11# write should succeed
12assert(lind_test_server.write_syscall(myfd,'hello') == 5)
13
14# seek past the end
15assert(lind_test_server.lseek_syscall(myfd,10,SEEK_SET) == 10)
16
17# write should succeed again (past the end)
18assert(lind_test_server.write_syscall(myfd,'yoyoyo') == 6)
19
20# seek to the start
21assert(lind_test_server.lseek_syscall(myfd,0,SEEK_SET) == 0)
22
23# read 20 bytes but get 16 (hello\0\0\0\0\0yoyoyo)
24assert(lind_test_server.read_syscall(myfd,20)=='hello\0\0\0\0\0yoyoyo')
25
26lind_test_server.close_syscall(myfd)
Note: See TracBrowser for help on using the browser.