Skip to content

Commit

Permalink
Support overriding config's command through CLI args
Browse files Browse the repository at this point in the history
Commit ab25958 added support for oneliners, but it marked the 'command'
arg as conflicting with the 'config' arg. This prevents using a config
file with `go run|test -exec`.

Moreover, having a way to override the command defined in the config
file gives an easy way to exec into a VM to manually debug a failing
command.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
  • Loading branch information
akerouanton committed Nov 27, 2024
1 parent 80cd7b5 commit 2880e84
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ struct Args {
#[clap(short, long, conflicts_with = "config")]
qemu_command: Option<String>,
/// Command to run in kernel mode. `-` to get an interactive shell.
#[clap(conflicts_with = "config")]
command: Vec<String>,
}

Expand Down Expand Up @@ -135,6 +134,13 @@ fn config(args: &Args) -> Result<Vmtest> {
.target
.into_iter()
.filter(|t| filter.is_match(&t.name))
.map(|t| {
let mut t = t;
if !args.command.is_empty() {
t.command = args.command.join(" ");
}
t
})
.collect::<Vec<_>>();
let base = config_path.parent().unwrap();
Vmtest::new(base, config)
Expand Down

0 comments on commit 2880e84

Please sign in to comment.