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 / aienux / allen / tests / scheduler.om

258 lines · 5061 bytes Raw Blame History
1note Native courier lifecycle regression. Clock values are injected milliseconds.
2text Lineone "SAY 1 1/1 Model text."
3note check writes through Outb; preserve the actual pending datagram around logging.
4global SavedOut uchar 8192
5fn test ok bool to void
6n = get Outlen 0
7e = get Err 0
8for i ulong n
9put SavedOut i get Outb i
10end
11check ok add get Checks 0 1
12for i ulong n
13put Outb i get SavedOut i
14end
15put Outlen 0 n
16put Err 0 e
17end
18fn tcopy to void
19put Inlen 0 get Outlen 0
20for i ulong get Outlen 0
21put In i get Outb i
22end
23end
24fn control kind ulong seq ulong to void
25put Inlen 0 0
26b = packet kind seq 0 0 0
27tcopy
28end
29fn linepkt part ulong to void
30put Inlen 0 len Lineone
31for i ulong len Lineone
32put In i get Lineone i
33end
34b = packet 2 get Q 1 part 0 0
35tcopy
36end
37fn jobinput to void
38put Inlen 0 1001
39for i ulong 1001
40put In i 120
41end
42put In 999 10
43put In 1000 121
44end
45fn main to int
46test qstart 42 100
47test not qready 100
48test not qnext 100 false
49test eq get T 3 0
50test qnext 100 true
51test eq get T 10 5
52test not qnext 100 true
53test qsent 100 false
54test eq get T 3 0
55test qnext 101 true
56test qsent 101 true
57test eq get T 3 1
58test not qnext 2100 true
59test qnext 2101 true
60test qsent 2101 true
61control 6 0
62test eq qincoming 2102 1
63test qready 2102
64test not qnext 12100 true
65test qnext 12101 true
66test eq get T 10 5
67test qsent 12101 true
68test qready 32101
69test not qready 32102
70test qnext 32102 true
71test qsent 32102 true
72test not qnext 32101 true
73test eq get T 0 32102
74jobinput
75test qsubmit 32103
76test eq get Q 1 1
77test eq get JobOut 999 32
78test eq get JobOut 1000 121
79test not qsubmit 32103
80test qnext 32103 true
81test eq get T 10 1
82test eq get T 11 1
83tcopy
84test pkparse
85test eq get N 6 1000
86test eq get In add get N 5 999 32
87test qsent 32103 false
88test eq get T 9 1
89test qnext 32104 true
90test eq get T 11 1
91test qsent 32104 true
92test qnext 32104 true
93test eq get T 11 2
94tcopy
95test pkparse
96test eq get N 6 1
97test eq get In get N 5 121
98test qsent 32104 true
99test eq get T 9 0
100control 6 0
101test eq qincoming 32105 1
102test qready 32105
103test not qnext 34103 true
104test qnext 34104 true
105test eq get T 10 1
106test eq get T 11 1
107test qsent 34104 true
108test qnext 34104 true
109test eq get T 11 2
110test qsent 34104 true
111control 4 2
112test eq qincoming 34105 0
113test eq get T 6 0
114control 4 1
115test eq qincoming 34105 1
116test eq get T 6 1
117test not qnext 36104 true
118linepkt 1
119test eq qincoming 36105 1
120test eq get Q 4 1
121test eq get T 13 1
122test qnext 36105 true
123test eq get T 10 3
124test qsent 36105 false
125test eq get T 13 1
126linepkt 1
127test eq qincoming 36106 2
128test eq get Q 4 1
129test qnext 36106 true
130test eq get T 10 3
131test qsent 36106 true
132test eq get T 13 0
133test qtake
134test eq get Inlen 0 len Lineone
135test not qtake
136linepkt 2
137test eq qincoming 36107 1
138linepkt 3
139test eq qincoming 36107 0
140test eq get Q 2 2
141test eq get Q 4 1
142test qnext 36108 true
143test qsent 36108 true
144linepkt 3
145test eq qincoming 36109 1
146test eq get Q 2 3
147qcancel
148test eq get T 5 0
149linepkt 4
150test eq qincoming 36110 0
151jobinput
152test qsubmit 36111
153test eq get Q 1 2
154test eq get Q 4 0
155control 6 0
156test eq qincoming 36112 1
157control 6 0
158put In 22 49
159test eq qincoming 36113 0
160test eq get T 2 36112
161control 4 2
162test eq qincoming 36110 0
163test eq get T 6 0
164qcancel
165put Q 1 4294967295
166jobinput
167test not qsubmit 36114
168test eq get Q 1 4294967295
169test not qstart 0 36114
170test eq get Q 0 42
171test qstart 43 0
172put Inlen 0 4097
173test not qsubmit 0
174test eq get Q 1 0
175put Inlen 0 0
176test not qsubmit 0
177test not qsent 0 true
178note Maximum payload crosses all five datagrams, preserving every byte except CR/LF.
179put Inlen 0 4096
180for i ulong 4096
181put In i uchar rem i 251
182end
183test qsubmit 0
184test qnext 0 true
185test eq get T 10 5
186test qsent 0 true
187for k ulong 5
188test qnext 0 true
189test eq get T 10 1
190tcopy
191test pkparse
192test eq get N 1 1
193test eq get N 2 add k 1
194test eq get N 3 5
195test eq get N 4 4096
196size = ulong 1000
197if eq k 4
198size = ulong 96
199end
200test eq get N 6 size
201bad = ulong 0
202for j ulong size
203want = uchar rem add mul k 1000 j 251
204if or eq want 10 eq want 13
205want = uchar 32
206end
207if ne get In add get N 5 j want
208bad = add bad 1
209end
210end
211test eq bad 0
212test qsent 0 true
213end
214note A first LINE also stops job retries without a preceding ACK.
215linepkt 1
216test eq qincoming 1 1
217test eq get T 6 1
218test qnext 1 true
219test eq get T 10 3
220test qsent 1 true
221control 6 0
222test eq qincoming 2 1
223test not qnext 2000 true
224note Fill the eight-line queue; no GOT until a ninth line can actually be kept.
225for k ulong 7
226linepkt add k 2
227test eq qincoming add k 2003 1
228test qnext add k 2003 true
229test eq get T 10 3
230test qsent add k 2003 true
231end
232linepkt 9
233test eq qincoming 2010 0
234test eq get Q 2 8
235test eq get T 13 0
236test qtake
237linepkt 9
238test eq qincoming 2011 1
239test eq get Q 2 9
240test qnext 2011 true
241test not qsent 2010 true
242test eq get T 10 3
243test qsent 2011 true
244note Malformed ACK and wrong kinds cannot advance the accepted clock.
245put Inlen 0 0
246b = packet 4 1 1 0 0
247tcopy
248test eq qincoming 2012 0
249test eq get T 0 2011
250control 5 0
251test eq qincoming 2012 0
252test eq get T 0 2011
253qcancel
254control 4 1
255test eq qincoming 2013 0
256test eq get Q 4 0
257ret int get Fails 0
258end