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

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

Issue 2933993002: Add local results details pages.
Patch Set: Fix some of Johns comments. Created 3 years, 3 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 """Saves and manages test output files locally in output directory.
15
16 Location files will be saved in {output_dir}/TEST_RESULTS_{timestamp}.
17 """
18
19 def __init__(self, output_dir):
20 super(LocalOutputManager, self).__init__()
21 timestamp = time.strftime(
22 '%Y_%m_%dT%H_%M_%S', time.localtime())
23 self._output_root = os.path.abspath(os.path.join(
24 output_dir, 'TEST_RESULTS_%s' % timestamp))
25
26 #override
27 def _CreateArchivedFile(self, out_filename, out_subdir, datatype):
28 return LocalArchivedFile(
29 out_filename, out_subdir, datatype, self._output_root)
30
31
32 class LocalArchivedFile(output_manager.ArchivedFile):
33
34 def __init__(self, out_filename, out_subdir, datatype, out_root):
35 super(LocalArchivedFile, self).__init__(
36 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.name, self._output_path)
OLDNEW
« no previous file with comments | « build/android/pylib/output/__init__.py ('k') | build/android/pylib/output/noop_output_manager.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698