| 65 | } |
| 66 | |
| 67 | async function fixturePrepare() { |
| 68 | await mkdir(FIXTURE, { recursive: true }); |
| 69 | const old = await readFile(join(FIXTURE, 'TEST-FIXTURE.txt'), 'utf8').catch((error) => { if (error.code === 'ENOENT') return null; throw error; }); |
| 70 | if (old !== null && old !== marker) throw new Error('Refusing to modify an unrecognized existing fixture directory'); |
| 71 | if (old === null && (await readdir(FIXTURE)).length > 0) throw new Error('Refusing to overwrite files in an unmarked existing directory'); |
| 72 | await writeFile(join(FIXTURE, 'TEST-FIXTURE.txt'), marker); |
| 73 | ownsFixture = true; |
| 74 | await writeFile(join(FIXTURE, 'readable.c'), '/* EXPLICIT TEST FIXTURE */\nint fixture_readable(void) { return 42; }\n'); |
| 75 | await writeFile(join(FIXTURE, 'partial.c'), '/* EXPLICIT TEST FIXTURE: malformed declaration */\nint fixture_broken( {\n'); |
| 76 | await writeFile(join(FIXTURE, 'excluded.c'), '/* EXPLICIT TEST FIXTURE intentionally excluded */\nint excluded(void) { return 0; }\n'); |
| 77 | await writeFile(join(FIXTURE, '.cbmignore'), 'excluded.c\n'); |
| 78 | const unreadable = join(FIXTURE, 'unreadable.c'); |
| 79 | await chmod(unreadable, 0o600).catch((error) => { if (error.code !== 'ENOENT') throw error; }); |
| 80 | await writeFile(unreadable, '/* EXPLICIT TEST FIXTURE: chmod 000 during this run */\nint inaccessible(void) { return 1; }\n'); |
| 81 | report.actions.push({ action: 'Created synthetic C fixtures initially readable, including malformed partial.c and excluded.c', path: FIXTURE }); |
| 82 | } |
| 83 | |
| 84 | async function failedJobWhileWatching(page, workspace, project) { |
| 85 | await page.bringToFront(); |