39 lines
909 B
TypeScript
39 lines
909 B
TypeScript
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)
|
|
]
|
|
}
|