Skip to content

Commit fcd75db

Browse files
committed
Rename '_python_svm_unittest' to '_run_python_unittests' and generalize it.
1 parent 2c3444c commit fcd75db

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

mx.graalpython/mx_graalpython.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ def python3_unittests(args):
265265
# mx gate --tags pythontest
266266
# mx gate --tags fulltest
267267

268+
AOT_INCOMPATIBLE_TESTS = ["test_interop.py"]
268269

269270
class GraalPythonTags(object):
270271
junit = 'python-junit'
@@ -348,20 +349,18 @@ def gate_unittests(args=[], subdir=""):
348349
mx.run(["python3"] + test_args, nonZeroIsFatal=True)
349350

350351

351-
def _python_svm_unittest(svm_image):
352-
suite_dir = _suite.dir
353-
llvm_home = mx_subst.path_substitutions.substitute('--native.Dllvm.home=<path:SULONG_LIBS>')
354-
352+
def _run_python_unittests(python_binary, args=[], aot_compatible=True, exclude=[]):
355353
# tests root directory
356-
tests_folder = os.path.join(suite_dir, "graalpython", "com.oracle.graal.python.test", "src", "tests")
354+
tests_folder = os.path.join(_suite.dir, "graalpython", "com.oracle.graal.python.test", "src", "tests")
357355

358356
# list of excluded tests
359-
excluded = ["test_interop.py"]
357+
if aot_compatible:
358+
exclude += AOT_INCOMPATIBLE_TESTS
360359

361360
def is_included(path):
362361
if path.endswith(".py"):
363362
basename = os.path.basename(path)
364-
return basename.startswith("test_") and basename not in excluded
363+
return basename.startswith("test_") and basename not in exclude
365364
return False
366365

367366
# list all 1st-level tests and exclude the SVM-incompatible ones
@@ -378,13 +377,9 @@ def is_included(path):
378377
except OSError:
379378
pass
380379

381-
args = ["--python.CoreHome=%s" % os.path.join(suite_dir, "graalpython", "lib-graalpython"),
382-
"--python.StdLibHome=%s" % os.path.join(suite_dir, "graalpython", "lib-python/3"),
383-
llvm_home,
384-
os.path.join(suite_dir, "graalpython", "com.oracle.graal.python.test", "src", "graalpytest.py"),
385-
"-v"]
380+
args += [os.path.join(_suite.dir, "graalpython", "com.oracle.graal.python.test", "src", "graalpytest.py"), "-v"]
386381
args += testfiles
387-
return mx.run([svm_image] + args, nonZeroIsFatal=True)
382+
return mx.run([python_binary] + args, nonZeroIsFatal=True)
388383

389384

390385
def graalpython_gate_runner(args, tasks):
@@ -414,7 +409,11 @@ def graalpython_gate_runner(args, tasks):
414409
if not os.path.exists(svm_image_name):
415410
python_svm(["-h"])
416411
else:
417-
_python_svm_unittest(svm_image_name)
412+
llvm_home = mx_subst.path_substitutions.substitute('--native.Dllvm.home=<path:SULONG_LIBS>')
413+
args = ["--python.CoreHome=%s" % os.path.join(_suite.dir, "graalpython", "lib-graalpython"),
414+
"--python.StdLibHome=%s" % os.path.join(_suite.dir, "graalpython", "lib-python/3"),
415+
llvm_home]
416+
_run_python_unittests(svm_image_name, args)
418417

419418
with Task('GraalPython apptests', tasks, tags=[GraalPythonTags.apptests]) as task:
420419
if task:

0 commit comments

Comments
 (0)