blob: aadb6a7851e3e578b36eb792674f1f41831aa513 [file] [log] [blame]
epoger@google.comf9d134d2013-09-27 15:02:44 +00001#!/usr/bin/python
2
epoger@google.com9fb6c8a2013-10-09 18:05:58 +00003"""
epoger@google.comf9d134d2013-09-27 15:02:44 +00004Copyright 2013 Google Inc.
5
6Use of this source code is governed by a BSD-style license that can be
7found in the LICENSE file.
epoger@google.comf9d134d2013-09-27 15:02:44 +00008
epoger@google.comf9d134d2013-09-27 15:02:44 +00009Repackage expected/actual GM results as needed by our HTML rebaseline viewer.
epoger@google.com9fb6c8a2013-10-09 18:05:58 +000010"""
epoger@google.comf9d134d2013-09-27 15:02:44 +000011
12# System-level imports
epoger@google.comf9d134d2013-09-27 15:02:44 +000013import os
14import re
15import sys
16
17# Imports from within Skia
18#
19# We need to add the 'gm' directory, so that we can import gm_json.py within
20# that directory. That script allows us to parse the actual-results.json file
21# written out by the GM tool.
22# Make sure that the 'gm' dir is in the PYTHONPATH, but add it at the *end*
23# so any dirs that are already in the PYTHONPATH will be preferred.
commit-bot@chromium.org7b06c8e2013-12-23 22:47:15 +000024PARENT_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
25GM_DIRECTORY = os.path.dirname(PARENT_DIRECTORY)
epoger@google.comf9d134d2013-09-27 15:02:44 +000026if GM_DIRECTORY not in sys.path:
27 sys.path.append(GM_DIRECTORY)
28import gm_json
commit-bot@chromium.org16f41802014-02-26 19:05:20 +000029
30# Keys used to link an image to a particular GM test.
31# NOTE: Keep these in sync with static/constants.js
commit-bot@chromium.orgd1c85d22014-03-17 14:22:02 +000032REBASELINE_SERVER_SCHEMA_VERSION_NUMBER = 2
commit-bot@chromium.org16f41802014-02-26 19:05:20 +000033KEY__EXPECTATIONS__BUGS = gm_json.JSONKEY_EXPECTEDRESULTS_BUGS
34KEY__EXPECTATIONS__IGNOREFAILURE = gm_json.JSONKEY_EXPECTEDRESULTS_IGNOREFAILURE
35KEY__EXPECTATIONS__REVIEWED = gm_json.JSONKEY_EXPECTEDRESULTS_REVIEWED
36KEY__EXTRACOLUMN__BUILDER = 'builder'
37KEY__EXTRACOLUMN__CONFIG = 'config'
38KEY__EXTRACOLUMN__RESULT_TYPE = 'resultType'
39KEY__EXTRACOLUMN__TEST = 'test'
commit-bot@chromium.org7498d952014-03-13 14:56:29 +000040KEY__HEADER = 'header'
41KEY__HEADER__DATAHASH = 'dataHash'
42KEY__HEADER__IS_EDITABLE = 'isEditable'
43KEY__HEADER__IS_EXPORTED = 'isExported'
44KEY__HEADER__IS_STILL_LOADING = 'resultsStillLoading'
commit-bot@chromium.org16f41802014-02-26 19:05:20 +000045KEY__HEADER__RESULTS_ALL = 'all'
46KEY__HEADER__RESULTS_FAILURES = 'failures'
commit-bot@chromium.orgea770f12014-03-13 16:33:36 +000047KEY__HEADER__SCHEMA_VERSION = 'schemaVersion'
commit-bot@chromium.org7498d952014-03-13 14:56:29 +000048KEY__HEADER__TIME_NEXT_UPDATE_AVAILABLE = 'timeNextUpdateAvailable'
49KEY__HEADER__TIME_UPDATED = 'timeUpdated'
50KEY__HEADER__TYPE = 'type'
commit-bot@chromium.org16f41802014-02-26 19:05:20 +000051KEY__NEW_IMAGE_URL = 'newImageUrl'
52KEY__RESULT_TYPE__FAILED = gm_json.JSONKEY_ACTUALRESULTS_FAILED
53KEY__RESULT_TYPE__FAILUREIGNORED = gm_json.JSONKEY_ACTUALRESULTS_FAILUREIGNORED
54KEY__RESULT_TYPE__NOCOMPARISON = gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON
55KEY__RESULT_TYPE__SUCCEEDED = gm_json.JSONKEY_ACTUALRESULTS_SUCCEEDED
56
epoger@google.comf9d134d2013-09-27 15:02:44 +000057IMAGE_FILENAME_RE = re.compile(gm_json.IMAGE_FILENAME_PATTERN)
epoger@google.comeb832592013-10-23 15:07:26 +000058IMAGE_FILENAME_FORMATTER = '%s_%s.png' # pass in (testname, config)