aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crosperf/results_cache.py5
-rwxr-xr-xcrosperf/results_cache_unittest.py4
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
})