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/ggml-omega/blob/main/tests/test-e2e-gb10.mjs # ggml-omega aien-dev/ggml-omega 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 `ggml-omega / tests / test-e2e-gb10.mjs` 75 lines ยท 2988 bytes Raw Blame History 1 // Host-only failure propagation controls. Fake model processes never touch a GPU. 2 import assert from 'node:assert/strict'; 3 import { mkdtempSync, writeFileSync, rmSync, mkdirSync, existsSync } from 'node:fs'; 4 import { tmpdir } from 'node:os'; 5 import { resolve, join } from 'node:path'; 6 import { spawnSync } from 'node:child_process'; 7 8 const script = resolve(process.argv[2] ?? 'tests/e2e-gb10.sh'); 9 const dir = mkdtempSync(join(tmpdir(), 'omega-e2e-gate-')); 10 try { 11 const bin = join(dir, 'bin'); 12 mkdirSync(bin); 13 const e2e = join(dir, 'fake-e2e'); 14 const cmp = join(dir, 'fake-cmp'); 15 writeFileSync(e2e, `#!/usr/bin/env node 16 const fs = require('node:fs'); 17 fs.writeFileSync(process.argv[4], 'fixture'); 18 console.log(JSON.stringify({step:0,token:1})); 19 console.log(JSON.stringify({n_vocab:2})); 20 if(process.env.OMEGA_GGML_DEVICES) { 21 console.error('device 1: OmegaGB10'); 22 if(process.env.MOCK_PLACEMENT !== 'none') { 23 for(const op of ['MUL_MAT','RMS_NORM','SWIGLU']) { 24 if(process.env.MOCK_PLACEMENT === op) continue; 25 console.error('omega-gb10-profile op='+op+' calls=1 ms=0'); 26 } 27 } 28 if(process.env.E2E_MAPS_OUT && process.env.MOCK_MAPS !== 'missing') 29 fs.writeFileSync(process.env.E2E_MAPS_OUT, process.env.MOCK_MAPS === 'cuda' ? '/usr/lib/libcuda.so.1\\n' : '/usr/lib/libc.so.6\\n'); 30 } 31 `, { mode: 0o755 }); 32 writeFileSync(cmp, `#!/usr/bin/env node 33 console.log(JSON.stringify({steps:1,top1_agree:1})); 34 process.exit(Number(process.env.MOCK_CMP_EXIT ?? 0)); 35 `, { mode: 0o755 }); 36 writeFileSync(join(bin, 'cc'), `#!/bin/sh 37 set -eu 38 out= 39 source= 40 while test "$#" -gt 0; do 41 case "$1" in 42 -o) shift; out=$1 ;; 43 tests/e2e.c) source=$MOCK_E2E ;; 44 tests/cmp.c) source=$MOCK_CMP ;; 45 esac 46 shift 47 done 48 test -n "$out" && test -n "$source" 49 cp "$source" "$out" 50 chmod +x "$out" 51 `, { mode: 0o755 }); 52 let count = 0; 53 function check(label, extra, pass) { 54 const out = join(dir, 'case-'+count); 55 const r = spawnSync('sh', [script, dir, 'fixture.gguf', 'fixture.so', '1', out], { 56 encoding: 'utf8', env: {...process.env, PATH:bin+':'+process.env.PATH, MOCK_E2E:e2e, MOCK_CMP:cmp, ...extra}, 57 }); 58 assert.equal(r.error, undefined, label); 59 assert.equal(r.signal, null, label); 60 assert.equal(r.status === 0, pass, `${label}: exit=${r.status} ${r.stderr} ${r.stdout}`); 61 if(pass) assert.ok(existsSync(join(out,'cmp.json'))); 62 console.log('PASS '+label); 63 count++; 64 } 65 check('complete placed comparison', {}, true); 66 check('comparator failure reaches caller', {MOCK_CMP_EXIT:'1'}, false); 67 check('registered device without execution', {MOCK_PLACEMENT:'none'}, false); 68 for(const op of ['MUL_MAT','RMS_NORM','SWIGLU']) 69 check('missing executed '+op, {MOCK_PLACEMENT:op}, false); 70 check('missing inference maps', {MOCK_MAPS:'missing'}, false); 71 check('forbidden inference library', {MOCK_MAPS:'cuda'}, false); 72 console.log(count+' full-model driver controls PASS'); 73 } finally { 74 rmSync(dir, { recursive: true, force: true }); 75 }