rebaseline_server: add actual_repo and actual_revision command line options
So, if you want to see divergences from expectations as of https://code.google.com/p/skia-autogen/source/detail?r=29365 , specify --actuals-revision 29365 This is also handy for testing rebaseline_server performance improvements against a static set of results. BUG=skia:2248 NOTREECHECKS=True NOTRY=True R=borenet@google.com, bsalomon@google.com Author: epoger@google.com Review URL: https://codereview.chromium.org/193023002 git-svn-id: http://skia.googlecode.com/svn/trunk@13726 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
ed19107c1b
commit
5865ec5f3a
@ -43,7 +43,6 @@ import svn
|
||||
import imagepairset
|
||||
import results
|
||||
|
||||
ACTUALS_SVN_REPO = 'http://skia-autogen.googlecode.com/svn/gm-actual'
|
||||
PATHSPLIT_RE = re.compile('/([^/]+)/(.+)')
|
||||
EXPECTATIONS_DIR = os.path.join(TRUNK_DIRECTORY, 'expectations', 'gm')
|
||||
GENERATED_IMAGES_ROOT = os.path.join(PARENT_DIRECTORY, 'static',
|
||||
@ -75,6 +74,8 @@ KEY__HEADER__TIME_UPDATED = 'timeUpdated'
|
||||
KEY__HEADER__TYPE = 'type'
|
||||
|
||||
DEFAULT_ACTUALS_DIR = '.gm-actuals'
|
||||
DEFAULT_ACTUALS_REPO_REVISION = 'HEAD'
|
||||
DEFAULT_ACTUALS_REPO_URL = 'http://skia-autogen.googlecode.com/svn/gm-actual'
|
||||
DEFAULT_PORT = 8888
|
||||
|
||||
# How often (in seconds) clients should reload while waiting for initial
|
||||
@ -143,12 +144,16 @@ class Server(object):
|
||||
|
||||
def __init__(self,
|
||||
actuals_dir=DEFAULT_ACTUALS_DIR,
|
||||
actuals_repo_revision=DEFAULT_ACTUALS_REPO_REVISION,
|
||||
actuals_repo_url=DEFAULT_ACTUALS_REPO_URL,
|
||||
port=DEFAULT_PORT, export=False, editable=True,
|
||||
reload_seconds=0):
|
||||
"""
|
||||
Args:
|
||||
actuals_dir: directory under which we will check out the latest actual
|
||||
GM results
|
||||
actuals_repo_revision: revision of actual-results.json files to process
|
||||
actuals_repo_url: SVN repo to download actual-results.json files from
|
||||
port: which TCP port to listen on for HTTP requests
|
||||
export: whether to allow HTTP clients on other hosts to access this server
|
||||
editable: whether HTTP clients are allowed to submit new baselines
|
||||
@ -156,12 +161,14 @@ class Server(object):
|
||||
if 0, don't check for new results at all
|
||||
"""
|
||||
self._actuals_dir = actuals_dir
|
||||
self._actuals_repo_revision = actuals_repo_revision
|
||||
self._actuals_repo_url = actuals_repo_url
|
||||
self._port = port
|
||||
self._export = export
|
||||
self._editable = editable
|
||||
self._reload_seconds = reload_seconds
|
||||
self._actuals_repo = _create_svn_checkout(
|
||||
dir_path=actuals_dir, repo_url=ACTUALS_SVN_REPO)
|
||||
dir_path=actuals_dir, repo_url=actuals_repo_url)
|
||||
|
||||
# Reentrant lock that must be held whenever updating EITHER of:
|
||||
# 1. self._results
|
||||
@ -209,9 +216,11 @@ class Server(object):
|
||||
with self.results_rlock:
|
||||
if invalidate:
|
||||
self._results = None
|
||||
logging.info('Updating actual GM results in %s from SVN repo %s ...' % (
|
||||
self._actuals_dir, ACTUALS_SVN_REPO))
|
||||
self._actuals_repo.Update('.')
|
||||
logging.info(
|
||||
'Updating actual GM results in %s to revision %s from repo %s ...' % (
|
||||
self._actuals_dir, self._actuals_repo_revision,
|
||||
self._actuals_repo_url))
|
||||
self._actuals_repo.Update(path='.', revision=self._actuals_repo_revision)
|
||||
|
||||
# We only update the expectations dir if the server was run with a
|
||||
# nonzero --reload argument; otherwise, we expect the user to maintain
|
||||
@ -331,8 +340,8 @@ class HTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
KEY__HEADER: {
|
||||
KEY__HEADER__IS_STILL_LOADING: True,
|
||||
KEY__HEADER__TIME_UPDATED: now,
|
||||
KEY__HEADER__TIME_NEXT_UPDATE_AVAILABLE:
|
||||
now + RELOAD_INTERVAL_UNTIL_READY,
|
||||
KEY__HEADER__TIME_NEXT_UPDATE_AVAILABLE: (
|
||||
now + RELOAD_INTERVAL_UNTIL_READY),
|
||||
},
|
||||
}
|
||||
self.send_json_dict(response_dict)
|
||||
@ -532,6 +541,16 @@ def main():
|
||||
'actual GM results. If this directory does not '
|
||||
'exist, it will be created. Defaults to %(default)s'),
|
||||
default=DEFAULT_ACTUALS_DIR)
|
||||
parser.add_argument('--actuals-repo',
|
||||
help=('URL of SVN repo to download actual-results.json '
|
||||
'files from. Defaults to %(default)s'),
|
||||
default=DEFAULT_ACTUALS_REPO_URL)
|
||||
parser.add_argument('--actuals-revision',
|
||||
help=('revision of actual-results.json files to process. '
|
||||
'Defaults to %(default)s . Beware of setting this '
|
||||
'argument in conjunction with --editable; you '
|
||||
'probably only want to edit results at HEAD.'),
|
||||
default=DEFAULT_ACTUALS_REPO_REVISION)
|
||||
parser.add_argument('--editable', action='store_true',
|
||||
help=('Allow HTTP clients to submit new baselines.'))
|
||||
parser.add_argument('--export', action='store_true',
|
||||
@ -555,6 +574,8 @@ def main():
|
||||
args = parser.parse_args()
|
||||
global _SERVER
|
||||
_SERVER = Server(actuals_dir=args.actuals_dir,
|
||||
actuals_repo_revision=args.actuals_revision,
|
||||
actuals_repo_url=args.actuals_repo,
|
||||
port=args.port, export=args.export, editable=args.editable,
|
||||
reload_seconds=args.reload)
|
||||
_SERVER.run()
|
||||
|
@ -95,14 +95,15 @@ class Svn:
|
||||
"""
|
||||
return self._RunCommand([SVN, 'checkout', url, path])
|
||||
|
||||
def Update(self, path):
|
||||
def Update(self, path, revision='HEAD'):
|
||||
"""Update the working copy.
|
||||
Returns stdout as a single string.
|
||||
|
||||
@param path path (within self._directory) within which to run
|
||||
"svn update"
|
||||
"svn update"
|
||||
@param revision revision to update to
|
||||
"""
|
||||
return self._RunCommand([SVN, 'update', path])
|
||||
return self._RunCommand([SVN, 'update', path, '--revision', revision])
|
||||
|
||||
def ListSubdirs(self, url):
|
||||
"""Returns a list of all subdirectories (not files) within a given SVN
|
||||
|
Loading…
Reference in New Issue
Block a user