spec: introduce getBaseRatios to retrieve ratios from spawn-ed process

This commit is contained in:
2025-04-18 09:38:26 +08:00
parent f84757ec90
commit b916808ba7

View File

@@ -186,6 +186,13 @@ export const baseRatioFromPath = async (path: string) => {
return extractBaseRatio(result);
};
export async function getBaseRatios<T extends ChildProcessByStdio<null | Writable, Readable, Readable>>(proc: T) {
const specResultCSVs = (await watchSPEC(proc)).outputFiles["CSV"];
assert(specResultCSVs !== undefined && specResultCSVs.length === 1);
const specCSV = await fs.promises.readFile(specResultCSVs[0], "utf-8");
return extractBaseRatio(parseSPECCSVResultsTable(specCSV));
}
export interface ParsedResult {
[key: string]: SPECResultsTable;
}