bin/cpubench: support workdir option for CPUBench
This commit is contained in:
@@ -8,6 +8,7 @@ import { promisifySpawn } from '../cli.js';
|
|||||||
import yargs from 'yargs';
|
import yargs from 'yargs';
|
||||||
import { hideBin } from 'yargs/helpers';
|
import { hideBin } from 'yargs/helpers';
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
|
||||||
// 解析命令行参数
|
// 解析命令行参数
|
||||||
const argv = await yargs(hideBin(process.argv))
|
const argv = await yargs(hideBin(process.argv))
|
||||||
@@ -39,6 +40,11 @@ const argv = await yargs(hideBin(process.argv))
|
|||||||
description: 'List of benchmarks to run',
|
description: 'List of benchmarks to run',
|
||||||
demandOption: true,
|
demandOption: true,
|
||||||
})
|
})
|
||||||
|
.option('workdir-base', {
|
||||||
|
type: 'string',
|
||||||
|
description: 'Base directory of workdirs',
|
||||||
|
demandOption: true,
|
||||||
|
})
|
||||||
.parse();
|
.parse();
|
||||||
|
|
||||||
|
|
||||||
@@ -60,13 +66,18 @@ const configFile = path.resolve(cpubenchDir, 'config', `rendered-${uuid}.config`
|
|||||||
|
|
||||||
writeFileSync(configFile, cpubenchConfig);
|
writeFileSync(configFile, cpubenchConfig);
|
||||||
|
|
||||||
|
const workdir = path.join(argv.workdirBase, uuid);
|
||||||
|
console.log(`Using workdir = ${workdir}`);
|
||||||
|
await fs.promises.mkdir(workdir, { recursive: true });
|
||||||
|
|
||||||
const proc = spawn(
|
const proc = spawn(
|
||||||
path.resolve(cpubenchDir, 'cpubench.sh'),
|
path.resolve(cpubenchDir, 'cpubench.sh'),
|
||||||
[
|
[
|
||||||
`--config=${configFile}`,
|
`--config=${configFile}`,
|
||||||
"--skip_verify=1",
|
"--skip_verify=1",
|
||||||
"--rebuild=1",
|
"--rebuild=1",
|
||||||
"-i=1"
|
"-i=1",
|
||||||
|
`--work_dir=${workdir}`,
|
||||||
],
|
],
|
||||||
{ cwd: cpubenchDir }
|
{ cwd: cpubenchDir }
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user