okami.mom/albedo

git clone https://git.nkp.pet/okami.mom/albedo

Aly Raffauffeat(daemon): add native storage helper modes159a58a

main
875 B28 linesraw
1"""Invoke production storage helpers or compiled test-only effect gates."""
2
3import os
4from pathlib import Path
5
6ROOT = Path(__file__).resolve().parents[1]
7
8
9def maintenance_command(home, executable=None, *, operation=None, gate=""):
10    executable = executable or os.environ["ALBEDO_TEST_DAEMON"]
11    if operation is None:
12        return [executable, "storage", "maintain", str(home)]
13    packages = sorted(Path(executable).parent.glob("*/ebin"))
14    if not packages:
15        raise RuntimeError("gated storage tests require the compiled test snapshot")
16    return [
17        str(ROOT / "priv/bin/albedo-daemon"),
18        "erl",
19        "-pa",
20        *(str(package) for package in packages),
21        "-eval",
22        "albedo@@main:run(harness@storage_maintenance_support)",
23        "-noshell",
24        "-extra",
25        operation,
26        str(home),
27        str(gate),
28    ]