commands: create a dedicated commands directory

This commit is contained in:
2024-06-17 15:22:36 +08:00
parent fb6a75cb27
commit ca6dafa5f9
6 changed files with 248 additions and 151 deletions

38
commands/spec.ts Normal file
View File

@@ -0,0 +1,38 @@
import { optFlag, undefList } from "./common"
interface SPECOptions {
/**
* Config file, used for compiling flags, compiler versions, etc.
*/
config?: string
/**
* SPEC workload scale for each benchmark
*/
workload?: "test" | "train" | "ref"
/**
* Selected benchmarks
*/
benchmarks?: string[]
buildType?: "nobuild" | "rebuild" | "plain",
}
export function runcpuOptions(o: SPECOptions): string[] {
return [
...optFlag("-c", o.config),
...optFlag("-i", o.workload),
...undefList(o.buildType, opt => {
switch (opt) {
case "nobuild":
return ["--nobuild"]
case "rebuild":
return ["--rebuild"]
case "plain":
return []
}
}),
...undefList(o.benchmarks, bench => bench)
]
}