main: remove switch_or_option compatibility hack

The calling code in vm_concierge has been updated to specify values for
these options, so we can remove the fallback code now.

For any downstream project that may be using these flags, the defaults
correspond to:

--battery => --battery type=goldfish
--video-decoder => --video-decoder libvda
--video-encoder => --video-encoder libvda
--gpu => --gpu backend=virglrenderer
--gpu-display => --gpu-display width=X,height=Y

BUG=b:235882579
TEST=Start Crostini and ARCVM on hatch

Change-Id: I1fa5667a275fc72d03c2b71aea399afd3552a24c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3786917
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
Daniel Verkamp 2022-07-25 13:12:43 -07:00 committed by crosvm LUCI
parent 46be6c3b59
commit 4016e4475a

View file

@ -478,20 +478,6 @@ fn prepare_argh_args<I: IntoIterator<Item = String>>(args_iter: I) -> Vec<String
arg => args.push(arg.to_string()),
}
}
let switch_or_option = [
"--battery",
"--video-decoder",
"--video-encoder",
"--gpu",
"--gpu-display",
];
for arg in switch_or_option {
if let Some(i) = args.iter().position(|a| a == arg) {
if i >= args.len() - 2 || is_flag(&args[i + 1]) {
args.insert(i + 1, "".to_string());
}
}
}
args
}
@ -723,57 +709,6 @@ mod tests {
);
}
#[test]
fn args_battery_switch() {
assert_eq!(
prepare_argh_args(
["crosvm", "run", "--battery", "--other-args", "vm_kernel"].map(|x| x.to_string())
),
[
"crosvm",
"run",
"--battery",
"",
"--other-args",
"vm_kernel"
]
);
}
#[test]
fn args_battery_switch_last_arg() {
assert_eq!(
prepare_argh_args(["crosvm", "run", "--battery", "vm_kernel"].map(|x| x.to_string())),
["crosvm", "run", "--battery", "", "vm_kernel"]
);
}
#[test]
fn args_battery_switch_short_arg() {
assert_eq!(
prepare_argh_args(
[
"crosvm",
"run",
"--battery",
"-p",
"init=/bin/bash",
"vm_kernel"
]
.map(|x| x.to_string())
),
[
"crosvm",
"run",
"--battery",
"",
"-p",
"init=/bin/bash",
"vm_kernel"
]
);
}
#[test]
fn args_battery_option() {
assert_eq!(
@ -800,38 +735,4 @@ mod tests {
]
);
}
#[test]
fn args_switch_multi() {
assert_eq!(
prepare_argh_args(
[
"crosvm",
"run",
"--gpu",
"test",
"--video-decoder",
"--video-encoder",
"--battery",
"--other-switch",
"vm_kernel"
]
.map(|x| x.to_string())
),
[
"crosvm",
"run",
"--gpu",
"test",
"--video-decoder",
"",
"--video-encoder",
"",
"--battery",
"",
"--other-switch",
"vm_kernel"
]
);
}
}