@@ -336,13 +336,13 @@ def _dev_pythonhome():
336336 return os .path .join (SUITE .dir , "graalpython" )
337337
338338
339- def punittest (args , report = False ):
339+ def punittest (ars , report = False ):
340340 """
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.
345344 """
345+ args = [] if ars is None else ars
346346 @dataclass
347347 class TestConfig :
348348 args : list
@@ -357,25 +357,19 @@ def __str__(self):
357357 skip_leak_tests = True
358358 args .remove ("--no-leak-tests" )
359359
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 ))
379373
380374 # Workaround until imports update pulls in GR-48113
381375 sulong_native = mx .distribution ('SULONG_NATIVE' , fatalIfMissing = True )
@@ -1435,16 +1429,7 @@ def graalpython_gate_runner(args, tasks):
14351429 "--verbose" ,
14361430 "--no-leak-tests" ,
14371431 "--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)))'
14481433 ],
14491434 report = True
14501435 )
0 commit comments