run: use getopt

This commit is contained in:
Ciro Santilli
2018-08-20 09:18:15 +01:00
parent 0f6917410c
commit 036225b268
15 changed files with 268 additions and 171 deletions

59
common
View File

@@ -26,41 +26,60 @@ common_bench_cmd() (
# Handle options common across multiple scripts.
common_getopts_case() {
common_getopt_case() {
case "$1" in
a)
common_arch="$OPTARG"
-a|--arch)
common_arch="$2"
shift 2
;;
g)
-g|--gem5)
common_gem5=true
shift
;;
L)
common_linux_variant="$OPTARG"
-L|--linux-variant)
common_linux_variant="$2"
shift 2
;;
M)
common_gem5_variant="$OPTARG"
-M|--gem5-variant)
common_gem5_variant="$2"
shift 2
;;
N)
common_gem5_worktree="$OPTARG"
-N|--gem5-worktree)
common_gem5_worktree="$2"
shift 2
;;
n)
common_run_id="$OPTARG"
-n|--run-id)
common_run_id="$2"
shift 2
;;
Q)
common_qemu_variant="$OPTARG"
-Q|--qemu-variant)
common_qemu_variant="$2"
shift 2
;;
s)
common_suffix="$OPTARG"
-s|--suffix)
common_suffix="$2"
shift 2
;;
t)
common_gem5_build_type="$OPTARG"
-t|--gem5-build-type)
common_gem5_build_type="$2"
shift 2
;;
?)
*)
exit 2
;;
esac
}
common_getopts_flags='a:gL:M:N:n:Q:s:t:'
common_getopt_flags='a:gL:M:N:n:Q:s:t:'
common_getopt_flags_long="\
arch:,\
gem5,\
linux-variant:,\
gem5-variant:,\
gem5-worktree:,\:
qemu-variant:,\
suffix:,\
gem5-build-type:'
"
# Setup several variables and do other initialization common to most scripts.
# Typically done after getting inputs from the command line arguments.