treewide: rename to src/

This commit is contained in:
2024-06-20 15:16:49 +08:00
parent d396b0d24d
commit e9fd3de6c5
15 changed files with 60 additions and 14 deletions

71
src/commands/spec.ts Normal file
View File

@@ -0,0 +1,71 @@
import { optFlag, undefList } from "./common"
export interface RunCPUOptions {
/**
* 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",
/**
* Default: HTML and text
* Meaning: Desired report format.
* An output format may be deselected by prepending any of the names with the word "no".
* If more than one option is used, separate them by commas or colons.
* The values are not case-sensitive.
*/
outputFormat?: ("all"
/** config file used for this run, written as a numbered file in the result directory, for example */
| "config"
/** Reportable syntax check */
| "check"
/**
* Comma-separated variable.
* If you populate spreadsheets from your runs,
* you probably should not cut/paste data from text files;
* you'll get more accurate data by using --output_format csv.
* The csv report includes all runs, more decimal places,
* system information, and even the compiler flags.
*/
| "csv"
| "default"
| "flags"
| "html"
| "mail"
| "pdf"
| "postscript"
| "raw"
| "screen"
/** Plain ASCII text file */
| "text")[];
}
export function runcpuOptions(o: RunCPUOptions): 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),
...undefList(o.outputFormat, of => ["--output_format", of.join(",")]),
]
}