client/rhel/rhnlib/test/24-ssl-memleak.py | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
New commits:
commit 8ef8022f01ad030b0650d802fa7687977b25827b
Merge: 40fba98 6f9a0a2
Author: Jan Hutar <jhutar(a)redhat.com>
Date: Thu Oct 27 13:16:38 2011 +0200
Merge branch 'master' of
ssh://git.fedorahosted.org/git/spacewalk
commit 40fba986fc41301a45fa8862e0567ad3ec66b171
Author: Jan Hutar <jhutar(a)redhat.com>
Date: Thu Oct 27 13:15:43 2011 +0200
Do not rely on exact amount of memomory when determinig PASS/FAIL
diff --git a/client/rhel/rhnlib/test/24-ssl-memleak.py
b/client/rhel/rhnlib/test/24-ssl-memleak.py
index 387c740..88f9fed 100755
--- a/client/rhel/rhnlib/test/24-ssl-memleak.py
+++ b/client/rhel/rhnlib/test/24-ssl-memleak.py
@@ -20,24 +20,30 @@ def main():
except:
pass
server_url = "https://" + server_name + "/APPLET"
- diff_count = 0
mem_usage = None
+ mem_usage_VmSize_max = None
+ mem_usage_VmSize_first = None
+ mem_usage_VmSize_allowed_percent = 0.1 # [%] allowed gain of first -> max
for i in range(10000):
run_test(server_url, ca_cert)
if i % 100 == 0:
new_mem_usage = mem_usage_int()
if mem_usage is not None:
- if mem_usage[1] != new_mem_usage[1]:
- diff_count = diff_count + 1
+ if new_mem_usage[1] > mem_usage_VmSize_max:
+ mem_usage_VmSize_max = new_mem_usage[1]
+ else:
+ mem_usage_VmSize_max = new_mem_usage[1]
+ mem_usage_VmSize_first = new_mem_usage[1]
mem_usage = new_mem_usage
print "memory usage: %s %s %s" % mem_usage[1:4]
- if diff_count > 4:
+ percent = float((mem_usage_VmSize_max - mem_usage_VmSize_first)) /
(float(mem_usage_VmSize_first) / 100)
+ if percent >= mem_usage_VmSize_allowed_percent:
# Failure
print "Test FAILS"
- return diff_count
+ return 1
print "Test PASSES"
return 0