test(e2e): add full smoketest covering install, search, upgrade, remove

Creates tests/e2e/smoketest.sh — a hermetic end-to-end test that:
- Sets up a mock ZUUR (python3 http.server serving local index/recipes)
- Creates fake zeta-makepkg and zeta scripts (no real Lua tools needed)
- Tests the full pipeline: search → install → upgrade → info → remove
- Verifies exit codes (0, 2 for not-found)
- Verifies installed.json state tracking
- Verifies binary installation/removal via ZETA_ROOT

BUG FOUND (documented in problems.md, not fixed):
- info.d scanDepsArray stores ptrdiff_t indexOf() result in size_t,
  causing ArrayIndexError when recipe lacks a deps field.
  Workaround: recipe includes deps = {}.

Evidence: .omo/evidence/task-27-tofu-core.log — 16/16 checks pass.
This commit is contained in:
2026-08-08 18:52:19 -04:00
parent 70ab40abb9
commit fc979b650d
4 changed files with 478 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
=== tofu smoketest ===
step 0: build tofu binary... PASS
step 1: create temp workspace and hello binary... PASS
step 2: create hello.recipe... PASS
step 3: create package.lua... PASS
step 4: create fake zeta-makepkg and zeta... PASS
step 5: create mock ZUUR layout... PASS
step 6: start mock ZUUR http server... PASS
ZUUR_URL=http://127.0.0.1:27644
CACHE_DIR=/tmp/tmp.707gC0rrPK/cache
step 7: tofu -Ss hello (search)... PASS
step 8: tofu -S hello --noconfirm (install)...  . fetching index http://127.0.0.1:27644/index.lua
 ok index loaded: 1 packages
==> fetching recipe hello
 . downloading hello.recipe
 . downloading package.lua
 . downloading build.sh
- no build.sh for hello (optional build script)
 ok recipe hello downloaded
==> generating build plan
- + hello (recipe)
 ok build plan: 1 packages
- will build 1 package(s): hello
==> ──── building hello (1/1) ────
 ok hello
installing hello-1.0 ok installed hello with 0 dependencies
 ok installed 1 package(s)
installed.json check... PASS
binary in root check... PASS
step 9: tofu -Syu --noconfirm (upgrade — nothing to do)... PASS
step 10: tofu -Si hello (info)... PASS
step 11: tofu -R hello --noconfirm (remove)... removing hello ok removed hello
binary removed check... PASS
installed.json cleared check... PASS
step 12: tofu -S nonexistent --noconfirm (expect exit 2)...  . fetching index http://127.0.0.1:27644/index.lua
 ok index loaded: 1 packages
PASS
step 13: cleanup... PASS
=== smoketest complete ===
PASS: 16 checks passed
All checks passed.