From cea73c592e2f7aba245b61cfa11b49285bfbb962 Mon Sep 17 00:00:00 2001 From: blackjackfruit Date: Wed, 25 Nov 2026 20:48:29 -0500 Subject: [PATCH] Rename VT/VisualTester to MT/MonkeyTester --- README.md | 12 ++++++------ runner.py | 16 ++++++++-------- sources/__init__.py | 4 ++-- sources/github.py | 2 +- templates/build-android.sh | 16 ++++++++-------- templates/build-ios.sh | 18 +++++++++--------- tests/fake_gitea.py | 4 ++-- tests/test_build_local.py | 26 +++++++++++++------------- 8 files changed, 49 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index c639681..82c2534 100644 --- a/README.md +++ b/README.md @@ -111,13 +111,13 @@ root of a clean checkout of the branch, with: | Variable | Value | |---|---| -| `VT_PLATFORM` | `android` or `ios` | -| `VT_OUTPUT` | where the script must write the app: a `.apk` (Android) or a signed `.ipa` (iOS) | -| `VT_BRANCH` | the branch being built | -| `VT_CASES` | comma-separated case names | -| `VT_REQUEST_ID` | the viewer's build id | +| `MT_PLATFORM` | `android` or `ios` | +| `MT_OUTPUT` | where the script must write the app: a `.apk` (Android) or a signed `.ipa` (iOS) | +| `MT_BRANCH` | the branch being built | +| `MT_CASES` | comma-separated case names | +| `MT_REQUEST_ID` | the viewer's build id | -Exit status `0` with a non-empty file at `VT_OUTPUT` is a successful build; +Exit status `0` with a non-empty file at `MT_OUTPUT` is a successful build; anything else is a build error, reported with the script's last `error:` lines and its log. diff --git a/runner.py b/runner.py index 24d30a1..1255bf4 100644 --- a/runner.py +++ b/runner.py @@ -5,8 +5,8 @@ (shallow, credentials per command through GIT_CONFIG_* env: never in .git/config, the remote URL, argv or the log), 2. run each chosen platform's recipe (`bash .monkeytester/build-

.sh`) in its - own process group with VT_PLATFORM / VT_OUTPUT / VT_BRANCH / VT_CASES / - VT_REQUEST_ID, under a per-platform timeout, + own process group with MT_PLATFORM / MT_OUTPUT / MT_BRANCH / MT_CASES / + MT_REQUEST_ID, under a per-platform timeout, 3. upload through the viewer's submit.py (`--no-wait`): built apps, and the error + log of the platforms that failed. @@ -445,11 +445,11 @@ def _build(self, ref, rec, out, logf, note): self._job(ref, p, "in_progress") app = out / APP_NAMES[p] plog = out / f"{p}-build.log" - note(f"{JOB_NAMES[p]}: bash {RECIPES[p]} (VT_OUTPUT={app})") + note(f"{JOB_NAMES[p]}: bash {RECIPES[p]} (MT_OUTPUT={app})") timeout = platform_timeout(p) - env = child_env({"VT_PLATFORM": p, "VT_OUTPUT": str(app), "VT_BRANCH": branch, - "VT_CASES": ",".join(rec.get("cases") or []), - "VT_REQUEST_ID": rec["request_id"]}) + env = child_env({"MT_PLATFORM": p, "MT_OUTPUT": str(app), "MT_BRANCH": branch, + "MT_CASES": ",".join(rec.get("cases") or []), + "MT_REQUEST_ID": rec["request_id"]}) with open(plog, "ab") as pf: rc, outcome = self._run(["bash", RECIPES[p]], checkout, env, [logf, pf], timeout) if outcome == "timeout": @@ -460,7 +460,7 @@ def _build(self, ref, rec, out, logf, note): msg = build_error_message(plog) if not msg: msg = (f"build script exited with status {rc}" if rc != 0 - else "build script exited with status 0 but wrote no app at VT_OUTPUT") + else "build script exited with status 0 but wrote no app at MT_OUTPUT") if msg: failed[p] = (msg, plog) note(f"{JOB_NAMES[p]}: failed: {msg}") @@ -563,7 +563,7 @@ def _upload(self, rec, checkout, out, built, failed, logf, note): # starting with "-" (an error line) can't be taken for another option. for p, (msg, plog) in failed.items(): argv += [f"--{p}-build-error={msg}", f"--{p}-build-log", str(plog)] - argv += ["--tests-dir", "visual-tests", f"--branch={rec['branch']}", f"--repo={rec['repo']}", + argv += ["--tests-dir", "mt-tests", f"--branch={rec['branch']}", f"--repo={rec['repo']}", f"--cases={','.join(rec.get('cases') or [])}", f"--build-request={rec['request_id']}", "--timeout", str(SUBMIT_WAIT)] note("Upload: python3 submit.py " + " ".join(argv[3:])) diff --git a/sources/__init__.py b/sources/__init__.py index f2867ef..1f27f79 100644 --- a/sources/__init__.py +++ b/sources/__init__.py @@ -24,7 +24,7 @@ PLATFORMS = ("android", "ios") RECIPES = {"android": ".monkeytester/build-android.sh", "ios": ".monkeytester/build-ios.sh"} -CASES_DIR = "visual-tests" +CASES_DIR = "mt-tests" class SourceError(Exception): @@ -45,7 +45,7 @@ def __init__(self, message, code="forge_refused", status=502, forge_status=None) def cases_from_tree(entries): - """Case names: visual-tests//INSTRUCTION.txt blobs in a git tree listing.""" + """Case names: mt-tests//INSTRUCTION.txt blobs in a git tree listing.""" cases = set() for entry in entries or []: if not isinstance(entry, dict): diff --git a/sources/github.py b/sources/github.py index e3b14ee..a159029 100644 --- a/sources/github.py +++ b/sources/github.py @@ -228,7 +228,7 @@ def _branch_commit(cfg, repo, ref): def _cases_from_contents(cfg, repo, sha): - """Fallback when the recursive tree is truncated: list visual-tests/ and check + """Fallback when the recursive tree is truncated: list mt-tests/ and check each folder for INSTRUCTION.txt through the contents API.""" status, payload = _call(cfg, "GET", f"/repos/{repo}/contents/{CASES_DIR}", params={"ref": sha}) if status == 404: diff --git a/templates/build-android.sh b/templates/build-android.sh index e5e40ad..1a6b497 100644 --- a/templates/build-android.sh +++ b/templates/build-android.sh @@ -5,13 +5,13 @@ # build-local runs it with bash from the root of a clean checkout of the branch # being built, on the plugin's own host (a Mac, or Linux with the Android SDK): # -# VT_PLATFORM android -# VT_OUTPUT where this script must write the .apk -# VT_BRANCH the branch being built -# VT_CASES comma-separated test case names (empty: every case) -# VT_REQUEST_ID the viewer's build id +# MT_PLATFORM android +# MT_OUTPUT where this script must write the .apk +# MT_BRANCH the branch being built +# MT_CASES comma-separated test case names (empty: every case) +# MT_REQUEST_ID the viewer's build id # -# Exit 0 with a non-empty file at $VT_OUTPUT = built. Anything else is a build +# Exit 0 with a non-empty file at $MT_OUTPUT = built. Anything else is a build # error: the plugin reports the output's last "error:" lines and attaches the # whole output as the build log, and the Android devices show every test as # Unavailable. @@ -21,7 +21,7 @@ # - the APK path (app/build/outputs/apk/debug/app-debug.apk). set -euo pipefail -: "${VT_OUTPUT:?VT_OUTPUT is not set (this script is run by build-local)}" +: "${MT_OUTPUT:?MT_OUTPUT is not set (this script is run by build-local)}" # The Android SDK: $ANDROID_HOME / $ANDROID_SDK_ROOT, else the usual places on # macOS and Linux. Gradle reads it from local.properties. @@ -43,4 +43,4 @@ if [ ! -s "$apk" ]; then echo "error: Gradle produced no APK at $apk" >&2 exit 1 fi -cp "$apk" "$VT_OUTPUT" +cp "$apk" "$MT_OUTPUT" diff --git a/templates/build-ios.sh b/templates/build-ios.sh index 24a4d74..6b47f46 100644 --- a/templates/build-ios.sh +++ b/templates/build-ios.sh @@ -6,13 +6,13 @@ # being built, on the plugin's Mac (Xcode, and the signing identity in the # login keychain of the user the plugin runs as): # -# VT_PLATFORM ios -# VT_OUTPUT where this script must write the signed .ipa -# VT_BRANCH the branch being built -# VT_CASES comma-separated test case names (empty: every case) -# VT_REQUEST_ID the viewer's build id +# MT_PLATFORM ios +# MT_OUTPUT where this script must write the signed .ipa +# MT_BRANCH the branch being built +# MT_CASES comma-separated test case names (empty: every case) +# MT_REQUEST_ID the viewer's build id # -# Exit 0 with a non-empty file at $VT_OUTPUT = built. Anything else is a build +# Exit 0 with a non-empty file at $MT_OUTPUT = built. Anything else is a build # error: the plugin reports the output's last "error:" lines (xcodebuild's # "error: ..." lines, e.g. signing) and attaches the whole output as the build # log, and the iPhones show every test as Unavailable. Android is still built @@ -31,9 +31,9 @@ # phone connected) before its first build. set -euo pipefail -: "${VT_OUTPUT:?VT_OUTPUT is not set (this script is run by build-local)}" +: "${MT_OUTPUT:?MT_OUTPUT is not set (this script is run by build-local)}" -out=build/visual-test +out=build/monkeytester mkdir -p "$out" # BUILD: archive, then export a signed .ipa. Replace project, scheme and @@ -57,4 +57,4 @@ if [ -z "$ipa" ]; then echo "error: xcodebuild exported no .ipa" >&2 exit 1 fi -cp "$ipa" "$VT_OUTPUT" +cp "$ipa" "$MT_OUTPUT" diff --git a/tests/fake_gitea.py b/tests/fake_gitea.py index ab8568a..7a4b0a0 100644 --- a/tests/fake_gitea.py +++ b/tests/fake_gitea.py @@ -16,8 +16,8 @@ READ_ONLY = "read-only-token-9999" REPO = "blackjackfruit/TemperatureSensor-App" RECIPES = [".monkeytester/build-android.sh", ".monkeytester/build-ios.sh"] -DEFAULT_FILES = ["README.md", *RECIPES, "visual-tests/onboarding/INSTRUCTION.txt", - "visual-tests/device-setup/INSTRUCTION.txt", "visual-tests/notes.txt"] +DEFAULT_FILES = ["README.md", *RECIPES, "mt-tests/onboarding/INSTRUCTION.txt", + "mt-tests/device-setup/INSTRUCTION.txt", "mt-tests/notes.txt"] class State: diff --git a/tests/test_build_local.py b/tests/test_build_local.py index 41dedcb..59797cc 100644 --- a/tests/test_build_local.py +++ b/tests/test_build_local.py @@ -46,8 +46,8 @@ # ─── fixture repo files (branch: {path: content}) ─── -ANDROID_OK = '#!/bin/bash\necho "android build: starting"\nprintf fake-apk-bytes > "$VT_OUTPUT"\n' -IOS_OK = '#!/bin/bash\necho "ios build: starting"\nprintf fake-ipa-bytes > "$VT_OUTPUT"\n' +ANDROID_OK = '#!/bin/bash\necho "android build: starting"\nprintf fake-apk-bytes > "$MT_OUTPUT"\n' +IOS_OK = '#!/bin/bash\necho "ios build: starting"\nprintf fake-ipa-bytes > "$MT_OUTPUT"\n' IOS_FAIL = ('#!/bin/bash\n' 'echo "ios build: starting"\n' 'echo "ios build: error: signing"\n' @@ -57,16 +57,16 @@ ANDROID_FAIL = '#!/bin/bash\necho "android build: error: gradle exited 1"\nexit 1\n' SLOW = ('#!/bin/bash\n' 'echo "slow-build: starting"\n' - 'pids="${VT_OUTPUT%/*}/pids.txt"\n' + 'pids="${MT_OUTPUT%/*}/pids.txt"\n' 'printf \'%s\\n\' "$$" > "$pids"\n' 'sleep 600 &\n' 'printf \'%s\\n\' "$!" >> "$pids"\n' 'sleep 600\n') CASE_FILES = { - "visual-tests/onboarding/INSTRUCTION.txt": "follow the onboarding flow", - "visual-tests/device-setup/INSTRUCTION.txt": "set up the device", - "visual-tests/notes.txt": "not a case", + "mt-tests/onboarding/INSTRUCTION.txt": "follow the onboarding flow", + "mt-tests/device-setup/INSTRUCTION.txt": "set up the device", + "mt-tests/notes.txt": "not a case", } MASTER_FILES = {"README.md": "app", ANDROID_RECIPE: ANDROID_OK, IOS_RECIPE: IOS_OK, **CASE_FILES} FIXTURE_BRANCHES = { @@ -76,7 +76,7 @@ "feat/slow": {"README.md": "app", ANDROID_RECIPE: SLOW, **CASE_FILES}, "feat/no-ios": {"README.md": "app", ANDROID_RECIPE: ANDROID_OK, **CASE_FILES}, "feat/dash-error": {"README.md": "app", ANDROID_RECIPE: '#!/bin/bash\necho "error: --android-app=/etc/passwd"\nexit 1\n', **CASE_FILES}, - "feat/env-dump": {"README.md": "app", ANDROID_RECIPE: '#!/bin/bash\nenv > "$VT_OUTPUT"\n', **CASE_FILES}, + "feat/env-dump": {"README.md": "app", ANDROID_RECIPE: '#!/bin/bash\nenv > "$MT_OUTPUT"\n', **CASE_FILES}, } GHOST_FILES = {"README.md": "app", ANDROID_RECIPE: "exit 0\n", IOS_RECIPE: "exit 0\n"} API_FILES = {branch: {path: content for path, content in files.items()} @@ -578,7 +578,7 @@ def test_truncated_tree_falls_back_to_contents(self): self.assertEqual(status, 200, body) self.assertEqual(body["cases"], ["device-setup", "onboarding"]) self.assertEqual(body["recipes"], {"android": True, "ios": True}) - self.assertTrue(any("/contents/visual-tests" in r[1] for r in self.gh.calls())) + self.assertTrue(any("/contents/mt-tests" in r[1] for r in self.gh.calls())) def test_branches_default_first_github(self): status, body = self.call("GET", f"/repos/{REPO}/branches") @@ -882,9 +882,9 @@ def setUp(self): self.start_plugin() def test_template_served_as_plain_text(self): - for platform, needles in (("android", ("gradlew assembleDebug", "VT_OUTPUT", "set -euo pipefail", + for platform, needles in (("android", ("gradlew assembleDebug", "MT_OUTPUT", "set -euo pipefail", "sdk.dir")), - ("ios", ("xcodebuild archive", "exportArchive", "VT_OUTPUT", + ("ios", ("xcodebuild archive", "exportArchive", "MT_OUTPUT", "set -euo pipefail", "UDID"))): status, raw, hdrs = self.call("GET", f"/template?platform={platform}", raw=True) self.assertEqual(status, 200) @@ -994,11 +994,11 @@ def test_write_private_json_mode_and_atomicity(self): def test_child_env_drops_plugin_secrets(self): with patch.dict(os.environ, {"PLUGIN_TOKEN": "s3cret-pair", "BUILD_LOCAL_IMPORT": "/x", "SOMETHING_ELSE": "keep"}): - env = build_runner.child_env({"VT_PLATFORM": "android"}) + env = build_runner.child_env({"MT_PLATFORM": "android"}) self.assertNotIn("PLUGIN_TOKEN", env) self.assertNotIn("BUILD_LOCAL_IMPORT", env) self.assertEqual(env["SOMETHING_ELSE"], "keep") - self.assertEqual(env["VT_PLATFORM"], "android") + self.assertEqual(env["MT_PLATFORM"], "android") @@ -1203,7 +1203,7 @@ def test_build_script_never_sees_the_pairing_token(self): body = self.wait_state(ref) self.assertEqual(body["conclusion"], "success", body) dumped = (self.out_dir(ref) / "app.apk").read_text() - self.assertIn("VT_PLATFORM=android", dumped) + self.assertIn("MT_PLATFORM=android", dumped) self.assertNotIn("PLUGIN_TOKEN", dumped) self.assertNotIn("pair-token-in-env-5678", dumped) self.assertNotIn("BUILD_LOCAL_IMPORT", dumped)