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

Side by Side Diff: build/android/pylib/output/local_output_manager.py

Issue 2933993002: Add local results details pages.
Patch Set: Add --local-output arg which enables local results detail pages. Created 3 years, 5 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
(Empty)
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
3 # found in the LICENSE file.
4
5 import time
6 import os
7 import shutil
8 import urllib
9
10 from pylib.base import output_manager
11
12
13 class LocalOutputManager(output_manager.OutputManager):
14
15 def __init__(self, output_dir):
16 """Saves and manages test output files locally in output directory.
jbudorick 2017/07/19 22:45:09 Should this be a comment on __init__, the class, o
mikecase (-- gone --) 2017/07/26 21:21:37 Done
17
18 Location files will be saved is {output_dir}/TEST_RESULTS_{timestamp}.
jbudorick 2017/07/19 22:45:09 nit: saved in?
mikecase (-- gone --) 2017/07/26 21:21:37 Done
19 """
20 super(LocalOutputManager, self).__init__()
21 timestamp = time.strftime(
22 '%Y_%m_%dT%H_%M_%S', time.localtime())
23 self._output_root = os.path.join(
24 output_dir, 'TEST_RESULTS_%s' % timestamp)
25
26 #override
27 def _CreateArchiveJob(self, in_filepath, out_filename, out_subdir, datatype):
28 return LocalArchiveJob(
29 in_filepath, out_filename, out_subdir, datatype, self._output_root)
30
31
32 class LocalArchiveJob(output_manager.Job):
33
34 def __init__(self, in_filepath, out_filename, out_subdir, datatype, out_root):
35 super(LocalArchiveJob, self).__init__(
36 in_filepath, out_filename, out_subdir, datatype)
37 self._output_path = os.path.join(out_root, out_subdir, out_filename)
38
39 def Link(self):
40 return 'file://%s' % urllib.quote(self._output_path)
41
42 def Archive(self):
43 if not os.path.exists(os.path.dirname(self._output_path)):
44 os.makedirs(os.path.dirname(self._output_path))
45 shutil.copy(self._in_filepath, self._output_path)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698