test.py: Run the two-console tests, and give the ad hoc tests a server

The pair tests (net/adhoc/pair) run on two headless instances through
Tools/adhoc_multi.py and the host's built-in relay. They're all in
tests_next for now. The single-console ad hoc tests get the built-in
server and real-time speed, which they need to get past creating a
group, with a timeout to match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 authored and Henrik Rydgård committed 2026-10-28 14:48:47 +01:00
1 parent dfa22e5532
commit 129e3b7312
1 file changed
+46 -4
+46 -4
View File
@@ -685,6 +685,15 @@ tests_next = [
"net/inet/tcp",
"net/inet/udp",
"net/primary/ether",
# Two-console tests: run on two instances through the built-in relay (see run_pair_tests).
"net/adhoc/pair/basic",
"net/adhoc/pair/flow",
"net/adhoc/pair/gamemode",
"net/adhoc/pair/lifecycle",
"net/adhoc/pair/matching",
"net/adhoc/pair/matching2",
"net/adhoc/pair/matching3",
"net/adhoc/pair/vanish",
"sysmem/partition",
# These two mbx tests only appeared to work because they papered over bugs
@@ -729,6 +738,21 @@ test_flags = {
"utility/savedata/nomemstick": ["--no-memstick"],
}
# The ad hoc tests create groups, so they need a server to log in to, and they wait for its replies
# in real time.
ADHOC_FLAGS = ["--adhoc-server", "--realtime", "--timeout-wall=60"]
def flags_for(test):
if test in test_flags:
return test_flags[test]
if test.startswith("net/adhoc/"):
return ADHOC_FLAGS
return None
def is_pair_test(test):
# A two-console test is a set of programs, NAME_host.prx and NAME_client.prx.
return os.path.exists(TEST_ROOT + test + "_host.prx")
# These are the tests we ignore (not important, or impossible to run)
tests_ignored = [
@@ -780,6 +804,10 @@ def run_tests(test_list, args):
# Debug builds are several times slower, enough for the heavier tests to brush the limit.
if 'Debug' in os.path.normpath(PPSSPP_EXE).split(os.sep):
timeout *= DEBUG_TIMEOUT_SCALE
# Tests that need longer bring their own.
for arg in args:
if arg.startswith('--timeout-wall='):
timeout = int(arg[len('--timeout-wall='):])
test_filenames = []
for test in test_list:
@@ -794,7 +822,7 @@ def run_tests(test_list, args):
if len(test_filenames):
# TODO: Maybe --compare should detect --graphics?
cmdline = [PPSSPP_EXE, '--root', TEST_ROOT + '../', '--compare', '--timeout-wall=' + str(timeout), '@-']
cmdline.extend([i for i in args if i not in ['-g', '-m', '-b']])
cmdline.extend([i for i in args if i not in ['-g', '-m', '-b'] and not i.startswith('--timeout-wall=')])
# A memory stick of the tests' own, so they neither write into the user's nor see its firmware.
if not any(i.startswith('--memstick') for i in cmdline):
cmdline.append('--memstick=' + os.path.join(os.path.dirname(os.path.abspath(PPSSPP_EXE)), 'memstick'))
@@ -806,6 +834,16 @@ def run_tests(test_list, args):
return returncode
def run_pair_tests(test_list, args):
# Each instance needs its own process, so Tools/adhoc_multi.py starts them, the host running the
# built-in ad hoc server and relay.
cmdline = [sys.executable, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'Tools', 'adhoc_multi.py'), '--headless', PPSSPP_EXE, '--relay']
cmdline.extend([i for i in args if i not in ['-g', '-m', '-b', '--teamcity']])
cmdline.extend(test_list)
returncode = subprocess.call(cmdline)
print("Ran " + ' '.join(cmdline))
return returncode
def main():
init()
tests = []
@@ -847,11 +885,15 @@ def main():
if skipped:
print("Skipping %d known failures on %s: %s" % (len(skipped), skip_arch, ", ".join(skipped)))
plain = [t for t in tests if t not in test_flags]
pair = [t for t in tests if is_pair_test(t)]
tests = [t for t in tests if t not in pair]
plain = [t for t in tests if flags_for(t) is None]
returncode = run_tests(plain, args)
for test in tests:
if test in test_flags:
returncode = run_tests([test], args + test_flags[test]) or returncode
if flags_for(test) is not None:
returncode = run_tests([test], args + flags_for(test)) or returncode
if pair:
returncode = run_pair_tests(pair, args) or returncode
if teamcity:
return 0
return returncode