21
21
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22
22
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
23
23
# OF THE POSSIBILITY OF SUCH DAMAGE.
24
+ from __future__ import print_function
25
+
24
26
import os
25
27
import platform
26
28
import re
34
36
import mx_gate
35
37
import mx_sdk
36
38
import mx_subst
37
- import mx_urlrewrites
38
39
from mx_gate import Task
39
40
from mx_graalpython_bench_param import PATH_MESO , BENCHMARKS
40
41
from mx_graalpython_benchmark import PythonBenchmarkSuite , python_vm_registry , CPythonVm , PyPyVm , GraalPythonVm , \
41
- CONFIGURATION_DEFAULT , CONFIGURATION_EXPERIMENTAL_SPLITTING , CONFIGURATION_SANDBOXED
42
+ CONFIGURATION_DEFAULT , CONFIG_EXPERIMENTAL_SPLITTING , CONFIGURATION_SANDBOXED
42
43
from mx_unittest import unittest
43
44
44
45
SUITE = mx .suite ('graalpython' )
@@ -161,7 +162,7 @@ def punittest(args):
161
162
# IMPORTANT! This must not be --suite graalpython, because a
162
163
# --dynamicimports sulong will otherwise not put sulong.jar on the
163
164
# classpath, which means we cannot run our C extension tests!
164
- unittest (args + ['--regex' , '(graal\.python)|(com\.oracle\.truffle\.tck\.tests)' , "-Dgraal.TraceTruffleCompilation=true" ])
165
+ unittest (args + ['--regex' , r '(graal\.python)|(com\.oracle\.truffle\.tck\.tests)' , "-Dgraal.TraceTruffleCompilation=true" ])
165
166
166
167
167
168
def nativebuild (args ):
@@ -247,7 +248,8 @@ def python_svm(args):
247
248
return svm_image
248
249
249
250
250
- def gate_unittests (args = [], subdir = "" ):
251
+ def gate_unittests (args = None , subdir = "" ):
252
+ args = args or []
251
253
_graalpytest_driver = "graalpython/com.oracle.graal.python.test/src/graalpytest.py"
252
254
_test_project = "graalpython/com.oracle.graal.python.test/"
253
255
for idx , arg in enumerate (args ):
@@ -273,7 +275,9 @@ def gate_unittests(args=[], subdir=""):
273
275
mx .command_function ("python" )(["--python.CatchAllExceptions=true" , "--python.OpaqueFilesystem" ] + pre_args + test_args + post_args )
274
276
275
277
276
- def run_python_unittests (python_binary , args = [], aot_compatible = True , exclude = []):
278
+ def run_python_unittests (python_binary , args = None , aot_compatible = True , exclude = None ):
279
+ args = args or []
280
+ exclude = exclude or []
277
281
# tests root directory
278
282
tests_folder = os .path .join (SUITE .dir , "graalpython" , "com.oracle.graal.python.test" , "src" , "tests" )
279
283
@@ -602,7 +606,7 @@ def update_import(name, rev="origin/master", callback=None):
602
606
suitefile = os .path .join (primary .dir , "mx." + primary .name , "suite.py" )
603
607
with open (suitefile , 'r' ) as f :
604
608
contents = f .read ()
605
- dep_re = re .compile ("['\" ]name['\" ]:\s+['\" ]%s['\" ],\s+['\" ]version['\" ]:\s+['\" ]([a-z0-9]+)['\" ]" % name , re .MULTILINE )
609
+ dep_re = re .compile (r "['\"]name['\"]:\s+['\"]%s['\"],\s+['\"]version['\"]:\s+['\"]([a-z0-9]+)['\"]" % name , re .MULTILINE )
606
610
dep_match = dep_re .search (contents )
607
611
if dep_match :
608
612
start = dep_match .start (1 )
@@ -620,7 +624,7 @@ def update_import_cmd(args):
620
624
callback = None
621
625
if name == "sulong" :
622
626
join = os .path .join
623
- callback = lambda : shutil .copy (
627
+ callback = lambda : shutil .copy (
624
628
join (SUITE_SULONG .dir , "include" , "truffle.h" ),
625
629
join (SUITE .dir , "graalpython" , "com.oracle.graal.python.cext" , "include" , "truffle.h" )
626
630
) and shutil .copy (
@@ -676,7 +680,7 @@ def import_python_sources(args):
676
680
pypy_sources = args .pypy
677
681
import_version = args .msg
678
682
679
- print """
683
+ print ( """
680
684
So you think you want to update the inlined sources? Here is how it will go:
681
685
682
686
1. We'll first check the copyrights check overrides file to identify the
@@ -717,7 +721,7 @@ def import_python_sources(args):
717
721
python-import.
718
722
719
723
7. Run the tests and fix any remaining issues.
720
- """ .format (mapping )
724
+ """ .format (mapping ))
721
725
raw_input ("Got it?" )
722
726
723
727
cpy_files = []
@@ -743,7 +747,7 @@ def import_python_sources(args):
743
747
if name .startswith ("test_" ) or name .endswith ("_tests.py" ):
744
748
original_file = inlined_file
745
749
else :
746
- for root , dirs , files in os .walk (pypy_sources ):
750
+ for root , _ , files in os .walk (pypy_sources ):
747
751
if os .path .basename (name ) in files :
748
752
original_file = os .path .join (root , name )
749
753
try :
@@ -761,7 +765,7 @@ def import_python_sources(args):
761
765
name = os .path .basename (inlined_file )
762
766
name = mapping .get (name , name )
763
767
if inlined_file .endswith (".h" ) or inlined_file .endswith (".c" ):
764
- for root , dirs , files in os .walk (python_sources ):
768
+ for root , _ , files in os .walk (python_sources ):
765
769
if os .path .basename (name ) in files :
766
770
original_file = os .path .join (root , name )
767
771
try :
@@ -846,7 +850,7 @@ def _register_vms(namespace):
846
850
python_vm_registry .add_vm (CPythonVm (CONFIGURATION_DEFAULT ), SUITE )
847
851
python_vm_registry .add_vm (PyPyVm (CONFIGURATION_DEFAULT ), SUITE )
848
852
python_vm_registry .add_vm (GraalPythonVm (config_name = CONFIGURATION_DEFAULT ), SUITE , 10 )
849
- python_vm_registry .add_vm (GraalPythonVm (config_name = CONFIGURATION_EXPERIMENTAL_SPLITTING , extra_vm_args = [
853
+ python_vm_registry .add_vm (GraalPythonVm (config_name = CONFIG_EXPERIMENTAL_SPLITTING , extra_vm_args = [
850
854
'-Dgraal.TruffleExperimentalSplitting=true' ,
851
855
'-Dgraal.TruffleExperimentalSplittingAllowForcedSplits=false'
852
856
]), SUITE , 10 )
0 commit comments