Merge ~canonical-kernel-team/+git/autotest-client-tests:phlin/multipass-stddev into ~canonical-kernel-team/+git/autotest-client-tests:master

Proposed by Po-Hsu Lin
Status: Merged
Merge reported by: Po-Hsu Lin
Merged at revision: b0d8f3a8e2b9dd35cf051e2b53bfa1708ec9348a
Proposed branch: ~canonical-kernel-team/+git/autotest-client-tests:phlin/multipass-stddev
Merge into: ~canonical-kernel-team/+git/autotest-client-tests:master
Diff against target: 17 lines (+2/-1)
1 file modified
ubuntu_performance_multipass/ubuntu_performance_multipass.py (+2/-1)
Reviewer Review Type Date Requested Status
Francis Ginther Approve
Review via email: mp+466917@code.launchpad.net

Commit message

BugLink: https://bugs.launchpad.net/bugs/2067978

The formula for sample standard deviation require more than 1 result,
otherwise it will cause a ZeroDivisionError.

Calculate stddev only when we have 2+ results available to avoid this issue.

To post a comment you must log in.
Revision history for this message
Francis Ginther (fginther) wrote :

@cypressyew, any idea why we see the multipass test fail to start sometimes. I looked over a couple of recent runs, and we typically see a few of these fail in the beginning. I ended up filing a new bug for this: https://bugs.launchpad.net/ubuntu-kernel-tests/+bug/2068768

Given the other bug, I'm ok with this fix.

review: Approve
Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

@Francis
I noticed that too https://bugs.launchpad.net/ubuntu-kernel-tests/+bug/2068726
From what I can see here the hardcoded Eoan might a one of the issue.

From your case it seems xenial is working, just not all of them.
We might need to dig deeper to see what's going on.

Apart from that I noticed that this test will be marked as passed with all instance were failed to launch https://bugs.launchpad.net/ubuntu-kernel-tests/+bug/2068725 maybe we should mark it as failed to avoid false impression that this test is OK.

Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

I will land this first to reduce uncommitted changes on the server.
Patch applied and pushed.
Thanks.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/ubuntu_performance_multipass/ubuntu_performance_multipass.py b/ubuntu_performance_multipass/ubuntu_performance_multipass.py
2index b69773e..98d04a8 100644
3--- a/ubuntu_performance_multipass/ubuntu_performance_multipass.py
4+++ b/ubuntu_performance_multipass/ubuntu_performance_multipass.py
5@@ -238,10 +238,11 @@ class ubuntu_performance_multipass(test.test):
6 minimum = min(results)
7 maximum = max(results)
8 average = sum(results) / len(results)
9- if average > 0:
10+ if average > 0 and len(results) > 1:
11 stddev = sqrt(float(reduce(lambda x, y: x + y, map(lambda x: (x - average) ** 2, results))) / (len(results) - 1))
12 percent_stddev = (stddev / average) * 100.0 if average > 0.0 else 0.0
13 else:
14+ print("Not enough results to calculate sample standard deviation!")
15 stddev = 0.0
16 percent_stddev = 0.0
17 print("%s_%s_%s_minimum %.3f" % (test_name, release, key, minimum))

Subscribers

People subscribed via source and target branches

to all changes: