From a6f69962e85ccf0f0cfd86f7c85bf0f9a2c8c09e Mon Sep 17 00:00:00 2001 From: aur-build Date: Tue, 17 Nov 2026 21:30:38 +0000 Subject: =?UTF-8?q?test:=20toolchain=20shims=20and=20the=20fake-package=20?= =?UTF-8?q?corpus=20(=C2=A716a)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The harness that makes the rest of this developable. Six real binaries named exactly like the tools the pipeline shells out to, sharing one shim module, driven entirely by environment so no production code path is test-only: AUR_SHIM_DIR where invocations are recorded (jsonl) AUR_SHIM_MANIFEST the fixture manifest to obey AUR_SHIM_FAIL optional tool forced to fail makechrootpkg emits real .pkg.tar.zst files with .PKGINFO and .BUILDINFO (the full chroot world, which is why §10.1 filters it), makepkg answers --printsrcinfo and --vercheck for Stage B, repo-add rebuilds a gzip'd .db with %FILENAME%/%VERSION%/%SHA256SUM% DESC entries, gpg writes a detached signature, mkarchroot creates a warm root. Each one records its invocation so tests assert on what actually ran. testcorpus/ holds 17 fixtures, each a PKGBUILD plus a manifest with the scripted outcome: plain-make, with-patch, install-hooks, skip-checksum, split-pkgbase, build-fails, check-fails, missing-dep, dep-cycle, epoch-bump, pkgrel-reset, downgrade, digest-drift, pin-drift, git-sourced, git-submodules, unresolvable. The harness commits a fixture into a real git repo standing in for AUR, materialises a local upstream git repo for VCS fixtures, and swaps payload bytes for the drift cases. Config.child_env is what puts the shims on PATH for child processes, so the pipeline runs completely unmodified under test. Part of P0 (DESIGN.md §17). --- src/config.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index 44b110c..05f9a74 100644 --- a/src/config.rs +++ b/src/config.rs @@ -46,6 +46,10 @@ pub struct Config { /// Directory prepended to PATH for child processes. The test harness puts /// the toolchain shims here (§16a). pub path_prepend: Option, + /// Fixture manifest the shims should obey, exported as `AUR_SHIM_MANIFEST`. + pub shim_manifest: Option, + /// Where shims record their invocations, exported as `AUR_SHIM_DIR`. + pub shim_dir: Option, } impl Default for Config { @@ -67,6 +71,8 @@ impl Default for Config { gpg_bin: "gpg".into(), build_user: String::new(), path_prepend: None, + shim_manifest: None, + shim_dir: None, } } } @@ -96,6 +102,21 @@ impl Config { Ok(()) } + /// Environment for a child process: PATH with the shims in front, plus the + /// shim protocol variables (§16a). + pub fn child_env(&self, cmd: &mut std::process::Command) { + if let Some(dir) = &self.path_prepend { + let path = std::env::var("PATH").unwrap_or_default(); + cmd.env("PATH", format!("{}:{path}", dir.display())); + } + if let Some(m) = &self.shim_manifest { + cmd.env("AUR_SHIM_MANIFEST", m); + } + if let Some(d) = &self.shim_dir { + cmd.env("AUR_SHIM_DIR", d); + } + } + /// Create the directory tree the server needs. Idempotent. pub fn ensure_dirs(&self) -> anyhow::Result<()> { for d in [ -- cgit v1.2.3