Skip to content

Commit 8fc57d1

Browse files
committed
Add timeout check for all test
1 parent c252b4b commit 8fc57d1

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tests/functional/test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
sys.path.append(ZXBASIC_ROOT) # TODO: consider moving test.py to another place to avoid this
3131

3232
# Now we can import the modules from the root
33+
import api.utils # noqa
3334
import libzxbc # noqa
3435
import libzxbasm # noqa
3536
import libzxbpp # noqa
@@ -46,6 +47,7 @@
4647
STDERR = None
4748
INLINE = True # Set to false to use system Shell
4849
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
4951

5052

5153
class TempTestFile(object):
@@ -239,6 +241,7 @@ def updateTest(tfname, pattern_):
239241
f.write(''.join(lines))
240242

241243

244+
@api.utils.timeout(TIMEOUT)
242245
def testPREPRO(fname, pattern_=None, inline=None, cmdline_args=None):
243246
""" Test preprocessing file. Test is done by preprocessing the file and then
244247
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):
297300
return result
298301

299302

303+
@api.utils.timeout(TIMEOUT)
300304
def testASM(fname, inline=None, cmdline_args=None):
301305
""" Test assembling an ASM (.asm) file. Test is done by assembling the source code into a binary and then
302306
comparing the output file against an expected binary output.
@@ -339,6 +343,7 @@ def testASM(fname, inline=None, cmdline_args=None):
339343
return result
340344

341345

346+
@api.utils.timeout(TIMEOUT)
342347
def testBAS(fname, filter_=None, inline=None, cmdline_args=None):
343348
""" Test compiling a BASIC (.bas) file. Test is done by compiling the source code into asm and then
344349
comparing the output asm against an expected asm output. The output asm file can optionally be filtered

0 commit comments

Comments
 (0)