# HG changeset patch # User Doug Simon # Date 1381421240 -7200 # Node ID fbe1ee508936840282cf88df663e39ad526b367b # Parent 23ccaa863edad08ed2a0ed93fbafdb91fcfa9f41 added ability to suppress duplicate lines on an output stream and used it to filter the GC verification log messages in the gate diff -r 23ccaa863eda -r fbe1ee508936 mx/commands.py --- a/mx/commands.py Thu Oct 10 16:14:55 2013 +0200 +++ b/mx/commands.py Thu Oct 10 18:07:20 2013 +0200 @@ -951,12 +951,14 @@ with VM('graal', 'product'): t = Task('BootstrapWithGCVerification:product') - vm(['-XX:+UnlockDiagnosticVMOptions', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version']) + out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write + vm(['-XX:+UnlockDiagnosticVMOptions', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out) tasks.append(t.stop()) with VM('graal', 'product'): t = Task('BootstrapWithG1GCVerification:product') - vm(['-XX:+UnlockDiagnosticVMOptions', '-XX:-UseSerialGC', '-XX:+UseG1GC', '-XX:+UseNewCode', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version']) + out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write + vm(['-XX:+UnlockDiagnosticVMOptions', '-XX:-UseSerialGC', '-XX:+UseG1GC', '-XX:+UseNewCode', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out) tasks.append(t.stop()) with VM('graal', 'product'): diff -r 23ccaa863eda -r fbe1ee508936 mxtool/mx.py --- a/mxtool/mx.py Thu Oct 10 16:14:55 2013 +0200 +++ b/mxtool/mx.py Thu Oct 10 18:07:20 2013 +0200 @@ -158,7 +158,7 @@ _mainSuite = None _opts = None _java = None -_check_global_structures = True # can be set False to allow suites with duplicate definitions to load without aborting +_check_global_structures = True # can be set False to allow suites with duplicate definitions to load without aborting """ @@ -1277,6 +1277,36 @@ return name """ +Utility for filtering duplicate lines. +""" +class DuplicateSuppressingStream: + """ + Creates an object that will suppress duplicate lines sent to 'out'. + The lines considered for suppression are those that contain one of the + strings in 'restrictTo' if it is not None. + """ + def __init__(self, restrictTo=None, out=sys.stdout): + self.restrictTo = restrictTo + self.seen = set() + self.out = out + + def isSuppressionCandidate(self, line): + if self.restrictTo: + for p in self.restrictTo: + if p in line: + return True + return False + else: + return True + + def write(self, line): + if self.isSuppressionCandidate(line): + if line in self.seen: + return + self.seen.add(line) + self.out.write(line) + +""" A JavaCompliance simplifies comparing Java compliance values extracted from a JDK version string. """ class JavaCompliance: @@ -2518,7 +2548,7 @@ return if buildProcessorJars: - ## todo suite specific + # todo suite specific processorjars() projToDist = dict() @@ -2810,7 +2840,7 @@ if exists(md): return wsdir split = os.path.split(wsdir) - if split[0] == wsdir: # root directory + if split[0] == wsdir: # root directory return None else: return _find_eclipse_wsroot(split[0])