include "lib.9ps" testing "if version works" { send(Tversion, notag, msize, np2000) m = recv() assert m.type == Rversion } testing "that fails with an msize too small" { send(Tversion, notag, 64:u32, np2000) m = recv() assert m.type == Rversion # we can't check if the replied version is "unknown" because # of a limitation of 9pscript... instead, we'll try to attach # and expect a failure. attach(0, nofid, "op", "/") should-fail recv() : "the connection should have been closed" } testing "fails when sending a R-message" { send(Rversion, notag, msize, np2000) should-fail recv() : "the connection should have been closed" } testing "multiple attach" { version(msize, np2000) m = recv() assert ( m.type == Rversion m.tag == notag m.msize <= msize ) fid1 = 0 fid2 = 1 # attach the first fid attach(fid1, nofid, "op", "/") m = recv() assert ( m.type == Rattach m.qid.type == QTDIR ) # attach the second fid attach(fid2, nofid, "op", "/") m = recv() assert ( m.type == Rattach m.qid.type == QTDIR ) } testing "don't close used qids" { mount(0, "/") walk(0, 2, "dir") expect(Rwalk) clunk(0) expect(Rclunk) walk(2, 3, "a-file") expect(Rwalk) clunk(2) expect(Rclunk) open(3, OREAD) expect(Ropen) }