Skip to content

Commit

Permalink
[GR-38506] Implement test report collection for compiler.
Browse files Browse the repository at this point in the history
PullRequest: graal/11782
  • Loading branch information
dougxc committed Jul 21, 2022
2 parents dfdbdb5 + c31484f commit 012f35f
Showing 1 changed file with 18 additions and 31 deletions.
49 changes: 18 additions & 31 deletions compiler/mx.compiler/mx_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import tarfile
import subprocess
import tempfile
import sys
import csv

import mx_truffle
Expand All @@ -63,23 +62,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')

Expand Down Expand Up @@ -327,19 +310,23 @@ 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):
self.name = name
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):
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
Expand Down Expand Up @@ -479,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
Expand Down Expand Up @@ -510,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))

Expand Down Expand Up @@ -555,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 #
Expand All @@ -566,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
Expand All @@ -581,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
Expand All @@ -602,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 = [
Expand Down Expand Up @@ -1120,7 +1107,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)
Expand Down

0 comments on commit 012f35f

Please sign in to comment.