import {mkdtempSync,mkdirSync,writeFileSync,readFileSync} from 'node:fs'; import {join,dirname} from 'node:path'; import {spawnSync} from 'node:child_process'; import {filesIn} from './entry-extension.mjs'; import {waitGuestServicesTestSources} from './wait-guest-services-fixture.mjs'; const root=process.cwd(),dir=mkdtempSync(join(root,'reports/os-implementation/K1080-wait-services-smoke-')); const map=new Map([...waitGuestServicesTestSources(root)].map(([p,s])=>['os-wait-guest-services/'+p,s])); for(const dep of['os-threads','os-exceptions','os-thread-wait','os-context-handoff','os-context-switch'])for(const p of filesIn(root,dep))map.set(p,readFileSync(join(root,p))); map.set('.cargo/config.toml',readFileSync(join(root,'.cargo/config.toml'))); for(const[p,s]of map){const dest=join(dir,p);mkdirSync(dirname(dest),{recursive:true});writeFileSync(dest,s);} const r=spawnSync('cargo',['test','--manifest-path',join(dir,'os-wait-guest-services/Cargo.toml'),'--offline','--test','services','--target','aarch64-apple-darwin','--','--test-threads=1'],{cwd:root,encoding:'utf8',timeout:120000,maxBuffer:8*1024*1024,env:{...process.env,CARGO_TARGET_DIR:join(dir,'target')}}); writeFileSync(join(dir,'tests.log'),(r.stdout??'')+(r.stderr??''));console.log(dir);console.log((r.stdout??'')+(r.stderr??''));process.exitCode=r.status??1;