mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
rust/pv*: Unit test flag parsing
Add a unit test for flag parsing. In order to ease this test, add derive Eq to ControlFlags and Msb0Flags64. For the same test, add derive Default to CreateBootImageArgs and the structs used in it. The latter can be limited to only derive when testing to avoid confusion with any user-level default. Acked-by: Steffen Eiden <seiden@linux.ibm.com> Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com> Signed-off-by: Jakob Naucke <naucke@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
ec10654c35
commit
efdadfcdb9
@@ -72,6 +72,7 @@ pub fn validate_cli(opts: &CliOptions) -> Result<(), clap::error::Error> {
|
||||
|
||||
/// CLI Argument collection for handling input components.
|
||||
#[derive(Args, Debug)]
|
||||
#[cfg_attr(test, derive(Default))]
|
||||
pub struct ComponentPaths {
|
||||
/// Use the content of FILE as a raw binary Linux kernel.
|
||||
///
|
||||
@@ -93,6 +94,7 @@ pub struct ComponentPaths {
|
||||
}
|
||||
|
||||
#[derive(Args, Debug)]
|
||||
#[cfg_attr(test, derive(Default))]
|
||||
#[command(group(ArgGroup::new("header-flags").multiple(true).conflicts_with_all(["x_pcf", "x_scf"])))]
|
||||
pub struct CreateBootImageLegacyFlags {
|
||||
/// Enable Secure Execution guest dump support. This option requires the
|
||||
@@ -306,6 +308,7 @@ impl GenprotimgCliOptions {
|
||||
}
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[cfg_attr(test, derive(Default))]
|
||||
pub struct CreateBootImageArgs {
|
||||
#[clap(flatten)]
|
||||
pub component_paths: ComponentPaths,
|
||||
@@ -352,6 +355,7 @@ pub struct CreateBootImageArgs {
|
||||
|
||||
/// Experimental options
|
||||
#[derive(Args, Debug)]
|
||||
#[cfg_attr(test, derive(Default))]
|
||||
pub struct CreateBootImageExperimentalArgs {
|
||||
/// Manually set the directory used to load the Secure Execution bootloaders
|
||||
/// (stage3a and stage3b) (experimental option).
|
||||
|
||||
Reference in New Issue
Block a user