Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions xtask/src/xtask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,25 @@ fn test_tmt(sh: &Shell) -> Result<()> {
println!("Discovered plans: {all_plan_files:?}");

cmd!(sh, "cargo run -p tests-integration run-vm prepare-tmt").run()?;
// cc https://pagure.io/testcloud/pull-request/174
cmd!(sh, "rm -vf /var/tmp/tmt/testcloud/images/disk.qcow2").run()?;

for (_prio, name) in all_plan_files {
if let Err(e) = cmd!(sh, "tmt run plans -n {name}").run() {
// cc https://pagure.io/testcloud/pull-request/174
cmd!(sh, "rm -vf /var/tmp/tmt/testcloud/images/disk.qcow2").run()?;
let verbose_enabled = std::env::var("TMT_VERBOSE")
.ok()
.and_then(|s| s.parse::<u32>().ok())
.unwrap_or(0);

let verbose = if verbose_enabled == 1 {
Some("-vvvvv".to_string())
} else {
None
};
Comment on lines +193 to +197
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let verbose = (verbose_enabled == 1).then_some("-vvvvv"); is a bit shorter, also avoids the unnecessary to_string() allocation here.


if let Err(e) = cmd!(sh, "tmt {verbose...} run plans -n {name}")
.env("TMT_PLUGINS", "./tests/plugins")
.run()
{
// tmt annoyingly does not output errors by default
let _ = cmd!(sh, "tmt run -l report -vvv").run();
return Err(e.into());
Expand Down