tracker
All repositories: gitoria
2.5 KB
// A barrier releases 16 independent processes against one absent path.import { spawn, spawnSync } from 'node:child_process';import { mkdtempSync, writeFileSync, existsSync, readFileSync, rmSync } from 'node:fs';import { join, resolve } from 'node:path';import assert from 'node:assert/strict';const root = resolve(import.meta.dirname, '../../..');const bin = process.env.HL_BIN || join(root, 'native/zig-out/bin/hybriel');const work = mkdtempSync(join(process.env.TMPDIR || '/tmp', 'hl-exclusive-'));const children = [];try {const src = join(work, 'claim.hl');writeFileSync(src, `import { createFile, exists } from 'hl:fs'import { args } from 'hl:proc'import { sleep } from 'hl:time'a = args()createFile(a[0] + '.ready.' + a[1], '')while (!exists(a[0] + '.go')) { sleep(0.005) }console.log(createFile(a[0], a[1]))`);const native = join(work, 'claim');const built = spawnSync(bin, ['--native', src, '-o', native], { encoding: 'utf8' });assert.equal(built.status, 0, `${built.error || ""}${built.stdout || ""}${built.stderr || ""}`);for (const engine of ['run', 'native']) {const path = join(work, engine);const promises = Array.from({ length: 16 }, (_, i) => {const child = spawn(engine === 'run' ? bin : native, engine === 'run' ? [src, path, String(i)] : [path, String(i)]);children.push(child);return new Promise((resolve, reject) => {let output = '';child.stdout.on('data', b => { output += b; });child.stderr.on('data', b => { output += b; });child.on('error', reject);child.on('close', code => resolve({ code, output: output.trim(), i }));});});const deadline = Date.now() + 30000;while (!Array.from({ length: 16 }, (_, i) => existsSync(path + '.ready.' + i)).every(Boolean)) {assert.ok(Date.now() < deadline, 'workers did not reach barrier');await new Promise(r => setTimeout(r, 20));}writeFileSync(path + '.go', '');const answers = await Promise.all(promises);for (const a of answers) { assert.equal(a.code, 0, a.output); assert.match(a.output, /^(true|false)$/); }const winners = answers.filter(a => a.output === 'true');assert.equal(winners.length, 1);assert.equal(readFileSync(path, 'utf8'), String(winners[0].i));console.log(`exclusive-create ${engine}: 1/16 won, winner content preserved`);}} finally {for (const c of children) if (c.exitCode === null) c.kill('SIGKILL');await Promise.all(children.filter(c => c.exitCode === null).map(c => new Promise(r => c.once('close', r))));rmSync(work, { recursive: true, force: true });}
Branches
Latest commits
- 8e5f2ceflog: SL1 deployedmre
- 29f34212log: SL1 deploy startedmre
- 529dd741Merge sl1-slices: slice details repair and person fill (SL1)mre
- 8a83316blog: SL1 result, session drain slowermre
- 35e93e8dSL1: slice the details repair and person fill: catalog lists changed in place, 40 ms fill steps, people created in steps, writes one table per tickmre
- 72c9119flog+status: SL1 startedmre
- d74620fcmission SL1: slice repair and person fillmre
- 5d542d73log+status: ST1 resultmre
- 3945eb81ST1: stall diagnosis reportmre
- 404733aclog: ST1 startedmre
- 3e3d5a55mission ST1: stall diagnosismre
- 9c3180eblog+status: RV28d measured after deploymre
- fdf10b1alog: RV28d deployed on day38bmre
- 320005e9log: RV28d merged, deploy runningmre
- a8fef27dRV28d: reportmre
- 2bae8373RV28d: re-vendor Hybriel set day38b (source 1e554d75, bin 5ff2a46d)mre
- 16b3354aMerge branch 'main' into rv28cmre
- 6f4f27d8log: RV28d started (day38b)mre
- e6cf03ffmission RV28d: rv28c onto day38bmre
- 3ccaee19status: live sweep freeze, waiting for Apollomre