Skip to content

Commit e00b442

Browse files
committed
[GR-65947] Reduce console noise for mx.abort
PullRequest: mx/1936
2 parents 767afd4 + ded40c7 commit e00b442

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/mx/_impl/mx.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13656,7 +13656,15 @@ def redirect(pid, stream, f, logTask):
1365613656
if retcode and nonZeroIsFatal:
1365713657
if _opts.verbose:
1365813658
log('[exit code: ' + str(retcode) + ']')
13659-
abort(retcode, context=subprocess.CalledProcessError(retcode, cmd_line))
13659+
from .mx_unittest import _junit_wrapper_main_class
13660+
context = None
13661+
if not _junit_wrapper_main_class in args:
13662+
context = str(subprocess.CalledProcessError(retcode, cmd_line))
13663+
max_len = 1024
13664+
if not _opts.verbose and len(context) > max_len:
13665+
half = int(max_len / 2)
13666+
context = f"Truncated {context[:half]} ... {context[-half:]}"
13667+
abort(retcode, context=context)
1366013668

1366113669
return retcode
1366213670

src/mx/_impl/mx_unittest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,14 +450,15 @@ def add_unittest_argument(*args, **kwargs):
450450
"""
451451
_extra_unittest_arguments.append((args, kwargs))
452452

453+
_junit_wrapper_main_class = 'com.oracle.mxtool.junit.MxJUnitWrapper'
453454

454455
def _unittest(args, annotations, junit_args, prefixCp="", blacklist=None, whitelist=None, regex=None, suite=None, **extra_args):
455456
testfile = os.environ.get('MX_TESTFILE', None)
456457
if testfile is None:
457458
(_, testfile) = tempfile.mkstemp(".testclasses", "mxtool")
458459
os.close(_)
459460

460-
mainClass = 'com.oracle.mxtool.junit.MxJUnitWrapper'
461+
mainClass = _junit_wrapper_main_class
461462
mx.build(['--no-daemon', '--dependencies', 'JUNIT_TOOL'])
462463
coreCp = mx.classpath(['JUNIT_TOOL'])
463464

src/mx/mx_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# The version must be updated for every PR (checked in CI) and the comment should reflect the PR's issue
2-
version = "7.55.3" # GR-65612
2+
version = "7.55.4" # GR-65947: Reduce noise on abort

0 commit comments

Comments
 (0)