diff options
Diffstat (limited to 'test/ninep.py')
| -rw-r--r-- | test/ninep.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ninep.py b/test/ninep.py index 6c625951..ac4e146b 100644 --- a/test/ninep.py +++ b/test/ninep.py @@ -97,6 +97,25 @@ class Client: def close(self, fid): self.rpc(120, struct.pack('<I', fid)) + def create(self, path, name, perm=0o777, mode=0): + """Tcreate `name` in the directory `path`; returns the new qid.""" + fid = self.walk(path) + try: + reply = self.rpc(114, struct.pack('<I', fid) + string(name) + + struct.pack('<IB', perm, mode)) + if len(reply) != 17: + raise OSError('invalid create reply') + return reply[:13] + finally: + self.close(fid) + + def mkdir(self, path, name): + return self.create(path, name, 0x80000000 | 0o777) + + def remove(self, path): + """Tremove, which clunks the fid whether or not it succeeds.""" + self.rpc(122, struct.pack('<I', self.walk(path))) + def read_fid(self, fid, offset=0, count=None): count = min(count if count is not None else self.msize - 11, self.msize - 11) reply = self.rpc(116, struct.pack('<IQI', fid, offset, count)) |
