diff options
| author | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-10-02 11:44:31 -0400 |
|---|---|---|
| committer | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-10-02 11:44:31 -0400 |
| commit | 1c99bfbeffff04529f6f669601fdf835a73778da (patch) | |
| tree | 5867bab46e5848541df36c703f6fd8d6d0256e54 /debug/risc-v-gsp-rm-vm/tests/test_version_diff.py | |
| parent | 2fd653044127a665e4677a2cdfb58120d7b3e16b (diff) | |
| download | open-iov-1c99bfbeffff04529f6f669601fdf835a73778da.tar.gz open-iov-1c99bfbeffff04529f6f669601fdf835a73778da.zip | |
rename (cosmetic): green-eye -> risc-v-gsp-rm-debugger in user-facing names, docs, CLI, launcher and CI workflow; internal greeneye package/module identifiers unchanged (includes in-flight greeneye module edits present in the tree)
Diffstat (limited to 'debug/risc-v-gsp-rm-vm/tests/test_version_diff.py')
| -rw-r--r-- | debug/risc-v-gsp-rm-vm/tests/test_version_diff.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/debug/risc-v-gsp-rm-vm/tests/test_version_diff.py b/debug/risc-v-gsp-rm-vm/tests/test_version_diff.py index df704df..d20e780 100644 --- a/debug/risc-v-gsp-rm-vm/tests/test_version_diff.py +++ b/debug/risc-v-gsp-rm-vm/tests/test_version_diff.py @@ -262,6 +262,44 @@ class RunVersionDiffTests(unittest.TestCase): self.assertTrue(os.path.exists(os.path.join(out, "version-diff.json"))) +class VersionDiffDryRunTests(unittest.TestCase): + def test_dry_run_exits_zero_and_touches_nothing(self): + with tempfile.TemporaryDirectory() as tmp: + old = os.path.join(tmp, "old.bin") + new = os.path.join(tmp, "new.bin") + for path in (old, new): + with open(path, "wb") as fh: + fh.write(NOP * 8) + before = {} + for name in ("old.bin", "new.bin"): + path = os.path.join(tmp, name) + with open(path, "rb") as fh: + before[name] = (os.path.getmtime(path), fh.read()) + out = os.path.join(tmp, "out") + rc, stdout, _ = _run_main( + version_diff_main, + ["--old", old, "--new", new, "--out", out, "--dry-run", "--probe-instructions", "4"], + ) + self.assertEqual(rc, 0) + plan = json.loads(stdout[: stdout.find("\n[version-diff]")]) + self.assertEqual(plan["format"], "greeneye-version-diff-plan/1") + self.assertEqual(plan["status"], "planned") + self.assertFalse(os.path.exists(out), "dry-run must not create --out") + for name, (mtime, data) in before.items(): + path = os.path.join(tmp, name) + self.assertEqual(os.path.getmtime(path), mtime) + with open(path, "rb") as fh: + self.assertEqual(fh.read(), data) + + def test_dry_run_rm610_refused(self): + rc, _, err = _run_main( + version_diff_main, + ["--old", "rm610.elf", "--new", "new.elf", "--dry-run"], + ) + self.assertEqual(rc, 3) + self.assertIn("docs/23", err) + + class CiReleaseTests(unittest.TestCase): def test_dry_run_exits_zero_and_touches_nothing(self): with tempfile.TemporaryDirectory() as tmp: |
