test: verify the mapped CLR inode in late-slope diagnostics

This commit is contained in:
Joseph Doherty
2026-11-10 18:02:08 -05:00
parent 8b9326ea06
commit 9fb8d12d34
2 changed files with 30 additions and 2 deletions
@@ -4,6 +4,7 @@
import json
import os
from pathlib import Path
import subprocess
import sys
import tempfile
import unittest
@@ -299,6 +300,20 @@ class ReceiptControls(unittest.TestCase):
class BundleControls(unittest.TestCase):
def test_mapped_runtime_requires_the_mounted_inode_and_live_file(self):
script = Path(__file__).with_name("container.sh")
with tempfile.TemporaryDirectory() as temporary:
maps = Path(temporary) / "maps"
live = "1000-2000 r-xp 00000000 00:01 42 /app/libcoreclr.so"
for line, expected in ((live, 0), (live + " (deleted)", 1), (live.replace(" 42 ", " 43 "), 1),
(live + "\n" + live.replace("/app/", "/different/"), 1)):
with self.subTest(line=line):
maps.write_text(line + "\n", encoding="ascii")
result = subprocess.run(["bash", "-c", 'source "$1"\nverify_mapped_coreclr "$2" "$3"',
"map-control", str(script), str(maps), "42 /app/libcoreclr.so"],
capture_output=True, text=True, timeout=5)
self.assertEqual(result.returncode, expected, result.stderr)
def test_remote_override_fails_before_asking_docker(self):
with patch.dict(os.environ, {"DOCKER_HOST": "tcp://example.invalid:2375"}), patch("bundle.subprocess.check_output") as docker:
with self.assertRaisesRegex(ValueError, "override"):