def access(self, path, mode): log("access", path, hex(mode)) try: ret = lind.access_syscall(path, mode) except lind.SyscallError, e: ret = -errno[e[1]]
from lind_fs_constants import * import lind_test_server # Let's add a few directories to the system and see if it works... lind_test_server._blank_fs_init() lind_test_server.mkdir_syscall('/bar',S_IRWXA) lind_test_server.mkdir_syscall('/bar/baz',S_IRWXA) lind_test_server.mkdir_syscall('/bar/baz/yaargh',0) lind_test_server.access_syscall('bar',F_OK) # go to bar and look for baz... lind_test_server.chdir_syscall('bar') lind_test_server.access_syscall('baz',F_OK) # go to back up and look bar... lind_test_server.chdir_syscall('..') lind_test_server.access_syscall('bar',F_OK) # go to the yaargh dir lind_test_server.chdir_syscall('/bar/baz/yaargh') lind_test_server.access_syscall('../../baz',F_OK)
import lind_test_server from lind_fs_constants import * # Let's add a few directories to the system and see if it works... lind_test_server._blank_fs_init() lind_test_server.mkdir_syscall('/bar',S_IRWXA) lind_test_server.mkdir_syscall('/bar/baz',S_IRWXA) lind_test_server.access_syscall('/bar/baz',F_OK) # should not be able try: lind_test_server.rmdir_syscall('/bar') except: pass else: print 'could remove directory with items inside!!!' lind_test_server.rmdir_syscall('/bar/baz') try: lind_test_server.access_syscall('/bar/baz',F_OK) except: pass else: print 'error! Directory exists after removal'
import lind_test_server from lind_fs_constants import * # Let's add a few directories to the system and see if it works... lind_test_server._blank_fs_init() lind_test_server.mkdir_syscall('/bar', S_IRWXA) lind_test_server.mkdir_syscall('/bar/baz', S_IRWXA) lind_test_server.access_syscall('/bar/baz', F_OK) # should not be able try: lind_test_server.rmdir_syscall('/bar') except: pass else: print 'could remove directory with items inside!!!' lind_test_server.rmdir_syscall('/bar/baz') try: lind_test_server.access_syscall('/bar/baz', F_OK) except: pass else: print 'error! Directory exists after removal'
import lind_test_server from lind_fs_constants import * lind_test_server._blank_fs_init() # / should exist. lind_test_server.access_syscall("/", F_OK) # / should be read / executable by other lind_test_server.access_syscall("/", X_OK | R_OK) stat_result = lind_test_server.stat_syscall("/") # ensure there are 2 hard links to the root of an empty fs assert stat_result[3] == 2 # ensure there is no associated size assert stat_result[7] == 0