From 8513805f98929186d5b7d4e08bbad9c9d71152f0 Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Sun, 27 Sep 2026 21:24:10 +0200 Subject: [PATCH] test: point at root in the local-mode apt failure A local run fails apt-get update exactly like a local build does when the user is not root; say so in the error instead of leaving a bare failure (the chroot modes bootstrap their own root environment). --- src/test/mod.rs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/test/mod.rs b/src/test/mod.rs index 359bbca..5bda8c0 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -176,7 +176,16 @@ pub async fn run(opts: TestOptions<'_>) -> Result, + local_context: bool, view: &dyn BuildView, ) -> Result<(), Box> { let mut sources = crate::apt::sources::load(Some(ctx.clone()))?; @@ -509,7 +519,16 @@ async fn configure_testbed( .status() .map_err(|e| format!("apt-get update failed inside the testbed: {e}"))?; if !status.success() { - return Err("apt-get update failed inside the testbed".into()); + return Err(format!( + "apt-get update failed inside the testbed{}", + if local_context { + " (a local run needs root to install packages: \ + use sudo, or the default chroot mode)" + } else { + "" + } + ) + .into()); } if opts.apt_upgrade {