GPU benchmark server test: listen on 127.0.0.1, where it connects

On the CI runners localhost resolves to ::1 first, so the server listened
there while the test connected to 127.0.0.1.
This commit is contained in:
Frederic Jung 2026-11-05 11:22:53 +01:00
parent aef744af50
commit 02d3709944
No known key found for this signature in database

View file

@ -21,7 +21,7 @@ function req(port, { method = 'GET', p = '/', host, headers = {}, body } = {}) {
test('the benchmark server answers only its own page', async (t) => {
const port = 20000 + Math.floor(Math.random() * 20000), out = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'bench-')), 'out.md');
const srv = spawn(process.execPath, [path.join(ROOT, 'scripts', 'gpu-bench.js'), '--port', String(port), '--out', out], { stdio: ['ignore', 'pipe', 'pipe'] });
const srv = spawn(process.execPath, [path.join(ROOT, 'scripts', 'gpu-bench.js'), '--port', String(port), '--host', '127.0.0.1', '--out', out], { stdio: ['ignore', 'pipe', 'pipe'] });
let log = ''; srv.stdout.on('data', (c) => { log += c; }); srv.stderr.on('data', (c) => { log += c; });
t.after(() => srv.kill());
for (let i = 0; i < 100 && !/Ctrl\+C/.test(log); i++) await new Promise((r) => setTimeout(r, 100));