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 / irqcheck.om

106 lines · 2752 bytes Raw Blame History
1note Exact compile refusal conductor; follows vfiocheck's native fork/exec convention.
2text infile "case.om"
3text outfile "case.elf"
4text errfile "case.err"
5text passed "PASS 10 typed IRQ and eventfd compiler refusals\n"
6text a "fn main to int\nr = eventfd int 0\nret 0\nend\n"
7text b "fn test to long\nret eventfd uint 0\nend\n"
8text c "global a uchar 32\nfn main to int\nr = vfioirq int 1 uint 15215 a 0 16\nret 0\nend\n"
9text d "global a uchar 32\nfn main to int\nq = uint 15213\nr = vfioirq int 1 q a 0 16\nret 0\nend\n"
10text e "global a uint 32\nfn main to int\nr = vfioirq int 1 uint 15213 a 0 16\nret 0\nend\n"
11text f "text a \"readonly buffer!\"\nfn main to int\nr = vfioirq int 1 uint 15213 a 0 16\nret 0\nend\n"
12text g "global a uchar 32\nfn main to int\nr = vfioirq long 1 uint 15213 a 0 16\nret 0\nend\n"
13text h "global a uchar 32\nfn main to int\nr = vfioirq int 1 ulong 15213 a 0 16\nret 0\nend\n"
14text j "fn test a edit uchar 32 to long\nret vfioirq int 1 uint 15213 a 0 16\nend\n"
15text k "om2\nfn main to int\nrequires eq eventfd uint 0 0\nret 0\nend\n"
16global packet uchar 4096
17global status uchar 4
18fn expect yes bool to void
19if not yes
20exit int 80
21end
22end
23fn source num int fd int to int
24r = long 0
25want = int 7
26if eq num 0
27r = write fd a 0 len a
28end
29if eq num 1
30r = write fd b 0 len b
31want = 9
32end
33if eq num 2
34r = write fd c 0 len c
35want = 9
36end
37if eq num 3
38r = write fd d 0 len d
39want = 9
40end
41if eq num 4
42r = write fd e 0 len e
43end
44if eq num 5
45r = write fd f 0 len f
46want = 20
47end
48if eq num 6
49r = write fd g 0 len g
50end
51if eq num 7
52r = write fd h 0 len h
53end
54if eq num 8
55r = write fd j 0 len j
56want = 9
57end
58if eq num 9
59r = write fd k 0 len k
60want = 30
61end
62expect gt r 0
63ret want
64end
65fn main to int
66expect eq argcnt 2
67size = argread 1 packet 4 4092
68expect and gt size 0 le size 4092
69put packet 0 1
70put packet 2 uchar and size 255
71put packet 3 uchar shr size 8
72for num int 10
73input = fopen infile 0 len infile 524482 384
74output = fopen outfile 0 len outfile 524482 384
75errors = fopen errfile 0 len errfile 524482 384
76expect ge input 0
77expect ge output 0
78expect ge errors 0
79want = source num int input
80expect eq fseek int input 0 0 0
81pid = fork
82expect ge pid 0
83if eq pid 0
84expect eq dupfd int input 0 0 0
85expect eq dupfd int output 1 0 1
86expect eq dupfd int errors 2 0 2
87r = execprog packet 0 add ulong size 4
88exit int 81
89end
90expect eq waitpid int pid status 0 4 0 pid
91if ne get status 0 0
92ret add num 1
93end
94if ne get status 1 uchar want
95ret add num 1
96end
97expect eq fclose int input 0
98expect eq fclose int output 0
99expect eq fclose int errors 0
100expect eq unlink infile 0 len infile 0
101expect eq unlink outfile 0 len outfile 0
102expect eq unlink errfile 0 len errfile 0
103end
104expect eq write 1 passed 0 len passed long len passed
105ret 0
106end