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/omega-gpu-driver/blob/main/tests/mutants-arena.sh # omega-gpu-driver aien-dev/omega-gpu-driver 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 `omega-gpu-driver / tests / mutants-arena.sh` 35 lines ยท 1997 bytes Raw Blame History 1 #!/bin/sh 2 # Mutants exist only in temporary copies. A compile refusal or runtime trap is INVALID, not detection. 3 set -eu 4 R=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd) 5 sh "$R/tests/arena_diff.sh" 6 python3 - "$R" <<'PY' 7 import os, pathlib, subprocess, sys, tempfile 8 r=pathlib.Path(sys.argv[1]); original=(r/'gsp/arena.om').read_text() 9 mutants=[ 10 ('old-mctp','arcput 0 1 4','arcput 0 shl ulong 3 30 4'), 11 ('radix','add araddr 11 add get arlvl add i 1 mul j 4096','add araddr 11 add get arlvl add i 1 mul j 4097'), 12 ('logpte','v = add a mul j 4096','v = add a mul j 4097'), 13 ('sharedpte','add araddr 10 mul i 4096 8','add araddr 10 mul i 4097 8'), 14 ('wprheap','shl ulong 133 20','shl ulong 132 20'), 15 ('signature','and add get arslen 1 255 not ulong 255','and add get arslen 1 127 not ulong 127'), 16 ('cotfmc','arcput 28 get arslen 3 4','arcput 28 get arslen 2 4'), 17 ('cotargs','arcput 860 araddr 15 8','arcput 860 araddr 9 8'), 18 ('preboot','rqsend 72 936 936 false','rqsend 73 936 936 false'), 19 ('profile','lt get arcfg 0 1','false'), 20 ('registry','if ne arreg32 0 n','if false'), 21 ('dma','if not ardma get arbase 0 get arused 0','if false'), 22 ('heapdma','if not ardma get arcfg 2 get arcfg 3','if false'), 23 ] 24 with tempfile.TemporaryDirectory(prefix='arena-mutants.') as tmp: 25 for name,old,new in mutants: 26 if original.count(old)!=1: sys.exit('mutants-arena: INVALID match '+name) 27 f=pathlib.Path(tmp)/(name+'.om'); f.write_text(original.replace(old,new)) 28 env=dict(os.environ,ARENA_OM=str(f)) 29 q=subprocess.run(['sh',str(r/'tests/arena_diff.sh')],env=env,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True) 30 detected=('arena_diff: FAIL exact arena/COT' in q.stdout or 'arena_diff: FAIL negative accepted' in q.stdout) 31 if q.returncode==0 or not detected: 32 print(q.stdout);sys.exit('mutants-arena: '+('SURVIVED ' if q.returncode==0 else 'INVALID ')+name) 33 print('mutants-arena: DETECTED '+name) 34 print('mutants-arena: PASS behavior-only controls; hardware NOT_RUN') 35 PY