summaryrefslogtreecommitdiffstats
path: root/tools/perf_expectations/make_expectations.py
diff options
context:
space:
mode:
authorcmp@chromium.org <cmp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-09 02:35:19 +0000
committercmp@chromium.org <cmp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-09 02:35:19 +0000
commit3751593896aec722a8f0ad6014cbc2c67a9e78d9 (patch)
treeb5e349c18d18785911576a042846a75b0e136e30 /tools/perf_expectations/make_expectations.py
parentdb96a88617afc0e619c06234bd4f4670ccfe1ae3 (diff)
downloadchromium_src-3751593896aec722a8f0ad6014cbc2c67a9e78d9.zip
chromium_src-3751593896aec722a8f0ad6014cbc2c67a9e78d9.tar.gz
chromium_src-3751593896aec722a8f0ad6014cbc2c67a9e78d9.tar.bz2
make_expectations verifications for expectations.
In make_expectations.py, add -s argument which verifies that all of the expectations are up-to-date and that running make_expectations would not update any keys. Support loading the config file based on the path to the expectations script, this allows running make_expectations.py from outside the perf_expectations directory. In the presubmit tests on commit, always check whether the change can be submitted. Add a presubmit test that runs make_expectations.py -s to verify no updates are pending. TBR=nsylvain@chromium.org Review URL: http://codereview.chromium.org/8212004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104667 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/perf_expectations/make_expectations.py')
-rwxr-xr-xtools/perf_expectations/make_expectations.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/perf_expectations/make_expectations.py b/tools/perf_expectations/make_expectations.py
index b5adf68..c73f5bb 100755
--- a/tools/perf_expectations/make_expectations.py
+++ b/tools/perf_expectations/make_expectations.py
@@ -22,7 +22,9 @@ except ImportError:
__version__ = '1.0'
-DEFAULT_CONFIG_FILE = 'chromium_perf_expectations.cfg'
+EXPECTATIONS_DIR = os.path.dirname(os.path.abspath(__file__))
+DEFAULT_CONFIG_FILE = os.path.join(EXPECTATIONS_DIR,
+ 'chromium_perf_expectations.cfg')
DEFAULT_TOLERANCE = 0.05
USAGE = ''
@@ -133,6 +135,8 @@ def Main(args):
parser = optparse.OptionParser(usage=USAGE, version=__version__)
parser.add_option('-v', '--verbose', action='store_true', default=False,
help='enable verbose output')
+ parser.add_option('-s', '--checksum', action='store_true',
+ help='test if any changes are pending')
parser.add_option('-c', '--config', dest='config_file',
default=DEFAULT_CONFIG_FILE,
help='set the config file to FILE', metavar='FILE')
@@ -157,6 +161,7 @@ def Main(args):
perfkeys.sort()
write_new_expectations = False
+ found_checksum_mismatch = False
for key in perfkeys:
value = perf[key]
tolerance = value.get('tolerance', DEFAULT_TOLERANCE)
@@ -170,6 +175,9 @@ def Main(args):
if original_checksum == computed_checksum:
OutputMessage('checksum matches, skipping')
continue
+ elif options.checksum:
+ found_checksum_mismatch = True
+ continue
# Skip expectations that are missing a reva or revb. We can't generate
# expectations for those.
@@ -307,6 +315,12 @@ def Main(args):
perf[key]['improve'] = improve
OutputMessage('after: %s' % perf[key], verbose_message=False)
+ if options.checksum:
+ if found_checksum_mismatch:
+ return 1
+ else:
+ return 0
+
if write_new_expectations:
print '\nWriting expectations... ',
WriteJson(perf_file, perf, perfkeys)
@@ -315,6 +329,7 @@ def Main(args):
if options.verbose:
print ''
print 'No changes.'
+ return 0
if __name__ == '__main__':