2 # Automated script to run the pspautotests test suite in PPSSPP.
11 PPSSPP_EXECUTABLES
= [
13 "Windows\\Debug\\PPSSPPHeadless.exe",
14 "Windows\\Release\\PPSSPPHeadless.exe",
15 "Windows\\x64\\Debug\\PPSSPPHeadless.exe",
16 "Windows\\x64\\Release\\PPSSPPHeadless.exe",
18 "build*/Debug/PPSSPPHeadless",
19 "build*/Release/PPSSPPHeadless",
20 "build*/RelWithDebInfo/PPSSPPHeadless",
21 "build*/MinSizeRel/PPSSPPHeadless",
23 "build*/PPSSPPHeadless",
28 TEST_ROOT
= "pspautotests/tests/"
32 class Command(object):
33 def __init__(self
, cmd
, data
= None):
40 def run(self
, timeout
):
42 self
.process
= subprocess
.Popen(self
.cmd
, bufsize
=1, stdin
=subprocess
.PIPE
, stdout
=sys
.stdout
, stderr
=subprocess
.STDOUT
)
43 self
.process
.stdin
.write(self
.data
)
44 self
.process
.stdin
.close()
45 self
.process
.communicate()
47 thread
= threading
.Thread(target
=target
)
53 if sys
.version_info
< (2, 6):
54 os
.kill(self
.process
.pid
, signal
.SIGKILL
)
56 self
.process
.terminate()
59 # Test names are the C files without the .c extension.
60 # These have worked and should keep working always - regression tests.
62 "cpu/cpu_alu/cpu_alu",
74 "audio/atrac/setdata",
76 "audio/sascore/sascore",
77 "audio/sascore/adsrcurve",
78 "audio/sascore/getheight",
79 "audio/sascore/keyoff",
80 "audio/sascore/keyon",
81 "audio/sascore/noise",
82 "audio/sascore/outputmode",
83 "audio/sascore/pause",
85 "audio/sascore/pitch",
89 "ctrl/sampling/sampling",
90 "ctrl/sampling2/sampling2",
93 "display/vblankmulti",
98 "font/fontinfobyindex",
101 "font/shadowimagerect",
102 "gpu/callbacks/ge_callbacks",
103 "gpu/commands/blocktransfer",
108 "hle/check_not_used_uids",
111 "intr/vblank/vblank",
127 "threads/alarm/alarm",
128 "threads/alarm/cancel/cancel",
129 "threads/alarm/refer/refer",
130 "threads/alarm/set/set",
131 "threads/callbacks/callbacks",
132 "threads/callbacks/check",
133 "threads/callbacks/create",
134 "threads/callbacks/delete",
135 "threads/callbacks/exit",
136 "threads/callbacks/refer",
137 "threads/events/events",
138 "threads/events/cancel/cancel",
139 "threads/events/clear/clear",
140 "threads/events/create/create",
141 "threads/events/delete/delete",
142 "threads/events/poll/poll",
143 "threads/events/refer/refer",
144 "threads/events/set/set",
145 "threads/events/wait/wait",
147 "threads/fpl/allocate",
148 "threads/fpl/cancel",
149 "threads/fpl/create",
150 "threads/fpl/delete",
153 "threads/fpl/priority",
154 "threads/fpl/tryallocate",
156 "threads/lwmutex/create",
157 "threads/lwmutex/delete",
158 "threads/lwmutex/lock",
159 "threads/lwmutex/priority",
160 "threads/lwmutex/refer",
161 "threads/lwmutex/try",
162 "threads/lwmutex/try600",
163 "threads/lwmutex/unlock",
165 "threads/mbx/cancel/cancel",
166 "threads/mbx/create/create",
167 "threads/mbx/delete/delete",
168 "threads/mbx/poll/poll",
169 "threads/mbx/priority/priority",
170 "threads/mbx/receive/receive",
171 "threads/mbx/refer/refer",
172 "threads/mbx/send/send",
173 "threads/msgpipe/msgpipe",
174 "threads/msgpipe/cancel",
175 "threads/msgpipe/create",
176 "threads/msgpipe/data",
177 "threads/msgpipe/delete",
178 "threads/msgpipe/receive",
179 "threads/msgpipe/refer",
180 "threads/msgpipe/send",
181 "threads/msgpipe/tryreceive",
182 "threads/msgpipe/trysend",
183 "threads/mutex/cancel",
184 "threads/mutex/create",
185 "threads/mutex/delete",
186 "threads/mutex/lock",
187 "threads/mutex/mutex",
188 "threads/mutex/priority",
189 "threads/mutex/refer",
191 "threads/mutex/unlock",
192 "threads/semaphores/semaphores",
193 "threads/semaphores/cancel",
194 "threads/semaphores/create",
195 "threads/semaphores/delete",
196 "threads/semaphores/fifo",
197 "threads/semaphores/poll",
198 "threads/semaphores/priority",
199 "threads/semaphores/refer",
200 "threads/semaphores/signal",
201 "threads/semaphores/wait",
202 "threads/threads/change",
203 "threads/threads/exitstatus",
204 "threads/threads/extend",
205 "threads/threads/refer",
206 "threads/threads/release",
207 "threads/threads/rotate",
208 "threads/threads/stackfree",
209 "threads/threads/start",
210 "threads/threads/suspend",
211 "threads/threads/threadend",
212 "threads/threads/threadmanidlist",
213 "threads/threads/threadmanidtype",
214 "threads/threads/threads",
215 "threads/wakeup/wakeup",
216 "threads/vpl/allocate",
217 "threads/vpl/cancel",
218 "threads/vpl/delete",
222 "threads/vpl/priority",
226 "threads/vtimers/vtimer",
227 "threads/vtimers/cancelhandler",
228 "threads/vtimers/create",
229 "threads/vtimers/delete",
230 "threads/vtimers/getbase",
231 "threads/vtimers/gettime",
232 "threads/vtimers/interrupt",
233 "threads/vtimers/refer",
234 "threads/vtimers/sethandler",
235 "threads/vtimers/settime",
236 "threads/vtimers/start",
237 "threads/vtimers/stop",
238 "utility/savedata/autosave",
239 "utility/savedata/filelist",
240 "utility/savedata/makedata",
241 "utility/systemparam/systemparam",
243 "power/volatile/lock",
244 "power/volatile/trylock",
245 "power/volatile/unlock",
248 "io/directory/directory",
249 "video/mpeg/ringbuffer/construct",
250 "video/mpeg/ringbuffer/destruct",
251 "video/mpeg/ringbuffer/memsize",
252 "video/mpeg/ringbuffer/packnum",
253 "video/psmfplayer/getvideodata",
257 # These are the next tests up for fixing. These run by default.
258 "cpu/cpu_alu/cpu_branch",
260 "audio/atrac/atractest",
261 "audio/atrac/decode",
262 "audio/atrac/resetting",
263 "audio/sceaudio/datalen",
264 "audio/sceaudio/output",
265 "audio/sceaudio/reserve",
266 "audio/sascore/setadsr",
269 "threads/callbacks/cancel",
270 "threads/callbacks/count",
271 "threads/callbacks/notify",
272 "threads/scheduling/dispatch",
273 "threads/scheduling/scheduling",
274 "threads/threads/create",
275 "threads/threads/terminate",
276 "threads/vpl/create",
277 "utility/savedata/getsize",
278 "utility/savedata/idlist",
279 "utility/savedata/sizes",
280 "utility/msgdialog/abort",
281 "utility/msgdialog/dialog",
282 "gpu/commands/basic",
283 "gpu/commands/blend",
284 "gpu/commands/material",
285 "gpu/complex/complex",
286 "gpu/displaylist/state",
289 "gpu/reflection/reflection",
290 "gpu/rendertarget/rendertarget",
291 "gpu/signals/continue",
294 "gpu/signals/simple",
295 "gpu/signals/suspend",
298 "gpu/triangle/triangle",
301 "font/charglyphimage",
302 "font/charglyphimageclip",
309 "font/shadowglyphimage",
310 "font/shadowglyphimageclip",
316 # Doesn't work on a PSP for security reasons, hangs in PPSSPP currently.
317 # Commented out to make tests run much faster.
318 #"modules/loadexec/loader",
328 "umd/raw_access/raw_access",
331 "video/mpeg/ringbuffer/avail",
333 "video/pmf_simple/pmf_simple",
334 "video/psmfplayer/basic",
338 # These are the tests we ignore (not important, or impossible to run)
347 global PPSSPP_EXE
, TEST_ROOT
348 if not os
.path
.exists("pspautotests"):
349 if os
.path
.exists(os
.path
.dirname(__file__
) + "/pspautotests"):
350 TEST_ROOT
= os
.path
.dirname(__file__
) + "/pspautotests/tests/";
352 print("Please run git submodule init; git submodule update;")
355 if not os
.path
.exists(TEST_ROOT
+ "cpu/cpu_alu/cpu_alu.prx"):
356 print("Please install the pspsdk and run make in common/ and in all the tests")
357 print("(checked for existence of cpu/cpu_alu/cpu_alu.prx)")
360 possible_exes
= [glob
.glob(f
) for f
in PPSSPP_EXECUTABLES
]
361 possible_exes
= [x
for sublist
in possible_exes
for x
in sublist
]
362 existing
= filter(os
.path
.exists
, possible_exes
)
364 PPSSPP_EXE
= max((os
.path
.getmtime(f
), f
) for f
in existing
)[1]
369 print("PPSSPPHeadless executable missing, please build one.")
377 def run_tests(test_list
, args
):
378 global PPSSPP_EXE
, TIMEOUT
383 for test
in test_list
:
385 elf_filename
= TEST_ROOT
+ test
+ ".prx"
386 if not os
.path
.exists(elf_filename
):
387 print("WARNING: no prx, trying elf")
388 elf_filename
= TEST_ROOT
+ test
+ ".elf"
390 test_filenames
.append(elf_filename
)
392 if len(test_filenames
):
393 # TODO: Maybe --compare should detect --graphics?
394 cmdline
= [PPSSPP_EXE
, '--root', TEST_ROOT
+ '../', '--compare', '--timeout=' + str(TIMEOUT
), '@-']
395 cmdline
.extend([i
for i
in args
if i
not in ['-g', '-m']])
397 c
= Command(cmdline
, '\n'.join(test_filenames
))
398 c
.run(TIMEOUT
* len(test_filenames
))
400 print("Ran " + PPSSPP_EXE
)
408 for arg
in sys
.argv
[1:]:
409 if arg
== '--teamcity':
421 tests
= tests_next
+ tests_good
422 elif '-m' in args
and '-g' in args
:
423 tests
= [i
for i
in tests_good
if i
.startswith(tests
[0])]
425 tests
= [i
for i
in tests_next
+ tests_good
if i
.startswith(tests
[0])]
427 run_tests(tests
, args
)