@@ -359,6 +359,45 @@ def gate_unittests(args=[], subdir=""):
359
359
mx .run (["python3" ] + test_args , nonZeroIsFatal = True )
360
360
361
361
362
+ def _python_svm_unittest (svm_image ):
363
+ suite_dir = _suite .dir
364
+ llvm_home = mx_subst .path_substitutions .substitute ('--native.Dllvm.home=<path:SULONG_LIBS>' )
365
+
366
+ # tests root directory
367
+ tests_folder = os .path .join (suite_dir , "graalpython" , "com.oracle.graal.python.test" , "src" , "tests" )
368
+
369
+ # list of excluded tests
370
+ excluded = ["test_interop.py" ]
371
+
372
+ def is_included (path ):
373
+ if path .endswith (".py" ):
374
+ basename = os .path .basename (path )
375
+ return basename .startswith ("test_" ) and basename not in excluded
376
+ return False
377
+
378
+ # list all 1st-level tests and exclude the SVM-incompatible ones
379
+ testfiles = []
380
+ paths = [tests_folder ]
381
+ while paths :
382
+ path = paths .pop ()
383
+ if is_included (path ):
384
+ testfiles .append (path )
385
+ else :
386
+ try :
387
+ paths += [(path + f if path .endswith ("/" ) else "%s/%s" % (path , f )) for f in
388
+ os .listdir (path )]
389
+ except OSError :
390
+ pass
391
+
392
+ args = ["--python.CoreHome=%s" % os .path .join (suite_dir , "graalpython" , "lib-graalpython" ),
393
+ "--python.StdLibHome=%s" % os .path .join (suite_dir , "graalpython" , "lib-python/3" ),
394
+ llvm_home ,
395
+ os .path .join (suite_dir , "graalpython" , "com.oracle.graal.python.test" , "src" , "graalpytest.py" ),
396
+ "-v" ]
397
+ args += testfiles
398
+ return mx .run ([svm_image ] + args , nonZeroIsFatal = True )
399
+
400
+
362
401
def graalpython_gate_runner (args , tasks ):
363
402
with Task ('GraalPython JUnit' , tasks , tags = [GraalPythonTags .junit ]) as task :
364
403
if task :
@@ -382,39 +421,11 @@ def graalpython_gate_runner(args, tasks):
382
421
383
422
with Task ('GraalPython Python tests on SVM' , tasks , tags = [GraalPythonTags .svmunit ]) as task :
384
423
if task :
385
- if not os .path .exists ("./graalpython-svm" ):
424
+ svm_image_name = "./graalpython-svm"
425
+ if not os .path .exists (svm_image_name ):
386
426
python_svm (["-h" ])
387
- if os .path .exists ("./graalpython-svm" ):
388
- langhome = mx_subst .path_substitutions .substitute ('--native.Dllvm.home=<path:SULONG_LIBS>' )
389
-
390
- # tests root directory
391
- tests_folder = "graalpython/com.oracle.graal.python.test/src/tests/"
392
-
393
- # list of excluded tests
394
- excluded = ["test_interop.py" ]
395
-
396
- def is_included (path ):
397
- if path .endswith (".py" ):
398
- basename = path .rpartition ("/" )[2 ]
399
- return basename .startswith ("test_" ) and basename not in excluded
400
- return False
401
-
402
- # list all 1st-level tests and exclude the SVM-incompatible ones
403
- testfiles = []
404
- paths = [tests_folder ]
405
- while paths :
406
- path = paths .pop ()
407
- if is_included (path ):
408
- testfiles .append (path )
409
- else :
410
- try :
411
- paths += [(path + f if path .endswith ("/" ) else "%s/%s" % (path , f )) for f in
412
- os .listdir (path )]
413
- except OSError :
414
- pass
415
-
416
- test_args = ["graalpython/com.oracle.graal.python.test/src/graalpytest.py" , "-v" ] + testfiles
417
- mx .run (["./graalpython-svm" , "--python.CoreHome=graalpython/lib-graalpython" , "--python.StdLibHome=graalpython/lib-python/3" , langhome ] + test_args , nonZeroIsFatal = True )
427
+ else :
428
+ _python_svm_unittest (svm_image_name )
418
429
419
430
with Task ('GraalPython apptests' , tasks , tags = [GraalPythonTags .apptests ]) as task :
420
431
if task :
0 commit comments