git » libjio » commit a587895

tests/behaviour: Limit runtime resources

author Alberto Bertogli
2009-07-10 08:08:46 UTC
committer Alberto Bertogli
2009-07-10 09:40:57 UTC
parent 3072c482961ece8802f40ede1b1e7431e0f6ddeb

tests/behaviour: Limit runtime resources

To cover from possible resource leaks in the tests, limit the resources
using setrlimit.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

tests/behaviour/runtests +6 -0

diff --git a/tests/behaviour/runtests b/tests/behaviour/runtests
index 2860493..a078083 100755
--- a/tests/behaviour/runtests
+++ b/tests/behaviour/runtests
@@ -1,6 +1,7 @@
 #!/usr/bin/env python
 
 import sys
+import resource
 import tf
 
 possible_tests = ('normal', 'corruption', 'fi')
@@ -18,6 +19,11 @@ specific_test = None
 if len(sys.argv) >= 3:
 	specific_test = sys.argv[2]
 
+M = 1024 * 1024
+resource.setrlimit(resource.RLIMIT_CPU, (120, 120))
+resource.setrlimit(resource.RLIMIT_FSIZE, (100 * M, 100 * M))
+resource.setrlimit(resource.RLIMIT_AS, (500 * M, 500 * M))
+
 for mn in mnames:
 	print '--', mn
 	tf.autorun(__import__(mn), specific_test)