Add an end-to-end probe for guest memory above the host address limit

This commit is contained in:
maxjivi05 committed 2026-12-03 21:28:02 -05:00
1 parent 15b5d46f70
commit 46e36d95a3
3 files changed
+117 -1

No files matched your search

+23
View File
@@ -8,6 +8,7 @@ from pathlib import Path
REPO = Path(__file__).resolve().parents[2]
PATCH = REPO / "tools/fex/patches/0027-fixed-guest-memory-above-host-address-limit.patch"
PROBE = REPO / "tools/fex/probes/guest-high-memory.c"
SOURCE = "Source/Tools/LinuxEmulation/LinuxSyscalls/GuestHighMemory.cpp"
HEADER = "Source/Tools/LinuxEmulation/LinuxSyscalls/GuestHighMemory.h"
@@ -402,5 +403,27 @@ class GuestHighMemoryTest(unittest.TestCase):
self.assertNotIn("OverlapsLocked", text)
@unittest.skipUnless(platform.machine() == "x86_64", "the probe is x86-64 code")
class GuestHighMemoryProbeTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
compiler = shutil.which("cc") or shutil.which("gcc") or shutil.which("clang")
if not compiler:
raise unittest.SkipTest("no C compiler")
cls.tmp = Path(tempfile.mkdtemp(prefix="fex-guest-high-memory-"))
cls.binary = cls.tmp / "probe"
subprocess.run([compiler, "-O2", "-pthread", "-o", str(cls.binary), str(PROBE)], check=True, capture_output=True, text=True)
@classmethod
def tearDownClass(cls):
shutil.rmtree(cls.tmp, ignore_errors=True)
def test_native_kernel_passes_every_check(self):
result = subprocess.run([str(self.binary)], capture_output=True, text=True, timeout=120)
self.assertEqual(result.returncode, 0, result.stdout)
self.assertNotIn("FAIL", result.stdout)
self.assertEqual(result.stdout.splitlines()[-1], "RESULT PASS")
if __name__ == "__main__":
unittest.main()