diff options
author | Zhizhou Yang <zhizhouy@google.com> | 2019-05-03 17:28:12 -0700 |
---|---|---|
committer | Zhizhou Yang <zhizhouy@google.com> | 2019-09-26 17:38:07 +0000 |
commit | c60ec013fcb88a82089f198464230c456dbbd888 (patch) | |
tree | d285831e9a4c9c06c6ac26b6b95b3338ffdfd514 /crosperf | |
parent | 61413b95947a29deff13de9b744c1eb97032a2d3 (diff) | |
download | toolchain-utils-c60ec013fcb88a82089f198464230c456dbbd888.tar.gz |
crosperf: mark a run as failed if samples collected is 0
There is situation that in cwp mode, test runs correctly but not samples
are collected. For this case, we want to mark the run as failure so that
we could have correct speedup calculation and user can notice it.
BUG=chromium:927554
TEST=Passed unit tests
Change-Id: I4d4f9bd25159e8d3d0b14a84f7f566593e1438ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1594288
Tested-by: Zhizhou Yang <zhizhouy@google.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Auto-Submit: Zhizhou Yang <zhizhouy@google.com>
Commit-Queue: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Diffstat (limited to 'crosperf')
-rw-r--r-- | crosperf/results_cache.py | 5 | ||||
-rwxr-xr-x | crosperf/results_cache_unittest.py | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/crosperf/results_cache.py b/crosperf/results_cache.py index 3342e2b2..274e198a 100644 --- a/crosperf/results_cache.py +++ b/crosperf/results_cache.py @@ -638,6 +638,11 @@ class Result(object): # for each perf.data file if self.cwp_dso and self.retval == 0: self.keyvals['samples'] = self.GetSamples() + # If the samples count collected from perf file is 0, we will treat + # it as a failed run. + if self.keyvals['samples'][0] == 0: + del self.keyvals['samples'] + self.keyvals['retval'] = 1 # Generate report from all perf.data files. # Now parse all perf report files and include them in keyvals. self.GatherPerfResults() diff --git a/crosperf/results_cache_unittest.py b/crosperf/results_cache_unittest.py index ece9f99d..c1e151b7 100755 --- a/crosperf/results_cache_unittest.py +++ b/crosperf/results_cache_unittest.py @@ -976,7 +976,7 @@ class ResultTest(unittest.TestCase): self.callGatherPerfResults = True def FakeGetSamples(): - return 1 + return (1, 'samples') # Test 1 self.callGatherPerfResults = False @@ -1004,7 +1004,7 @@ class ResultTest(unittest.TestCase): self.assertEqual(len(self.result.keyvals), 3) self.assertEqual(self.result.keyvals, { 'Total': 10, - 'samples': 1, + 'samples': (1, 'samples'), 'retval': 0 }) |