return self.SEC_SIZE try: bdev = RAMFS(50) bdev2 = RAMFS(50) except MemoryError: print("SKIP") raise SystemExit # first we umount any existing mount points the target may have try: uos.umount('/') except OSError: pass for path in uos.listdir('/'): uos.umount('/' + path) uos.VfsFat.mkfs(bdev) uos.mount(bdev, '/') print(uos.getcwd()) f = open('test.txt', 'w') f.write('hello') f.close() print(uos.listdir()) print(uos.listdir('/')) print(uos.stat('')[:-3]) print(uos.stat('/')[:-3])
def rename(self, old_path, new_path): print(self.id, 'rename', old_path, new_path) def rmdir(self, path): print(self.id, 'rmdir', path) def stat(self, path): print(self.id, 'stat', path) return (self.id,) def statvfs(self, path): print(self.id, 'statvfs', path) return (self.id,) def open(self, file, mode): print(self.id, 'open', file, mode) # first we umount any existing mount points the target may have for path in uos.listdir('/'): uos.umount('/' + path) # stat root dir print(uos.stat('/')) # getcwd when in root dir print(uos.getcwd()) # basic mounting and listdir uos.mount(Filesystem(1), '/test_mnt') print(uos.listdir()) # referencing the mount point in different ways print(uos.listdir('test_mnt')) print(uos.listdir('/test_mnt'))
def mount(self, readonly, mkfs): print(self.id, 'mount', readonly, mkfs) def umount(self): print(self.id, 'umount') def listdir(self, dir): print(self.id, 'listdir', dir) return ['a%d' % self.id] def chdir(self, dir): print(self.id, 'chdir', dir) def open(self, file, mode): print(self.id, 'open', file, mode) # basic mounting and listdir uos.mount(Filesystem(1), '/test_mnt') print(uos.listdir()) # referencing the mount point in different ways print(uos.listdir('test_mnt')) print(uos.listdir('/test_mnt')) # mounting another filesystem uos.mount(Filesystem(2), '/test_mnt2', readonly=True) print(uos.listdir()) print(uos.listdir('/test_mnt2')) # chdir uos.chdir('test_mnt') print(uos.listdir()) # open
return (self.id, ) def statvfs(self, path): print(self.id, 'statvfs', path) return (self.id, ) def open(self, file, mode): print(self.id, 'open', file, mode) # first we umount any existing mount points the target may have try: uos.umount('/') except OSError: pass for path in uos.listdir('/'): uos.umount('/' + path) # stat root dir print(uos.stat('/')) # getcwd when in root dir print(uos.getcwd()) # basic mounting and listdir uos.mount(Filesystem(1), '/test_mnt') print(uos.listdir()) # ilistdir i = uos.ilistdir() print(next(i))
bdev = RAMFS(50) bdev2 = RAMFS(50) except MemoryError: print("SKIP") sys.exit() uos.VfsFat.mkfs(bdev) uos.mount(bdev, '/') print(uos.getcwd()) f = open('test.txt', 'w') f.write('hello') f.close() print(uos.listdir()) print(uos.listdir('/')) print(uos.stat('')[:-3]) print(uos.stat('/')[:-3]) print(uos.stat('test.txt')[:-3]) print(uos.stat('/test.txt')[:-3]) f = open('/test.txt') print(f.read()) f.close() uos.rename('test.txt', 'test2.txt') print(uos.listdir()) uos.rename('test2.txt', '/test3.txt') print(uos.listdir()) uos.rename('/test3.txt', 'test4.txt')