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

Side by Side Diff: tools/metrics/histograms/presubmit_bad_message_reasons.py

Issue 2841823007: Fix presubmit_scheme_histograms.py and presubmit_bad_message_reasons.py (Closed)
Patch Set: Fix an old typo in _RunHistogramChecks. Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 # Copyright 2017 The Chromium Authors. All rights reserved. 1 # Copyright 2017 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Check to see if the various BadMessage enums in histograms.xml need to be 5 """Check to see if the various BadMessage enums in histograms.xml need to be
6 updated. This can be called from a chromium PRESUBMIT.py to ensure updates to 6 updated. This can be called from a chromium PRESUBMIT.py to ensure updates to
7 bad_message.h also include the generated changes to histograms.xml 7 bad_message.h also include the generated changes to histograms.xml
8 """ 8 """
9 9
10 import update_histogram_enum 10 import update_histogram_enum
11 11
12 def PrecheckBadMessage(input_api, output_api, histogram_name): 12 def PrecheckBadMessage(input_api, output_api, histogram_name):
13 source_path = '' 13 source_path = ''
14 14
15 # This function is called once per bad_message.h-containing directory. Check 15 # This function is called once per bad_message.h-containing directory. Check
16 # for the |bad_message.h| file, and if present, remember its path. 16 # for the |bad_message.h| file, and if present, remember its path.
17 for f in input_api.AffectedFiles(): 17 for f in input_api.AffectedFiles():
18 if f.LocalPath().endswith('bad_message.h'): 18 if f.LocalPath().endswith('bad_message.h'):
19 source_path = f.LocalPath() 19 source_path = f.LocalPath()
20 break 20 break
21 21
22 # If the |bad_message.h| wasn't found in this change, then there is nothing to 22 # If the |bad_message.h| wasn't found in this change, then there is nothing to
23 # do and histogram.xml does not need to be updated. 23 # do and histogram.xml does not need to be updated.
24 if source_path == '': 24 if source_path == '':
25 return [] 25 return []
26 26
27 START_MARKER='^enum (class )?BadMessageReason {' 27 START_MARKER='^enum (class )?BadMessageReason {'
28 END_MARKER='^BAD_MESSAGE_MAX' 28 END_MARKER='^BAD_MESSAGE_MAX'
29 if update_histogram_enum.HistogramNeedsUpdate( 29 presubmit_error = update_histogram_enum.CheckPresubmitErrors(
30 histogram_enum_name=histogram_name, 30 histogram_enum_name=histogram_name,
31 update_script_name='update_bad_message_reasons.py',
31 source_enum_path=source_path, 32 source_enum_path=source_path,
32 start_marker=START_MARKER, 33 start_marker=START_MARKER,
33 end_marker=END_MARKER): 34 end_marker=END_MARKER)
34 return [output_api.PresubmitPromptWarning( 35 if presubmit_error:
35 'bad_messages.h has been updated but histogram.xml does not ' 36 return [output_api.PresubmitPromptWarning(presubmit_error,
36 'appear to be updated.\nPlease run:\n' 37 items=[source_path])]
37 ' python tools/metrics/histograms/update_bad_message_reasons.py\n')]
38 return [] 38 return []
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/PRESUBMIT.py ('k') | tools/metrics/histograms/presubmit_scheme_histograms.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698