From a587895744134232d2938ee6397b042c8a3f0d67 Mon Sep 17 00:00:00 2001
From: Alberto Bertogli <albertito@blitiri.com.ar>
Date: Fri, 10 Jul 2009 05:08:46 -0300
Subject: [PATCH 09/74] 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 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

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)
-- 
1.6.2.2.646.gb214


