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
omega-mv / si / architecture / tools / zero-legacy / fixtures / io-errors.om
| 1 | note Test-only driver appended to closure.om after renaming its main. |
| 2 | note The generated test copy injects a bad directory fd only after one successful batch. |
| 3 | note No production fault switch or foreign implementation is introduced. |
| 4 | |
| 5 | fn main to int |
| 6 | if lt argcnt 3 |
| 7 | ret 64 |
| 8 | end |
| 9 | n = argread 1 path 0 4095 |
| 10 | if lt n 1 |
| 11 | ret 64 |
| 12 | end |
| 13 | put plen 0 ulong n |
| 14 | put rootl 0 ulong n |
| 15 | rootn = ulong n |
| 16 | n = argread 2 name 0 255 |
| 17 | if lt n 1 |
| 18 | ret 64 |
| 19 | end |
| 20 | if eq get name 0 114 |
| 21 | note Establish the error is read failure, not an unopened fixture. |
| 22 | fd = fopen path 0 get plen 0 0 0 |
| 23 | if lt fd 0 |
| 24 | ret 13 |
| 25 | end |
| 26 | r = read int fd head 0 len head |
| 27 | failed = lt r 0 |
| 28 | r = fclose int fd |
| 29 | if not failed |
| 30 | ret 14 |
| 31 | end |
| 32 | note Reading an opened directory yields a real negative read, even as root. |
| 33 | if readhd |
| 34 | ret 11 |
| 35 | end |
| 36 | if ne classif 21 |
| 37 | ret 12 |
| 38 | end |
| 39 | ret 0 |
| 40 | end |
| 41 | scandir |
| 42 | if ne get cnt 0 1 |
| 43 | ret 21 |
| 44 | end |
| 45 | if ne get cnt 21 1 |
| 46 | ret 22 |
| 47 | end |
| 48 | if ne unknown 1 |
| 49 | ret 23 |
| 50 | end |
| 51 | if ne get plen 0 rootn |
| 52 | ret 24 |
| 53 | end |
| 54 | ret 0 |
| 55 | end |