From fa08db9e2efec3e4e65b4cd817086b5839e99095 Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Fri, 13 May 2022 16:14:58 +0200 Subject: [PATCH 1/2] remove python2 support --- compiler/mx.compiler/mx_compiler.py | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/compiler/mx.compiler/mx_compiler.py b/compiler/mx.compiler/mx_compiler.py index dd6733804180..ce16ac501f21 100644 --- a/compiler/mx.compiler/mx_compiler.py +++ b/compiler/mx.compiler/mx_compiler.py @@ -63,23 +63,7 @@ import shlex import json -# Temporary imports and (re)definitions while porting mx from Python 2 to Python 3 -if sys.version_info[0] < 3: - from StringIO import StringIO - _unicode = unicode # pylint: disable=undefined-variable - def _decode(x): - return x - def _encode(x): - return x -else: - from io import StringIO - _unicode = str - def _decode(x): - return x.decode() - def _encode(x): - return x.encode() - -_basestring = (str, _unicode) +from io import StringIO _suite = mx.suite('compiler') @@ -335,7 +319,7 @@ def __init__(self, name, args, tags, suppress=None): self.args = args self.suppress = suppress self.tags = tags - if tags is not None and (not isinstance(tags, list) or all(not isinstance(x, _basestring) for x in tags)): + if tags is not None and (not isinstance(tags, list) or all(not isinstance(x, str) for x in tags)): mx.abort("Gate tag argument must be a list of strings, tag argument:" + str(tags)) def run(self, tasks, extraVMarguments=None): @@ -1120,7 +1104,7 @@ def add_serviceprovider(service, provider, version): pass else: provider = m.group(2) - for service in _decode(contents_supplier()).strip().split(os.linesep): + for service in (contents_supplier()).decode().strip().split(os.linesep): assert service version = m.group(1) add_serviceprovider(service, provider, version) From c31484f5f7b353f7c400a3767a80f26e152bc930 Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Tue, 19 Jul 2022 09:33:01 +0200 Subject: [PATCH 2/2] add CI test report creation --- compiler/mx.compiler/mx_compiler.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/compiler/mx.compiler/mx_compiler.py b/compiler/mx.compiler/mx_compiler.py index ce16ac501f21..b6bc4fca6fc5 100644 --- a/compiler/mx.compiler/mx_compiler.py +++ b/compiler/mx.compiler/mx_compiler.py @@ -36,7 +36,6 @@ import tarfile import subprocess import tempfile -import sys import csv import mx_truffle @@ -311,7 +310,11 @@ def run(self, suites, tasks, extraVMarguments=None, extraUnitTestArguments=None) # If this is a coverage execution, we want maximal coverage # and thus must not fail fast. extra_args += ['--fail-fast'] - if t: unittest(['--suite', suite] + extra_args + self.args + _remove_empty_entries(extraVMarguments) + _remove_empty_entries(extraUnitTestArguments)) + if t: + tags = {'task' : t.title} + unittest(['--suite', suite] + extra_args + self.args + + _remove_empty_entries(extraVMarguments) + + _remove_empty_entries(extraUnitTestArguments), test_report_tags=tags) class BootstrapTest: def __init__(self, name, args, tags, suppress=None): @@ -323,7 +326,7 @@ def __init__(self, name, args, tags, suppress=None): mx.abort("Gate tag argument must be a list of strings, tag argument:" + str(tags)) def run(self, tasks, extraVMarguments=None): - with Task(self.name, tasks, tags=self.tags) as t: + with Task(self.name, tasks, tags=self.tags, report=True) as t: if t: if self.suppress: out = mx.DuplicateSuppressingStream(self.suppress).write @@ -463,7 +466,7 @@ def compiler_gate_runner(suites, unit_test_runs, bootstrap_tests, tasks, extraVM with Task('CheckCatchFiles', tasks, tags=[Tags.style]) as t: if t: _check_catch_files() - with Task('JDK_java_base_test', tasks, tags=['javabasetest']) as t: + with Task('JDK_java_base_test', tasks, tags=['javabasetest'], report=True) as t: if t: java_base_unittest(_remove_empty_entries(extraVMarguments) + []) # Run unit tests in hosted mode @@ -494,12 +497,12 @@ def compiler_gate_runner(suites, unit_test_runs, bootstrap_tests, tasks, extraVM '-DCompileTheWorld.MultiThreaded=true', '-Dgraal.InlineDuringParsing=false', '-Dgraal.TrackNodeSourcePosition=true', '-DCompileTheWorld.Verbose=false', '-XX:ReservedCodeCacheSize=300m', ] - with Task('CTW:hosted', tasks, tags=GraalTags.ctw) as t: + with Task('CTW:hosted', tasks, tags=GraalTags.ctw, report=True) as t: if t: ctw(ctw_flags, _remove_empty_entries(extraVMarguments)) # Also run ctw with economy mode as a separate task, to be able to filter it with tags - with Task('CTWEconomy:hosted', tasks, tags=GraalTags.ctweconomy) as t: + with Task('CTWEconomy:hosted', tasks, tags=GraalTags.ctweconomy, report=True) as t: if t: ctw(ctw_flags + _graalEconomyFlags, _remove_empty_entries(extraVMarguments)) @@ -539,7 +542,7 @@ def compiler_gate_benchmark_runner(tasks, extraVMarguments=None, prefix=''): dacapo_gate_iterations.update({'tradesoap': -1}) for name in dacapo_suite.benchmarkList(bmSuiteArgs): iterations = dacapo_gate_iterations.get(name, -1) - with Task(prefix + 'DaCapo:' + name, tasks, tags=GraalTags.benchmarktest) as t: + with Task(prefix + 'DaCapo:' + name, tasks, tags=GraalTags.benchmarktest, report=True) as t: if t: _gate_dacapo(name, iterations, benchVmArgs + ['-Dgraal.TrackNodeSourcePosition=true'] + dacapo_esa) # run Scala DaCapo benchmarks # @@ -550,13 +553,13 @@ def compiler_gate_benchmark_runner(tasks, extraVMarguments=None, prefix=''): } for name in scala_dacapo_suite.benchmarkList(bmSuiteArgs): iterations = scala_dacapo_gate_iterations.get(name, -1) - with Task(prefix + 'ScalaDaCapo:' + name, tasks, tags=GraalTags.benchmarktest) as t: + with Task(prefix + 'ScalaDaCapo:' + name, tasks, tags=GraalTags.benchmarktest, report=True) as t: if t: _gate_scala_dacapo(name, iterations, benchVmArgs + ['-Dgraal.TrackNodeSourcePosition=true'] + dacapo_esa) # run benchmark with non default setup # ######################################## # ensure -Xbatch still works - with Task(prefix + 'DaCapo_pmd:BatchMode', tasks, tags=GraalTags.test) as t: + with Task(prefix + 'DaCapo_pmd:BatchMode', tasks, tags=GraalTags.test, report=True) as t: if t: _gate_dacapo('pmd', 1, benchVmArgs + ['-Xbatch']) # ensure benchmark counters still work but omit this test on @@ -565,7 +568,7 @@ def compiler_gate_benchmark_runner(tasks, extraVMarguments=None, prefix=''): out = mx.OutputCapture() mx.run([jdk.java, '-version'], err=subprocess.STDOUT, out=out) if 'fastdebug' not in out.data: - with Task(prefix + 'DaCapo_pmd:BenchmarkCounters', tasks, tags=GraalTags.test) as t: + with Task(prefix + 'DaCapo_pmd:BenchmarkCounters', tasks, tags=GraalTags.test, report=True) as t: if t: fd, logFile = tempfile.mkstemp() os.close(fd) # Don't leak file descriptors @@ -586,11 +589,11 @@ def compiler_gate_benchmark_runner(tasks, extraVMarguments=None, prefix=''): os.remove(logFile) # ensure -Xcomp still works - with Task(prefix + 'XCompMode:product', tasks, tags=GraalTags.test) as t: + with Task(prefix + 'XCompMode:product', tasks, tags=GraalTags.test, report=True) as t: if t: run_vm(_remove_empty_entries(extraVMarguments) + ['-XX:+UseJVMCICompiler', '-Xcomp', '-version']) # ensure -XX:+PreserveFramePointer still works - with Task(prefix + 'DaCapo_pmd:PreserveFramePointer', tasks, tags=GraalTags.test) as t: + with Task(prefix + 'DaCapo_pmd:PreserveFramePointer', tasks, tags=GraalTags.test, report=True) as t: if t: _gate_dacapo('pmd', default_iterations, benchVmArgs + ['-Xmx256M', '-XX:+PreserveFramePointer'], threads=4, force_serial_gc=False, set_start_heap_size=False) graal_unit_test_runs = [