Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Unified Diff: tools/presubmit.py

Issue 2653753007: [tests] Cleanup tests that use assertOptimized()/assertUnoptimized(). (Closed)
Patch Set: Addressing comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/unary-minus-deopt.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/presubmit.py
diff --git a/tools/presubmit.py b/tools/presubmit.py
index 51ca99165685ce6b21cf8a897f10d36f9d9ff8ad..9e9394560bfd2192992adb957d1d5584de0994a4 100755
--- a/tools/presubmit.py
+++ b/tools/presubmit.py
@@ -69,6 +69,10 @@ LINT_RULES = """
LINT_OUTPUT_PATTERN = re.compile(r'^.+[:(]\d+[:)]|^Done processing')
FLAGS_LINE = re.compile("//\s*Flags:.*--([A-z0-9-])+_[A-z0-9].*\n")
+ASSERT_OPTIMIZED_PATTERN = re.compile("assertOptimized")
+FLAGS_ENABLE_OPT = re.compile("//\s*Flags:.*--(crankshaft|turbo)[^-].*\n")
+ASSERT_UNOPTIMIZED_PATTERN = re.compile("assertUnoptimized")
+FLAGS_NO_ALWAYS_OPT = re.compile("//\s*Flags:.*--no-?always-opt.*\n")
TOOLS_PATH = dirname(abspath(__file__))
@@ -401,11 +405,22 @@ class SourceProcessor(SourceFileProcessor):
print "%s does not end with a single new line." % name
result = False
# Sanitize flags for fuzzer.
- if "mjsunit" in name:
+ if "mjsunit" in name or "debugger" in name:
match = FLAGS_LINE.search(contents)
if match:
print "%s Flags should use '-' (not '_')" % name
result = False
+ if not "mjsunit/mjsunit.js" in name:
+ if ASSERT_OPTIMIZED_PATTERN.search(contents) and \
+ not FLAGS_ENABLE_OPT.search(contents):
+ print "%s Flag --crankshaft or --turbo should be set " \
+ "if assertOptimized() is used" % name
+ result = False
+ if ASSERT_UNOPTIMIZED_PATTERN.search(contents) and \
+ not FLAGS_NO_ALWAYS_OPT.search(contents):
+ print "%s Flag --no-always-opt should be set if " \
+ "assertUnoptimized() is used" % name
+ result = False
return result
def ProcessFiles(self, files):
« no previous file with comments | « test/mjsunit/unary-minus-deopt.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698