Blob


1 include "lib.9ps"
3 testing "if version works" {
4 send(Tversion, notag, msize, np2000)
5 m = recv()
6 assert m.type == Rversion
7 }
9 testing "that fails with an msize too small" {
10 send(Tversion, notag, 64:u32, np2000)
11 m = recv()
12 assert m.type == Rversion
14 # we can't check if the replied version is "unknown" because
15 # of a limitation of 9pscript... instead, we'll try to attach
16 # and expect a failure.
17 attach(0, nofid, "op", "/")
18 should-fail recv() : "the connection should have been closed"
19 }
21 testing "fails when sending a R-message" {
22 send(Rversion, notag, msize, np2000)
23 should-fail recv() : "the connection should have been closed"
24 }
26 testing "multiple attach" {
27 version(msize, np2000)
29 m = recv()
30 assert (
31 m.type == Rversion
32 m.tag == notag
33 m.msize <= msize
34 )
36 fid1 = 0
37 fid2 = 1
39 # attach the first fid
40 attach(fid1, nofid, "op", "/")
41 m = recv()
42 assert (
43 m.type == Rattach
44 m.qid.type == QTDIR
45 )
47 # attach the second fid
48 attach(fid2, nofid, "op", "/")
49 m = recv()
50 assert (
51 m.type == Rattach
52 m.qid.type == QTDIR
53 )
54 }
56 testing "don't close used qids" {
57 mount(0, "/")
59 walk(0, 2, "dir")
60 expect(Rwalk)
62 clunk(0)
63 expect(Rclunk)
65 walk(2, 3, "a-file")
66 expect(Rwalk)
68 clunk(2)
69 expect(Rclunk)
71 open(3, OREAD)
72 expect(Ropen)
73 }