#!/usr/bin/env python
import sys
import resource
import tf
possible_tests = ('normal', 'corruption', 'fi')
if len(sys.argv) < 2 or sys.argv[1] not in possible_tests + ('all',):
print 'Usage: runtests', '|'.join(possible_tests + ('all',)),
print '[test_name]'
sys.exit(1)
if sys.argv[1] == 'all':
mnames = ('t_' + i for i in possible_tests)
else:
mnames = ('t_' + sys.argv[1],)
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)