@@ -336,13 +336,13 @@ def _dev_pythonhome():
336
336
return os .path .join (SUITE .dir , "graalpython" )
337
337
338
338
339
- def punittest (args , report = False ):
339
+ def punittest (ars , report = False ):
340
340
"""
341
- Runs GraalPython junit tests and memory leak tests, which can be skipped using --no-leak-tests.
342
-
343
- Any other arguments are forwarded to mx's unittest function. If there is no explicit test filter
344
- in the arguments array, then we append filter that includes all GraalPython junit tests.
341
+ Runs GraalPython junit tests, TCK, and memory leak tests, which can be skipped using --no-leak-tests.
342
+ Pass --regex to further filter the junit and TSK tests. GraalPy tests are always run in two configurations:
343
+ with language home on filesystem and with language home served from the Truffle resources.
345
344
"""
345
+ args = [] if ars is None else ars
346
346
@dataclass
347
347
class TestConfig :
348
348
args : list
@@ -357,25 +357,19 @@ def __str__(self):
357
357
skip_leak_tests = True
358
358
args .remove ("--no-leak-tests" )
359
359
360
- if "--regex" in args :
361
- configs += [
362
- TestConfig (args , True ),
363
- TestConfig (args , False ),
364
- ]
365
- else :
366
- configs += [
367
- TestConfig (['--regex' , r'graal\.python' ], True ),
368
- TestConfig (['--regex' , r'graal\.python' ], False ),
369
- # TCK suite is not compatible with the PythonMxUnittestConfig,
370
- # so it must have its own run and the useResources config is ignored
371
- # On top of that mx unittest with --regex does not recognize that
372
- # GRAALPYTHON_UNIT_TESTS are not needed, and still includes them
373
- # and still applies PythonMxUnittestConfig
374
- TestConfig (['com.oracle.truffle.tck.tests' ], False ),
375
- TestConfig (['-Dpython.AutomaticAsyncActions=false' , '--regex' , r'com\.oracle\.graal\.python\.test\.integration\.advanced\.AsyncActionThreadingTest' ], True , False ),
376
- ]
377
- for c in configs :
378
- c .args += args
360
+ # Note: we must use filters instead of --regex so that mx correctly processes the unit test configs,
361
+ # but it is OK to apply --regex on top of the filters
362
+ graalpy_tests = ['com.oracle.graal.python.test' , 'com.oracle.graal.python.pegparser.test' ]
363
+ configs += [
364
+ TestConfig (graalpy_tests + args , True ),
365
+ TestConfig (graalpy_tests + args , False ),
366
+ # TCK suite is not compatible with the PythonMxUnittestConfig,
367
+ # so it must have its own run and the useResources config is ignored
368
+ TestConfig (['com.oracle.truffle.tck.tests' ] + args , False ),
369
+ ]
370
+ if '--regex' not in args :
371
+ async_regex = ['--regex' , r'com\.oracle\.graal\.python\.test\.integration\.advanced\.AsyncActionThreadingTest' ]
372
+ configs .append (TestConfig (['-Dpython.AutomaticAsyncActions=false' , 'com.oracle.graal.python.test' ] + async_regex + args , True , False ))
379
373
380
374
# Workaround until imports update pulls in GR-48113
381
375
sulong_native = mx .distribution ('SULONG_NATIVE' , fatalIfMissing = True )
@@ -1435,16 +1429,7 @@ def graalpython_gate_runner(args, tasks):
1435
1429
"--verbose" ,
1436
1430
"--no-leak-tests" ,
1437
1431
"--regex" ,
1438
- r'graal\.python\.test\.(integration\.)?(advanced\.Benchmark|advanced\.ResourcesTest|basic|builtin|decorator|generator|interop|util)'
1439
- ],
1440
- report = True
1441
- )
1442
- punittest (
1443
- [
1444
- "--verbose" ,
1445
- "--no-leak-tests" ,
1446
- "--regex" ,
1447
- r'(com\.oracle\.truffle\.tck\.tests)'
1432
+ r'((com\.oracle\.truffle\.tck\.tests)|(graal\.python\.test\.(integration\.)?(advanced\.Benchmark|advanced\.ResourcesTest|basic|builtin|decorator|generator|interop|util)))'
1448
1433
],
1449
1434
report = True
1450
1435
)
0 commit comments