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).
This commit is contained in:
+21
-2
@@ -176,7 +176,16 @@ pub async fn run(opts: TestOptions<'_>) -> Result<TestRunReport, Box<dyn std::er
|
||||
env.insert("LOGNAME".to_string(), "root".to_string());
|
||||
}
|
||||
|
||||
configure_testbed(&ctx, &env, &series, &arch, &opts, view).await?;
|
||||
configure_testbed(
|
||||
&ctx,
|
||||
&env,
|
||||
&series,
|
||||
&arch,
|
||||
&opts,
|
||||
matches!(bed, Bed::Local(_)),
|
||||
view,
|
||||
)
|
||||
.await?;
|
||||
|
||||
// Stage the tree and the binaries into the testbed. The copy also
|
||||
// protects the host tree: tests may write into it (rw-build-tree).
|
||||
@@ -431,6 +440,7 @@ async fn configure_testbed(
|
||||
series: &str,
|
||||
arch: &str,
|
||||
opts: &TestOptions<'_>,
|
||||
local_context: bool,
|
||||
view: &dyn BuildView,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user