diff options
Diffstat (limited to 'src/pipeline/mod.rs')
| -rw-r--r-- | src/pipeline/mod.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/pipeline/mod.rs b/src/pipeline/mod.rs index 42f435f..e14c7a8 100644 --- a/src/pipeline/mod.rs +++ b/src/pipeline/mod.rs @@ -186,7 +186,21 @@ pub fn run(cfg: &Config, db: &Db, build_id: &str) -> Result<Outcome> { run_with(&ctx) } +/// Production calls `run`, which supplies the real sandbox; a test injects a fake, which is the point of the seam. +/// +/// Module-internal in a production build, `pub` only under `test-support`: +/// one body behind two visibility declarations, exactly one of which compiles. +#[cfg(feature = "test-support")] pub fn run_with(ctx: &Ctx) -> Result<Outcome> { + run_with_impl(ctx) +} + +#[cfg(not(feature = "test-support"))] +pub(crate) fn run_with(ctx: &Ctx) -> Result<Outcome> { + run_with_impl(ctx) +} + +fn run_with_impl(ctx: &Ctx) -> Result<Outcome> { std::fs::create_dir_all(&ctx.staging)?; for step in crate::db::model::BUILD_STEPS { if crate::db::builds::cancel_requested(&ctx.db, &ctx.build.id)? { |
