interplane.Get Omega
Read in your language

CUDApp

CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.

Brought by drakestapleton

branch main Branches Tags History

CUDApp / tests / host-trace / badfrag.om

132 lines · 2350 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note badfrag GOOD.otr PREFIX: writes PREFIX.N.otr for N = 0..12, each the good OTR1 file with one
3note fault. omtrace v must reject mutant N with exit status listed in tests/host-trace/run-host-trace.sh.
4note Mutants: 0 magic, 1 version, 2 record size, 3 clock domain, 4 truncated by one byte,
5note 5 name count above 256, 6 record 0 kind 12, 7 record 0 flags 2, 8 record 0 ends before it starts,
6note 9 a space in the first name, 10 record 0 names id 9999, 11 header open-span count 1,
7note 12 record 2 (an instant) has a duration. Record 2 must be an instant in the input.
8global img uchar 262144
9global work uchar 262144
10global path uchar 4096
11global st ulong 4
12note st: 0 image bytes, 1 prefix bytes
13fn putle at ulong v ulong k ulong to void
14for i ulong k
15put work add at i uchar and shr v mul i 8 255
16end
17end
18fn rd at ulong k ulong to ulong
19v = ulong 0
20for i ulong k
21v = or v shl ulong get img add at i mul i 8
22end
23ret v
24end
25fn fresh to void
26for i ulong get st 0
27put work i get img i
28end
29end
30fn namepos to ulong
31ret add 64 mul rd 8 4 48
32end
33fn mutate m ulong to ulong
34note returns the mutant's length
35n = get st 0
36fresh
37if eq m 0
38put work 0 xor get img 0 1
39end
40if eq m 1
41putle 4 2 2
42end
43if eq m 2
44putle 6 40 2
45end
46if eq m 3
47putle 20 2 4
48end
49if eq m 4
50n = sub n 1
51end
52if eq m 5
53putle 44 300 4
54end
55if eq m 6
56putle 64 12 2
57end
58if eq m 7
59putle 66 2 2
60end
61if eq m 8
62putle 80 0 8
63end
64if eq m 9
65put work add namepos 6 32
66end
67if eq m 10
68putle 68 9999 4
69end
70if eq m 11
71putle 48 1 4
72end
73if eq m 12
74r = ulong 160
75putle add r 16 add rd add r 8 8 1 8
76end
77ret n
78end
79fn save m ulong n ulong to bool
80p = get st 1
81put path p 46
82d = p
83if ge m 10
84put path add p 1 49
85d = add p 1
86end
87put path add d 1 uchar add 48 rem m 10
88put path add d 2 46
89put path add d 3 111
90put path add d 4 116
91put path add d 5 114
92fd = fopen path 0 add d 6 577 384
93if lt fd 0
94ret false
95end
96w = write int fd work 0 n
97c = fclose int fd
98ret eq w long n
99end
100fn main to int
101if ne argcnt 3
102ret 2
103end
104k = argread 1 path 0 4095
105if le k 0
106ret 2
107end
108fd = fopen path 0 ulong k 0 0
109if lt fd 0
110ret 2
111end
112r = read int fd img 0 len img
113c = fclose int fd
114if lt r 64
115ret 2
116end
117put st 0 ulong r
118if ne rd 160 2 5
119ret 3
120end
121p = argread 2 path 0 4000
122if le p 0
123ret 2
124end
125put st 1 ulong p
126for m ulong 13
127if not save m mutate m
128ret 4
129end
130end
131ret 0
132end