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

Side by Side Diff: build/android/pylib/instrumentation/instrumentation_test_instance.py

Issue 2451523002: Insert logcat as part of test result for android instrumentation tests. (Closed)
Patch Set: Created 4 years, 1 month 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
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import collections 5 import collections
6 import copy 6 import copy
7 import logging 7 import logging
8 import os 8 import os
9 import pickle 9 import pickle
10 import re 10 import re
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 - the bundle dump as a dict mapping string keys to a list of 81 - the bundle dump as a dict mapping string keys to a list of
82 strings, one for each line. 82 strings, one for each line.
83 """ 83 """
84 parser = instrumentation_parser.InstrumentationParser(raw_output) 84 parser = instrumentation_parser.InstrumentationParser(raw_output)
85 statuses = list(parser.IterStatus()) 85 statuses = list(parser.IterStatus())
86 code, bundle = parser.GetResult() 86 code, bundle = parser.GetResult()
87 return (code, bundle, statuses) 87 return (code, bundle, statuses)
88 88
89 89
90 def GenerateTestResults( 90 def GenerateTestResults(
91 result_code, result_bundle, statuses, start_ms, duration_ms): 91 result_code, result_bundle, statuses, start_ms, duration_ms, logcat=None):
jbudorick 2016/10/25 02:17:35 This shouldn't be done in this function. Instead,
BigBossZhiling 2016/10/25 22:08:44 Done.
92 """Generate test results from |statuses|. 92 """Generate test results from |statuses|.
93 93
94 Args: 94 Args:
95 result_code: The overall status code as an integer. 95 result_code: The overall status code as an integer.
96 result_bundle: The summary bundle dump as a dict. 96 result_bundle: The summary bundle dump as a dict.
97 statuses: A list of 2-tuples containing: 97 statuses: A list of 2-tuples containing:
98 - the status code as an integer 98 - the status code as an integer
99 - the bundle dump as a dict mapping string keys to string values 99 - the bundle dump as a dict mapping string keys to string values
100 Note that this is the same as the third item in the 3-tuple returned by 100 Note that this is the same as the third item in the 3-tuple returned by
101 |_ParseAmInstrumentRawOutput|. 101 |_ParseAmInstrumentRawOutput|.
(...skipping 15 matching lines...) Expand all
117 if test_class and test_method: 117 if test_class and test_method:
118 test_name = '%s#%s' % (test_class, test_method) 118 test_name = '%s#%s' % (test_class, test_method)
119 else: 119 else:
120 continue 120 continue
121 121
122 if status_code == instrumentation_parser.STATUS_CODE_START: 122 if status_code == instrumentation_parser.STATUS_CODE_START:
123 if current_result: 123 if current_result:
124 results.append(current_result) 124 results.append(current_result)
125 current_result = test_result.InstrumentationTestResult( 125 current_result = test_result.InstrumentationTestResult(
126 test_name, base_test_result.ResultType.UNKNOWN, start_ms, duration_ms) 126 test_name, base_test_result.ResultType.UNKNOWN, start_ms, duration_ms)
127 current_result.SetLogcat(logcat)
127 else: 128 else:
128 if status_code == instrumentation_parser.STATUS_CODE_OK: 129 if status_code == instrumentation_parser.STATUS_CODE_OK:
129 if bundle.get('test_skipped', '').lower() in ('true', '1', 'yes'): 130 if bundle.get('test_skipped', '').lower() in ('true', '1', 'yes'):
130 current_result.SetType(base_test_result.ResultType.SKIP) 131 current_result.SetType(base_test_result.ResultType.SKIP)
131 elif current_result.GetType() == base_test_result.ResultType.UNKNOWN: 132 elif current_result.GetType() == base_test_result.ResultType.UNKNOWN:
132 current_result.SetType(base_test_result.ResultType.PASS) 133 current_result.SetType(base_test_result.ResultType.PASS)
133 elif status_code == instrumentation_parser.STATUS_CODE_SKIP: 134 elif status_code == instrumentation_parser.STATUS_CODE_SKIP:
134 current_result.SetType(base_test_result.ResultType.SKIP) 135 current_result.SetType(base_test_result.ResultType.SKIP)
135 else: 136 else:
136 if status_code not in (instrumentation_parser.STATUS_CODE_ERROR, 137 if status_code not in (instrumentation_parser.STATUS_CODE_ERROR,
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 os.path.basename(test_list_file_path)) 699 os.path.basename(test_list_file_path))
699 700
700 return env 701 return env
701 702
702 @staticmethod 703 @staticmethod
703 def ParseAmInstrumentRawOutput(raw_output): 704 def ParseAmInstrumentRawOutput(raw_output):
704 return ParseAmInstrumentRawOutput(raw_output) 705 return ParseAmInstrumentRawOutput(raw_output)
705 706
706 @staticmethod 707 @staticmethod
707 def GenerateTestResults( 708 def GenerateTestResults(
708 result_code, result_bundle, statuses, start_ms, duration_ms): 709 result_code, result_bundle, statuses, start_ms, duration_ms, logcat):
709 return GenerateTestResults(result_code, result_bundle, statuses, 710 return GenerateTestResults(result_code, result_bundle, statuses,
710 start_ms, duration_ms) 711 start_ms, duration_ms, logcat)
711 712
712 #override 713 #override
713 def TearDown(self): 714 def TearDown(self):
714 if self._isolate_delegate: 715 if self._isolate_delegate:
715 self._isolate_delegate.Clear() 716 self._isolate_delegate.Clear()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698