Index: src/tests/test.py
===================================================================
--- src/tests/test.py	(revision f803a752ef5078f4687758c793402ab5c26215b2)
+++ src/tests/test.py	(revision ff98952225b16a68fb22c007b5495c78ef23158e)
@@ -23,4 +23,9 @@
     def __init__(self, name, path):
         self.name, self.path = name, path
+
+class TestResult:
+	SUCCESS = 0
+	FAILURE = 1
+	TIMEOUT = 124
 
 # parses the Makefile to find the machine type (32-bit / 64-bit)
@@ -163,4 +168,7 @@
 	make_ret, _ = sh("""%s test=yes EXTRA_FLAGS="%s" %s 2> %s 1> /dev/null""" % (make_cmd, options, test.name, out_file), dry_run)
 
+	retcode = 0
+	error = None
+
 	# if the make command succeds continue otherwise skip to diff
 	if make_ret == 0 :
@@ -170,5 +178,5 @@
 		if fileIsExecutable(test.name) :
 			# run test
-			sh("./%s %s > %s 2>&1" % (test.name, stdinput, out_file), dry_run)
+			retcode, _ = sh("timeout 60 ./%s %s > %s 2>&1" % (test.name, stdinput, out_file), dry_run)
 		else :
 			# simply cat the result into the output
@@ -179,18 +187,14 @@
 		sh("mv %s %s" % (err_file, out_file), dry_run)
 
-	retcode = 0
-	error = None
-
-	if generate :
-		# if we are ounly generating the output we still need to check that the test actually exists
-		if not dry_run and fileContainsOnly(out_file, "make: *** No rule to make target `%s'.  Stop." % test.name) :
-			retcode = 1;
-			error = "\t\tNo make target for test %s!" % test.name
-			sh("rm %s" % out_file, False)
-
-	else :
-		# fetch return code and error from the diff command
-		retcode, error = diff(".expect/%s.txt" % test.path, ".out/%s.log" % test.name, dry_run)
-
+	if retcode == 0:
+		if generate :
+			# if we are ounly generating the output we still need to check that the test actually exists
+			if not dry_run and fileContainsOnly(out_file, "make: *** No rule to make target `%s'.  Stop." % test.name) :
+				retcode = 1;
+				error = "\t\tNo make target for test %s!" % test.name
+				sh("rm %s" % out_file, False)
+		else :
+			# fetch return code and error from the diff command
+			retcode, error = diff(".expect/%s.txt" % test.path, ".out/%s.log" % test.name, dry_run)
 	# clean the executable
 	sh("rm -f %s > /dev/null 2>&1" % test.name, dry_run)
@@ -205,17 +209,18 @@
 	name_txt = "%20s  " % t.name
 
-	#run the test instance and collect the result
-	test_failed, error = run_single_test(t, generate, dry_run, debug)
+	retcode, error = run_single_test(t, generate, dry_run, debug)
 
 	# update output based on current action
 	if generate :
-		failed_txt = "ERROR"
-		success_txt = "Done"
-	else :
-		failed_txt = "FAILED"
-		success_txt = "PASSED"
+		if   retcode == TestResult.SUCCESS: 	result_txt = "Done"
+		elif retcode == TestResult.TIMEOUT: 	result_txt = "TIMEOUT"
+		else :						result_txt = "ERROR"
+	else :
+		if   retcode == TestResult.SUCCESS: 	result_txt = "PASSED"
+		elif retcode == TestResult.TIMEOUT: 	result_txt = "TIMEOUT"
+		else :						result_txt = "FAILED"
 
 	#print result with error if needed
-	text = name_txt + (failed_txt if test_failed else success_txt)
+	text = name_txt + result_txt
 	out = sys.stdout
 	if error :
@@ -223,10 +228,10 @@
 		out = sys.stderr
 
-	print(text, file = out);
+	print(text, file = out)
 	sys.stdout.flush()
 	sys.stderr.flush()
 	signal.signal(signal.SIGINT, signal.SIG_IGN)
 
-	return test_failed
+	return retcode != TestResult.SUCCESS
 
 # run the given list of tests with the given parameters
