pcp
[Top] [All Lists]

Re: [pcp] seeking help with python and qa/1069

To: pcp@xxxxxxxxxxx
Subject: Re: [pcp] seeking help with python and qa/1069
From: Marko Myllynen <myllynen@xxxxxxxxxx>
Date: Sun, 26 Jun 2016 16:47:29 +0300
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <576B4086.4090205@xxxxxxxxxxxxxxxx>
Organization: Red Hat
References: <576B4086.4090205@xxxxxxxxxxxxxxxx>
Reply-to: Marko Myllynen <myllynen@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0
Hi,

On 2016-06-23 04:51, Ken McDonell wrote:
> I am seeing the qa/1069 test failing the divide by zero test when pmrep
> reports 0.inf instead of inf.
> 
> The test not failing everywhere, but is failing on RHEL 6.8 (vm28) and
> CentOS 6.7 (vm14).

This looks like a RHEL 6 Python issue:

https://bugzilla.redhat.com/show_bug.cgi?id=1350209

We can work around it in pmrep, the patch is not that pretty but does
the trick:

---
 src/pmrep/pmrep.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/pmrep/pmrep.py b/src/pmrep/pmrep.py
index b0dc282..430f894 100755
--- a/src/pmrep/pmrep.py
+++ b/src/pmrep/pmrep.py
@@ -1299,6 +1299,8 @@ class PMReporter(object):
         index = 0
         nfmt = ""
         for f in fmt:
+            if type(line[index]) is float and math.isinf(line[index]):
+                line[index] = "inf"
             nfmt += f.replace("{X:", "{" + str(index) + ":")
             index += 1
             nfmt += "{" + str(index) + "}"

Thanks,

-- 
Marko Myllynen

<Prev in Thread] Current Thread [Next in Thread>