From b916808ba743c85b5d90542d6ed7892d4eafd179 Mon Sep 17 00:00:00 2001 From: Yingchi Long Date: Fri, 18 Apr 2025 09:38:26 +0800 Subject: [PATCH] spec: introduce `getBaseRatios` to retrieve ratios from spawn-ed process --- src/spec/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/spec/index.ts b/src/spec/index.ts index de5ca6e..a527cba 100644 --- a/src/spec/index.ts +++ b/src/spec/index.ts @@ -186,6 +186,13 @@ export const baseRatioFromPath = async (path: string) => { return extractBaseRatio(result); }; +export async function getBaseRatios>(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; }