@@ -222,10 +222,33 @@ def compare_unittests(args):
222
222
mx .run ([sys .executable , "graalpython/com.oracle.graal.python.test/src/compare_unittests.py" , "-v" ] + args )
223
223
224
224
225
+ def run_cpython_test (args ):
226
+ import glob
227
+ interp_args = []
228
+ globs = []
229
+ test_args = []
230
+ for arg in args :
231
+ if arg .startswith ("-" ):
232
+ if not globs :
233
+ interp_args .append (arg )
234
+ else :
235
+ test_args .append (arg )
236
+ else :
237
+ globs .append (arg )
238
+ testfiles = []
239
+ for g in globs :
240
+ testfiles += glob .glob (os .path .join (SUITE .dir , "graalpython/lib-python/3/test" , f"{ g } *" ))
241
+ mx .run ([python_gvm ()] + interp_args + [
242
+ os .path .join (SUITE .dir , "graalpython/com.oracle.graal.python.test/src/tests/run_cpython_test.py" ),
243
+ ] + test_args + testfiles )
244
+
245
+
225
246
def retag_unittests (args ):
226
247
"""run the cPython stdlib unittests"""
227
248
parser = ArgumentParser ('mx python-retag-unittests' )
228
249
parser .add_argument ('--upload-results-to' )
250
+ parser .add_argument ('--inspect' , action = 'store_true' )
251
+ parser .add_argument ('-debug-java' , action = 'store_true' )
229
252
parsed_args , remaining_args = parser .parse_known_args (args )
230
253
env = os .environ .copy ()
231
254
env .update (
@@ -235,9 +258,14 @@ def retag_unittests(args):
235
258
args = [
236
259
'--experimental-options=true' ,
237
260
'--python.CatchAllExceptions=true' ,
238
- '--python.WithThread=true' ,
261
+ '--python.WithThread=true' ]
262
+ if parsed_args .inspect :
263
+ args .append ('--inspect' )
264
+ if parsed_args .debug_java :
265
+ args .append ('-debug-java' )
266
+ args += [
239
267
'graalpython/com.oracle.graal.python.test/src/tests/test_tagged_unittests.py' ,
240
- '--retag' ,
268
+ '--retag'
241
269
]
242
270
mx .run ([python_gvm ()] + args + remaining_args , env = env )
243
271
if parsed_args .upload_results_to :
@@ -1757,6 +1785,7 @@ def python_clean(args):
1757
1785
'python-unittests' : [python3_unittests , '' ],
1758
1786
'python-compare-unittests' : [compare_unittests , '' ],
1759
1787
'python-retag-unittests' : [retag_unittests , '' ],
1788
+ 'python-run-cpython-unittest' : [run_cpython_test , 'test-name' ],
1760
1789
'python-update-unittest-tags' : [update_unittest_tags , '' ],
1761
1790
'python-import-for-graal' : [checkout_find_version_for_graalvm , '' ],
1762
1791
'nativebuild' : [nativebuild , '' ],
0 commit comments