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

Revision 5140, 0.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 
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 there!') == 12)
13
14# seek to the beginning...
15assert(lind_test_server.lseek_syscall(myfd,0,SEEK_SET) == 0)
16
17# read the first 5 bytes (hello)
18assert(lind_test_server.read_syscall(myfd,5)=='hello')
19
20# change it to hello world!
21assert(lind_test_server.write_syscall(myfd,' world')==6)
22
23# seek to the beginning again...
24assert(lind_test_server.lseek_syscall(myfd,0,SEEK_SET) == 0)
25
26# and read it all...
27assert(lind_test_server.read_syscall(myfd,100) == 'hello world!')
28
29lind_test_server.close_syscall(myfd)
Note: See TracBrowser for help on using the browser.