include "consts.9ps" # 9p protocol proc version(msize, version) { send(Tversion, notag, msize:u32, version:str) } proc attach(fid, afid, uname, aname) { send(Tattach, iota(), fid:u32, afid:u32, uname:str, aname:str) } proc walk(fid, newfid, ...) { send(Twalk, iota(), fid:u32, newfid:u32, vargs:u16, ...) } # useful functions proc mount(fid, path) { version(msize, np2000) m = recv() assert ( m.type == Rversion m.tag == notag m.msize == msize # m.version == version ) attach(fid, nofid, "op", path) m = recv() assert ( m.type == Rattach m.qid.type == QTDIR ) } proc expect-error() { m = recv() assert m.type == Rerror debug("got expected error", m) }