arch: serial: Use default values in SerialParameters for tests

Use Default::default() to initialize SeralParameters structs in
unit tests so it's clearer what fields are checked in each test.
Also, it allow avoiding updating these tests when we add a new
field in the struct in the future.

BUG=none
TEST=CQ

Change-Id: Id550703676a7d2273956585358ac70a3e28ffeee
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/6048597
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
This commit is contained in:
Keiichi Watanabe 2024-11-26 18:08:25 +09:00 committed by crosvm LUCI
parent ecff437c4a
commit 7bf96fea60

View file

@ -291,16 +291,10 @@ mod tests {
SerialParameters {
type_: SerialType::Stdout,
hardware: SerialHardware::VirtioConsole,
name: None,
path: None,
input: None,
num: 1,
console: true,
earlycon: false,
stdin: true,
out_timestamp: false,
debugcon_port: 0,
pci_address: None,
..Default::default()
},
);
@ -337,16 +331,10 @@ mod tests {
SerialParameters {
type_: SerialType::Stdout,
hardware: SerialHardware::VirtioConsole,
name: None,
path: None,
input: None,
num: 1,
console: true,
earlycon: false,
stdin: true,
out_timestamp: false,
debugcon_port: 0,
pci_address: None,
..Default::default()
},
);
@ -356,16 +344,9 @@ mod tests {
SerialParameters {
type_: SerialType::Stdout,
hardware: SerialHardware::Serial,
name: None,
path: None,
input: None,
num: 1,
console: false,
earlycon: true,
stdin: false,
out_timestamp: false,
debugcon_port: 0,
pci_address: None,
..Default::default()
},
);
@ -403,16 +384,10 @@ mod tests {
SerialParameters {
type_: SerialType::Stdout,
hardware: SerialHardware::VirtioConsole,
name: None,
path: None,
input: None,
num: 1,
console: false,
earlycon: true,
stdin: true,
out_timestamp: false,
debugcon_port: 0,
pci_address: None,
..Default::default()
},
);