forked from mtusi2026/mtusi2026lab7
4 lines
1.2 KiB
TypeScript
4 lines
1.2 KiB
TypeScript
import {resolve} from 'node:path';
|
|
const workspace=resolve(import.meta.dir,'..'),root=resolve(workspace,'lab5');const results=[];
|
|
for(const workers of [1,2,4]){const gate=Bun.spawnSync(['game-running'],{stdout:'pipe',stderr:'pipe'});if(gate.exitCode!==1){console.log(JSON.stringify({benchmarkSkipped:true,gateExit:gate.exitCode,completedProfiles:results.length}));process.exit(0)};console.log(JSON.stringify({gameRunningExit:1,concurrency:workers,cpuLimit:1,memoryLimit:'2GiB',sampling:'2seconds, one run; per-attempt p95 and per-process VmHWM'}));const r=Bun.spawnSync([resolve(root,'scripts/compose.sh'),'run','--rm','--no-deps','--entrypoint','/argon-bench.test','-v',resolve(workspace,'lab7-argon-bench.test')+':/argon-bench.test:ro','-e','KDF_CONCURRENCY='+workers,'worker','-test.run','^$','-test.bench','^BenchmarkArgonLogin$','-test.benchtime=2s','-test.count=1'],{cwd:root,stdout:'pipe',stderr:'pipe'});const out=new TextDecoder().decode(r.stdout);console.log(out);if(r.exitCode!==0){console.error(new TextDecoder().decode(r.stderr));throw new Error('Argon benchmark failed')};results.push({workers,exit:r.exitCode})};console.log(JSON.stringify({allProfilesPassed:true,profiles:results}));
|