|
30 | 30 | sys.path.append(ZXBASIC_ROOT) # TODO: consider moving test.py to another place to avoid this |
31 | 31 |
|
32 | 32 | # Now we can import the modules from the root |
| 33 | +import api.utils # noqa |
33 | 34 | import libzxbc # noqa |
34 | 35 | import libzxbasm # noqa |
35 | 36 | import libzxbpp # noqa |
|
46 | 47 | STDERR = None |
47 | 48 | INLINE = True # Set to false to use system Shell |
48 | 49 | RAISE_EXCEPTIONS = False # True if we want the testing to abort on compiler crashes |
| 50 | +TIMEOUT = 3 # Max number of seconds a test should last |
49 | 51 |
|
50 | 52 |
|
51 | 53 | class TempTestFile(object): |
@@ -239,6 +241,7 @@ def updateTest(tfname, pattern_): |
239 | 241 | f.write(''.join(lines)) |
240 | 242 |
|
241 | 243 |
|
| 244 | +@api.utils.timeout(TIMEOUT) |
242 | 245 | def testPREPRO(fname, pattern_=None, inline=None, cmdline_args=None): |
243 | 246 | """ Test preprocessing file. Test is done by preprocessing the file and then |
244 | 247 | comparing the output against an expected one. The output file can optionally be filtered |
@@ -297,6 +300,7 @@ def testPREPRO(fname, pattern_=None, inline=None, cmdline_args=None): |
297 | 300 | return result |
298 | 301 |
|
299 | 302 |
|
| 303 | +@api.utils.timeout(TIMEOUT) |
300 | 304 | def testASM(fname, inline=None, cmdline_args=None): |
301 | 305 | """ Test assembling an ASM (.asm) file. Test is done by assembling the source code into a binary and then |
302 | 306 | comparing the output file against an expected binary output. |
@@ -339,6 +343,7 @@ def testASM(fname, inline=None, cmdline_args=None): |
339 | 343 | return result |
340 | 344 |
|
341 | 345 |
|
| 346 | +@api.utils.timeout(TIMEOUT) |
342 | 347 | def testBAS(fname, filter_=None, inline=None, cmdline_args=None): |
343 | 348 | """ Test compiling a BASIC (.bas) file. Test is done by compiling the source code into asm and then |
344 | 349 | comparing the output asm against an expected asm output. The output asm file can optionally be filtered |
|
0 commit comments