From c76c322bdf044f01d98f1b05c81b8d3c3cacbf33 Mon Sep 17 00:00:00 2001 From: Shang Li <144836394+Mby159@users.noreply.github.com> Date: Mon, 30 Nov 2026 01:48:04 +0800 Subject: [PATCH 1/3] tests: allow link options after stack reserve (TEST-BUILD-FALLBACK-STACK-OPTION) --- tests/test_build_runtime_fallback.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_build_runtime_fallback.py b/tests/test_build_runtime_fallback.py index 3aebc1c230..baf3c83b70 100644 --- a/tests/test_build_runtime_fallback.py +++ b/tests/test_build_runtime_fallback.py @@ -115,7 +115,7 @@ 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\}\)") + self.assertRegex(cmake, r"target_link_options\(gta6rt PRIVATE [^)]*/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}( |$)") From eace3acdd6fb2da6bdba4c986d0a113e067ac75a Mon Sep 17 00:00:00 2001 From: Shang Li <144836394+Mby159@users.noreply.github.com> Date: Mon, 30 Nov 2026 02:07:54 +0800 Subject: [PATCH 2/3] tests: require exactly the configured stack reserve (TEST-BUILD-FALLBACK-STACK-OPTION) --- tests/test_build_runtime_fallback.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_build_runtime_fallback.py b/tests/test_build_runtime_fallback.py index baf3c83b70..c0000615e9 100644 --- a/tests/test_build_runtime_fallback.py +++ b/tests/test_build_runtime_fallback.py @@ -115,7 +115,13 @@ 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}( |$)") From c68091870428aae6138854e0147a8f513c32d3d5 Mon Sep 17 00:00:00 2001 From: Shang Li <144836394+Mby159@users.noreply.github.com> Date: Mon, 30 Nov 2026 02:21:00 +0800 Subject: [PATCH 3/3] tests: require one matching stack reserve in the fallback link line (TEST-BUILD-FALLBACK-STACK-OPTION) --- tests/test_build_runtime_fallback.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_build_runtime_fallback.py b/tests/test_build_runtime_fallback.py index c0000615e9..65ca0bc3e3 100644 --- a/tests/test_build_runtime_fallback.py +++ b/tests/test_build_runtime_fallback.py @@ -124,7 +124,13 @@ def test_the_loader_gets_the_stack_reserve_cmake_gives_it(self): ) 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))