Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omnet/blob/main/om/store/test/driver.om # omnet aien-dev/omnet Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omnet / om / store / test / driver.om` 199 lines ยท 3235 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 fn testresult code int to int 3 b = new uchar 65536 0 4 put b 0 uchar code 5 r = write int 1 b ulong 0 ulong 1 6 ret 0 7 end 8 fn testfinish code int to int 9 r = stclose 10 ret testresult code 11 end 12 fn testcapacity b edit uchar 65536 mode uchar to int 13 note Capacity is charged as checked quantities. These two modes pin the guard 14 note against a wrapped running charge; the states they set are test-image only. 15 if eq mode uchar 89 16 put stctx 6 long -8 17 if ne stwrite b 16 1 18 ret testfinish 4 19 end 20 ret testfinish 0 21 end 22 if eq mode uchar 66 23 put stctx 7 long -1 24 if ne stwrite b 1 1 25 ret testfinish 4 26 end 27 ret testfinish 0 28 end 29 if eq mode uchar 85 30 if ne stwrite b 65537 1 31 ret testfinish 4 32 end 33 if ne stcommit 1 34 ret testfinish 4 35 end 36 ret testfinish stabort 37 end 38 count = ulong 512 39 size = ulong 65536 40 if eq mode uchar 81 41 count = ulong 65536 42 size = ulong 1 43 end 44 for i ulong count 45 if ne stwrite b size 0 46 ret testfinish 4 47 end 48 end 49 if ne mode uchar 71 50 if ne stwrite b 1 1 51 ret testfinish 4 52 end 53 if ne stcommit 1 54 ret testfinish 4 55 end 56 ret testfinish stabort 57 end 58 if ne stcommit 0 59 ret testfinish 4 60 end 61 if ne stload 0 62 ret testfinish 4 63 end 64 for i ulong count 65 if ne stread b long size 66 ret testfinish 4 67 end 68 end 69 if ne stread b long 0 70 ret testfinish 4 71 end 72 ret testfinish 0 73 end 74 fn main to int 75 p = new uchar 65536 0 76 m = new uchar 65536 0 77 b = new uchar 65536 0 78 n = argread ulong 1 p ulong 0 ulong 65536 79 v = argread ulong 2 m ulong 0 ulong 65536 80 mode = get m 0 81 seed = uchar 17 82 if gt argcnt long 3 83 v = argread ulong 3 b ulong 0 ulong 65536 84 seed = get b 0 85 end 86 init = int 0 87 if eq mode uchar 73 88 init = int 1 89 end 90 if eq mode uchar 69 91 init = int 1 92 end 93 if lt n long 0 94 ret testresult 1 95 end 96 r = stopen p ulong n init 97 if ne r 0 98 ret testresult r 99 end 100 if eq init 1 101 if ne stpass 64 65 1 102 ret testfinish 4 103 end 104 end 105 if eq mode uchar 72 106 put b 0 9 107 v = write int 1 b ulong 0 ulong 1 108 v = read int 0 b ulong 0 ulong 1 109 ret testfinish 0 110 end 111 if eq mode uchar 76 112 r = stload 113 if ne r 0 114 ret testfinish r 115 end 116 v = stread b 117 if ne v long 65536 118 ret testfinish 3 119 end 120 for i ulong 65536 121 if ne get b i uchar and add ulong seed i 255 122 ret testfinish 3 123 end 124 end 125 v = stread b 126 if ne v long 17 127 ret testfinish 3 128 end 129 for i ulong 17 130 if ne get b i seed 131 ret testfinish 3 132 end 133 end 134 if ne stread b long 0 135 ret testfinish 3 136 end 137 ret testfinish 0 138 end 139 note TEST_ARM 140 r = stbegin 141 if ne r 0 142 ret testfinish r 143 end 144 if ne stpass 64 65 1 145 ret testfinish 4 146 end 147 if or eq mode uchar 71 eq mode uchar 67 148 ret testcapacity b mode 149 end 150 if or eq mode uchar 81 eq mode uchar 85 151 ret testcapacity b mode 152 end 153 if or eq mode uchar 89 eq mode uchar 66 154 ret testcapacity b mode 155 end 156 if ne mode uchar 69 157 for i ulong 65536 158 put b i uchar and add ulong seed i 255 159 end 160 r = stwrite b 65536 161 if ne r 0 162 ret testfinish r 163 end 164 for i ulong 17 165 put b i seed 166 end 167 r = stwrite b 17 168 if ne r 0 169 ret testfinish r 170 end 171 end 172 if eq mode uchar 75 173 put b 0 9 174 v = write int 1 b ulong 0 ulong 1 175 v = read int 0 b ulong 0 ulong 1 176 ret testfinish 0 177 end 178 if eq mode uchar 65 179 r = stabort 180 ret testfinish r 181 end 182 r = stcommit 183 if eq r 2 184 note Verify a poisoned store cannot mutate, recover or pretend to abort. 185 if ne stbegin 1 186 ret testfinish 4 187 end 188 if ne stload 1 189 ret testfinish 4 190 end 191 if ne stabort 1 192 ret testfinish 4 193 end 194 if ne stpass 64 65 1 195 ret testfinish 4 196 end 197 end 198 ret testfinish r 199 end