mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-10 04:07:23 +00:00
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:
parent
46be6c3b59
commit
4016e4475a
1 changed files with 0 additions and 99 deletions
99
src/main.rs
99
src/main.rs
|
@ -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"
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue