Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion quest/m0/ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,5 @@ The historical samples locate candidates; they are not controlled benchmarks.
- [Release credentials off main](/quest/m0/ci/publish-release-only.md) - `publish` admits only `release` and release tags once its `workflow_run` publishers run on their tag
- [The queue host keeps the queue's disk](/quest/m0/ci/queue-host-disk.md) - agent sessions can't starve the queue runner of disk, and a crashed runner restarts
- [Biome checks every file it can parse](/quest/m0/ci/biome-whole-repo.md) - Biome runs over the whole repository and main is clean under it
- [Dispatcher tool changes run the dispatcher tests](/quest/m0/ci/dispatch-selection-gaps.md) - a tool-list change runs `sh/dispatch-query.test.py` in CI, and `sh/rs/uring.test.py` stops printing jq errors
- [dispatch.sh's tests pass without KVM](/quest/m0/ci/dispatch-test-kvm.md) - `sh/dispatch-query.test.py` fakes the KVM probe instead of failing 20 tests on hosts without `/dev/kvm`
- [mbx launches Cargo with any argument length](/quest/m0/ci/mbx-arg-max.md) - no "Argument list too long" in `sh/rs/select.test.py`'s recipe test
36 changes: 0 additions & 36 deletions quest/m0/ci/dispatch-selection-gaps.md

This file was deleted.

25 changes: 23 additions & 2 deletions sh/dispatch-query.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import time
import unittest
from pathlib import Path
from unittest.mock import patch

from test_env import dispatch_env

Expand All @@ -27,13 +28,14 @@ def setUp(self):
shutil.copy(ROOT / "sh" / script, self.repo / "sh" / script)
self.bin = self.root / "bin"
self.bin.mkdir()
for command in ("bash", "git", "sort", "mktemp", "rm", "grep"):
for command in ("bash", "git", "sort", "mktemp", "rm", "grep", "cat", "sed", "tr", "xargs", "sleep"):
(self.bin / command).symlink_to(shutil.which(command))
self.env = dispatch_env(
LOCAL_SUPERVISED="1",
PATH=str(self.bin),
GIT_CONFIG_NOSYSTEM="1",
GIT_CONFIG_GLOBAL=os.devnull,
BASH_ENV=os.devnull,
CI_STRICT="1",
)
self.git("init", "-q", "-b", "main")
Expand Down Expand Up @@ -224,6 +226,7 @@ def stub_ci(self, just=""):
"quest",
"nix",
"c++",
"cc",
"clang-format",
"cmake",
"dart",
Expand Down Expand Up @@ -257,7 +260,6 @@ def stub_ci(self, just=""):
nix.chmod(0o755)
self.env.update(IN_MOQ_DEV_SHELL="1", CALLS=str(self.root / "calls"))
(self.root / "calls").unlink(missing_ok=True)
self.env["PATH"] = f"{self.bin}:{os.environ['PATH']}"
for script in ("markdown.sh", "shell.sh", "large-files.sh"):
path = self.repo / "sh" / script
path.write_text("#!/bin/sh\nexit 0\n")
Expand All @@ -271,6 +273,25 @@ def run_ci(self, base="origin/main"):
self.assertEqual(result.returncode, 0, result.stderr)
return (self.root / "calls").read_text().splitlines()

def test_ci_requires_its_tool_stubs_even_when_the_host_has_them(self):
host = self.root / "host"
host.mkdir()
tool = host / "zizmor"
tool.write_text("#!/bin/sh\nexit 0\n")
tool.chmod(0o755)
with patch.dict(os.environ, PATH=str(host)):
self.stub_ci()
(self.bin / "zizmor").unlink()
result = subprocess.run(
["bash", "sh/dispatch.sh", "ci", "origin/main"],
cwd=self.repo,
env=self.env,
text=True,
capture_output=True,
)
self.assertEqual(result.returncode, 1, result.stdout + result.stderr)
self.assertIn("these tools are missing: zizmor", result.stderr)

def test_failure_keeps_running_lanes_and_starts_remaining_modules(self):
# The failed lane finishes before go releases the two parked lanes.
# No timing assumption can make cancellation look like completion.
Expand Down
15 changes: 13 additions & 2 deletions sh/rs/uring.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ def test_selection_follows_shared_dependencies(self):
just.write_text('#!/bin/sh\nprintf "%s\\n" "$*" >> "$SELECT_CALLS"\n')
just.chmod(0o755)
metadata = {
"workspace_root": "/",
"packages": [
{
"name": name,
"id": f"path+file:///rs/{name}#1.0.0",
"manifest_path": f"/rs/{name}/Cargo.toml",
"targets": [{"src_path": f"/rs/{name}/src/lib.rs"}],
"dependencies": [{"name": dep} for dep in deps],
}
for name, deps in (
Expand All @@ -32,7 +34,7 @@ def test_selection_follows_shared_dependencies(self):
("kio", []),
("moq-unrelated", []),
)
]
],
}
fixture = scratch / "metadata"
fixture.write_text(json.dumps(metadata))
Expand All @@ -44,6 +46,7 @@ def test_selection_follows_shared_dependencies(self):
os.environ,
LOCAL_SUPERVISED="1",
PATH=f"{scratch}:{os.environ['PATH']}",
BASH_ENV=os.devnull,
SELECT_CALLS=str(calls),
TEST_METADATA=str(fixture),
)
Expand All @@ -59,7 +62,15 @@ def test_selection_follows_shared_dependencies(self):
with self.subTest(path=path):
changed.write_text(path + "\n")
calls.write_text("")
subprocess.run(["bash", "sh/rs/select.sh", "uring", str(changed)], cwd=ROOT, env=env, check=True)
result = subprocess.run(
["bash", "sh/rs/select.sh", "uring", str(changed)],
cwd=ROOT,
env=env,
text=True,
capture_output=True,
)
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
self.assertEqual(result.stderr, "")
self.assertEqual("rs uring" in calls.read_text().splitlines(), passes)


Expand Down