This commit is contained in:
2026-09-17 16:27:34 +02:00
parent a7cd4244b2
commit 775e3d3b8a
5 changed files with 31 additions and 32 deletions
+14 -8
View File
@@ -212,8 +212,10 @@ pub fn run_source_build(
) -> Result<SourceBuildOutput, Box<dyn Error>> {
// Without a live UI, test runs still capture command output into the
// per-test log file instead of letting it inherit the terminal
let sink: Option<Arc<dyn LineSink>> =
ui.as_ref().map(|u| u.sink()).or_else(crate::test_support::subprocess_sink);
let sink: Option<Arc<dyn LineSink>> = ui
.as_ref()
.map(|u| u.sink())
.or_else(crate::test_support::subprocess_sink);
// ------------------------------------------------------------------
// 1. Sanity checks
// ------------------------------------------------------------------
@@ -1315,9 +1317,8 @@ mod differential_tests {
}
fn copy_path(src: &Path, dst_root: &Path) {
let status = crate::test_support::run_logged(
Command::new("cp").arg("-a").arg(src).arg(dst_root),
)
let status =
crate::test_support::run_logged(Command::new("cp").arg("-a").arg(src).arg(dst_root))
.expect("run cp -a");
assert!(
status.success(),
@@ -1329,9 +1330,14 @@ mod differential_tests {
fn run_dpkg(tree: &Path) {
let status = crate::test_support::run_logged(
Command::new("dpkg-buildpackage")
.current_dir(tree)
.args(["-S", "-I", "-i", "-nc", "-d", "--no-sign"]),
Command::new("dpkg-buildpackage").current_dir(tree).args([
"-S",
"-I",
"-i",
"-nc",
"-d",
"--no-sign",
]),
)
.expect("failed to run dpkg-buildpackage (is dpkg-dev installed?)");
assert!(status.success(), "dpkg-buildpackage failed");
+9 -10
View File
@@ -645,7 +645,8 @@ async fn fetch_index_bytes(url: &str) -> Result<Vec<u8>, String> {
Err(e) => {
last_error = e.to_string();
log::debug!("fetch of '{url}' failed (attempt {attempt}/{ATTEMPTS}): {last_error}");
tokio::time::sleep(std::time::Duration::from_millis(300 * u64::from(attempt))).await;
tokio::time::sleep(std::time::Duration::from_millis(300 * u64::from(attempt)))
.await;
}
Ok(response) => {
if !response.status().is_success() {
@@ -659,9 +660,9 @@ async fn fetch_index_bytes(url: &str) -> Result<Vec<u8>, String> {
log::debug!(
"empty body for '{url}' (attempt {attempt}/{ATTEMPTS}), retrying"
);
tokio::time::sleep(
std::time::Duration::from_millis(300 * u64::from(attempt)),
)
tokio::time::sleep(std::time::Duration::from_millis(
300 * u64::from(attempt),
))
.await;
}
Ok(bytes) => return Ok(bytes.to_vec()),
@@ -671,9 +672,9 @@ async fn fetch_index_bytes(url: &str) -> Result<Vec<u8>, String> {
log::debug!(
"reading the body of '{url}' failed (attempt {attempt}/{ATTEMPTS}): {last_error}"
);
tokio::time::sleep(
std::time::Duration::from_millis(300 * u64::from(attempt)),
)
tokio::time::sleep(std::time::Duration::from_millis(
300 * u64::from(attempt),
))
.await;
}
}
@@ -952,10 +953,8 @@ mod tests {
let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
let addr = listener.local_addr().unwrap();
std::thread::spawn(move || {
let mut served = 0usize;
for stream in listener.incoming().flatten() {
for (served, stream) in listener.incoming().flatten().enumerate() {
let index = served.min(responses.len() - 1);
served += 1;
let mut stream = stream;
// Drain the request first: closing with unread inbound data
// would send a TCP RST and destroy the response in flight
+4 -8
View File
@@ -320,18 +320,14 @@ async fn download_file_checksum(
match download_file_checksum_once(url, checksum, algo, target_dir, progress).await {
Ok(()) => return Ok(()),
Err(e) => {
log::warn!(
"download of '{url}' failed (attempt {attempt}/{ATTEMPTS}): {e}"
);
log::warn!("download of '{url}' failed (attempt {attempt}/{ATTEMPTS}): {e}");
last_error = e;
tokio::time::sleep(std::time::Duration::from_millis(500 * u64::from(attempt))).await;
tokio::time::sleep(std::time::Duration::from_millis(500 * u64::from(attempt)))
.await;
}
}
}
Err(format!(
"downloading '{url}' failed after {ATTEMPTS} attempts: {last_error}"
)
.into())
Err(format!("downloading '{url}' failed after {ATTEMPTS} attempts: {last_error}").into())
}
/// One download attempt of [`download_file_checksum`], verifying the
+2 -2
View File
@@ -65,6 +65,8 @@ mod imp {
pub(crate) struct SuppressFailuresStub;
}
pub(crate) use imp::*;
#[cfg(test)]
mod imp {
use std::collections::HashMap;
@@ -482,5 +484,3 @@ mod imp {
.unwrap_or_else(|| "<current>".to_string())
}
}
pub(crate) use imp::*;
+1 -3
View File
@@ -9,11 +9,9 @@ pub mod logfmt;
/// yes/no confirmation
pub mod prompt;
use indicatif::{
MultiProgress, ProgressBar, ProgressStyle,
};
#[cfg(test)]
use indicatif::ProgressDrawTarget;
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
use std::path::Path;
use std::time::Duration;