interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / seed / host / tests / memcheck.om

226 lines · 6428 bytes Raw Blame History
1note Native compiler refusal driver. argv[1] names the exact compiler under test.
2text infile "case.om"
3text outfile "case.elf"
4text errfile "case.err"
5text passed "PASS 36 device/mapping compiler refusals\n"
6text a "global b uint 4\nfn main to int\nr = devctl int 0 uint 21531 b 0 4\nret 0\nend\n"
7text b "global b uchar 4\nfn main to int\nq = uint 21531\nr = devctl int 0 q b 0 4\nret 0\nend\n"
8text c "global b uchar 4\nfn main to int\nr = devctl int 0 uint 1 b 0 4\nret 0\nend\n"
9text d "text b \"four\"\nfn main to int\nr = devctl int 0 uint 21531 b 0 4\nret 0\nend\n"
10text e "global b uchar 4\nfn main to int\nr = devctl long 0 uint 21531 b 0 4\nret 0\nend\n"
11text f "global b uchar 4\nfn main to int\nr = devctl int 0 ulong 21531 b 0 4\nret 0\nend\n"
12text g "fn main to int\nr = mapnew neg int 1 0 4096 7 34\nret 0\nend\n"
13text h "fn main to int\nr = mapnew neg int 1 0 4096 3 50\nret 0\nend\n"
14text j "fn main to int\nm = int 34\nr = mapnew neg int 1 0 4096 3 m\nret 0\nend\n"
15text k "fn main to int\na = int 3\nr = mapnew neg int 1 0 4096 a 34\nret 0\nend\n"
16text m "fn main to int\nr = mapdrop ulong 257\nret 0\nend\n"
17text n "text a \"four\"\nfn main to int\nr = mapread long 257 0 a 0 4\nret 0\nend\n"
18text p "global a uint 4\nfn main to int\nr = mapwrite long 257 0 a 0 4\nret 0\nend\n"
19text q "fn test to long\nret mapnew neg int 1 0 4096 3 34\nend\n"
20text s "global b uchar 4\nfn main to int\nr = devctl int 0 uint 3221243393 b 0 4\nret 0\nend\n"
21text t "fn main to int\nr = mapnew long 0 0 4096 1 2\nret 0\nend\n"
22text u "global a uchar 32\nglobal b uchar 32\nfn main to int\nr = devcall neg int 1 uint 21531 a 0 32 b 0 32\nret 0\nend\n"
23text v "global a uchar 32\nglobal b uchar 32\nfn main to int\nq = uint 3223340587\nr = devcall neg int 1 q a 0 32 b 0 32\nret 0\nend\n"
24text w "global a uchar 32\nfn main to int\nr = devcall neg int 1 uint 3223340587 a 0 32 a 0 32\nret 0\nend\n"
25text x "text a \"readonly\"\nglobal b uchar 32\nfn main to int\nr = devcall neg int 1 uint 3223340587 a 0 32 b 0 32\nret 0\nend\n"
26text y "global a uchar 32\ntext b \"readonly\"\nfn main to int\nr = devcall neg int 1 uint 3223340587 a 0 32 b 0 8\nret 0\nend\n"
27text z "global a uchar 32\nglobal b uint 32\nfn main to int\nr = devcall neg int 1 uint 3223340587 a 0 32 b 0 32\nret 0\nend\n"
28text aa "global a uchar 32\nfn main to int\nr = uvmctl neg int 1 uint 1 a 0 32\nret 0\nend\n"
29text ab "global a uchar 32\nfn main to int\nq = uint 25\nr = uvmctl neg int 1 q a 0 32\nret 0\nend\n"
30text ac "text a \"readonly\"\nfn main to int\nr = uvmctl neg int 1 uint 75 a 0 8\nret 0\nend\n"
31text ad "global a uint 32\nfn main to int\nr = uvmctl neg int 1 uint 25 a 0 32\nret 0\nend\n"
32text ae "fn test a edit uchar 32 b edit uchar 32 to long\nret devcall neg int 1 uint 3223340587 a 0 32 b 0 32\nend\n"
33text af "fn test a edit uchar 32 to long\nret uvmctl neg int 1 uint 25 a 0 32\nend\n"
34text ag "fn main to int\nr = mapget long 257 0 2\nret 0\nend\n"
35text ah "fn main to int\nw = int 4\nr = mapset long 257 0 w 0\nret 0\nend\n"
36text aj "fn main to int\nr = mapaddr ulong 257\nret 0\nend\n"
37text ak "fn main to int\nr = maphold long 68719476736 4096\nret 0\nend\n"
38text am "fn main to int\nr = mapbind long 257 int 3 0 7\nret 0\nend\n"
39text an "fn main to int\nr = mapbind long 257 long 3 0 3\nret 0\nend\n"
40text ap "fn test to ulong\nret mapaddr long 257\nend\n"
41text aq "fn test to long\nret maphold 68719476736 4096\nend\n"
42global packet uchar 4096
43global status uchar 4
44global tmp uchar 1
45fn expect yes bool to void
46if not yes
47exit int 80
48end
49end
50fn source num int fd int to int
51r = long 0
52want = int 9
53if eq num 0
54r = write fd a 0 len a
55want = 7
56end
57if eq num 1
58r = write fd b 0 len b
59end
60if eq num 2
61r = write fd c 0 len c
62end
63if eq num 3
64r = write fd d 0 len d
65want = 20
66end
67if eq num 4
68r = write fd e 0 len e
69want = 7
70end
71if eq num 5
72r = write fd f 0 len f
73want = 7
74end
75if eq num 6
76r = write fd g 0 len g
77end
78if eq num 7
79r = write fd h 0 len h
80end
81if eq num 8
82r = write fd j 0 len j
83end
84if eq num 9
85r = write fd k 0 len k
86end
87if eq num 10
88r = write fd m 0 len m
89want = 7
90end
91if eq num 11
92r = write fd n 0 len n
93want = 20
94end
95if eq num 12
96r = write fd p 0 len p
97want = 7
98end
99if eq num 13
100r = write fd q 0 len q
101end
102if eq num 14
103r = write fd s 0 len s
104end
105if eq num 15
106r = write fd t 0 len t
107want = 7
108end
109if eq num 16
110r = write fd u 0 len u
111end
112if eq num 17
113r = write fd v 0 len v
114end
115if eq num 18
116r = write fd w 0 len w
117want = 19
118end
119if eq num 19
120r = write fd x 0 len x
121want = 20
122end
123if eq num 20
124r = write fd y 0 len y
125want = 20
126end
127if eq num 21
128r = write fd z 0 len z
129want = 7
130end
131if eq num 22
132r = write fd aa 0 len aa
133end
134if eq num 23
135r = write fd ab 0 len ab
136end
137if eq num 24
138r = write fd ac 0 len ac
139want = 20
140end
141if eq num 25
142r = write fd ad 0 len ad
143want = 7
144end
145if eq num 26
146r = write fd ae 0 len ae
147end
148if eq num 27
149r = write fd af 0 len af
150end
151if eq num 28
152r = write fd ag 0 len ag
153end
154if eq num 29
155r = write fd ah 0 len ah
156end
157if eq num 30
158r = write fd aj 0 len aj
159want = 7
160end
161if eq num 31
162r = write fd ak 0 len ak
163want = 7
164end
165if eq num 32
166r = write fd am 0 len am
167end
168if eq num 33
169r = write fd an 0 len an
170want = 7
171end
172if eq num 34
173r = write fd ap 0 len ap
174end
175if eq num 35
176r = write fd aq 0 len aq
177end
178expect gt r 0
179ret want
180end
181fn main to int
182expect eq argcnt 2
183size = argread 1 packet 4 4092
184expect and gt size 0 le size 4092
185put packet 0 1
186put packet 2 uchar and size 255
187put packet 3 uchar shr size 8
188for num int 36
189input = fopen infile 0 len infile 524482 384
190output = fopen outfile 0 len outfile 524482 384
191errors = fopen errfile 0 len errfile 524482 384
192expect ge input 0
193expect ge output 0
194expect ge errors 0
195want = source num int input
196expect eq fseek int input 0 0 0
197pid = fork
198expect ge pid 0
199if eq pid 0
200expect eq dupfd int input 0 0 0
201expect eq dupfd int output 1 0 1
202expect eq dupfd int errors 2 0 2
203r = execprog packet 0 add ulong size 4
204exit int 81
205end
206expect eq waitpid int pid status 0 4 0 pid
207if ne get status 0 0
208ret add num 1
209end
210if ne get status 1 uchar want
211ret add num 1
212end
213expect eq fseek int output 0 0 0
214expect eq read int output tmp 0 1 0
215expect eq fseek int errors 0 0 0
216expect eq read int errors tmp 0 1 1
217expect eq fclose int input 0
218expect eq fclose int output 0
219expect eq fclose int errors 0
220expect eq unlink infile 0 len infile 0
221expect eq unlink outfile 0 len outfile 0
222expect eq unlink errfile 0 len errfile 0
223end
224expect eq write 1 passed 0 len passed long len passed
225ret 0
226end