spec: create new environment

This commit is contained in:
2024-06-19 01:07:10 +08:00
parent 377890867b
commit f1871532cb

13
spec.ts
View File

@@ -356,9 +356,12 @@ export function buildpath(specdir: string, bench: SPECBenchData): string {
return path.join(benchmarkDir, 'build');
}
export function setenv(specdir: string): void {
process.env.SPEC = specdir;
process.env.PATH = `${path.join(specdir, 'bin')}${path.delimiter}${process.env.PATH}`;
export function getEnvironment(specdir: string): NodeJS.ProcessEnv {
return {
...process.env,
SPEC: specdir,
PATH: `${path.join(specdir, 'bin')}${path.delimiter}${process.env.PATH}`,
};
}
export interface SPEC {
@@ -366,7 +369,7 @@ export interface SPEC {
benchpath: (bench: SPECBenchData) => string;
exepath: (bench: SPECBenchData) => string;
buildpath: (bench: SPECBenchData) => string;
setenv: () => void;
getEnvironment: () => NodeJS.ProcessEnv;
}
export function mkSPEC(specRoot: string): SPEC {
@@ -377,7 +380,7 @@ export function mkSPEC(specRoot: string): SPEC {
benchpath: bench => benchpath(specRoot, bench),
exepath: bench => exepath(specRoot, bench),
buildpath: bench => buildpath(specRoot, bench),
setenv: () => setenv(specRoot),
getEnvironment: () => getEnvironment(specRoot),
};
}