test: fix debug test crashes caused by sea tests

PR-URL: https://github.com/nodejs/node/pull/60807
Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
Vladimir Morozov
2025-11-27 02:22:58 -08:00
committed by GitHub
parent 634dc26605
commit e825de8e02
2 changed files with 17 additions and 1 deletions

View File

@@ -5,7 +5,15 @@ import testpy
def GetConfiguration(context, root):
# We don't use arch-specific out folder in Node.js; use none/none to auto
# detect release mode from GetVm and get the path to the executable.
vm = context.GetVm('none', 'none')
try:
vm = context.GetVm('none', 'none')
except ValueError:
# In debug only builds, we are getting an exception because none/none
# results in taking the release flavor that is missing in that case. Try to
# recover by using the first mode passed explicitly to the test.py.
preferred_mode = getattr(context, 'default_mode', 'none') or 'none'
vm = context.GetVm('none', preferred_mode)
if not os.path.isfile(vm):
return testpy.SimpleTestConfiguration(context, root, 'sea')

View File

@@ -1697,6 +1697,14 @@ def Main():
options.store_unexpected_output,
options.repeat,
options.abort_on_timeout)
# Remember the primary mode requested on the CLI so suites can reuse it when
# they need to probe for a binary outside of the normal test runner flow.
for requested_mode in options.mode:
if requested_mode:
context.default_mode = requested_mode
break
else:
context.default_mode = 'none'
if options.error_reporter:
context.use_error_reporter = True