Skip to content
Merged
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
16 changes: 14 additions & 2 deletions tests/test_build_runtime_fallback.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,22 @@ def test_the_loader_gets_the_stack_reserve_cmake_gives_it(self):
cmake = (ROOT / "runtime" / "CMakeLists.txt").read_text(encoding="utf-8")
reserve = re.search(r"set\(GTA6RT_STACK (\d+)\)", cmake).group(1)
self.assertGreaterEqual(int(reserve), 8 * 1024 * 1024)
self.assertRegex(cmake, r"target_link_options\(gta6rt PRIVATE [^)]*/STACK:\$\{GTA6RT_STACK\}\)")
link_options = re.search(r"(?m)^[ \t]*target_link_options\(gta6rt PRIVATE([^)]*)\)", cmake)
self.assertIsNotNone(link_options)
options = re.sub(r"(?m)#.*$", "", link_options.group(1)).split()
self.assertEqual(
[option for option in options if option.upper().startswith("/STACK:")],
["/STACK:${GTA6RT_STACK}"],
)
lines = [line for line in self.body.splitlines() if "/Fe:gta6rt.exe" in line]
self.assertEqual(len(lines), 1)
self.assertRegex(lines[0], rf"/Fe:gta6rt\.exe /link (\S+ )*/STACK:{reserve}( |$)")
_, separator, flags = lines[0].partition(" /link ")
self.assertEqual(separator, " /link ")
self.assertEqual(
[option[1:].upper() for option in flags.split()
if option.upper().startswith(("/STACK:", "-STACK:"))],
[f"STACK:{reserve}"],
)
shim = (ROOT / "runtime" / "shims" / "process_shim.h").read_text(encoding="utf-8")
megabytes = re.search(r"run_entry\(void\* entry, std::size_t stack_bytes = (\d+)u << 20\);", shim).group(1)
self.assertEqual(int(megabytes) << 20, int(reserve))
Expand Down
Loading