Index: src/tests/test.py
===================================================================
--- src/tests/test.py	(revision 47f942244188da911b9356d8220e028c99613c0c)
+++ src/tests/test.py	(revision 9fcb5e4a0e063aa37b0069c2fd3b4918e4d07dbf)
@@ -9,9 +9,10 @@
 
 import argparse
+import multiprocessing
 import os
 import re
+import signal
 import stat
 import sys
-import multiprocessing
 
 ################################################################################
@@ -119,102 +120,103 @@
 def run_single_test(test, generate, dry_run, debug):
 
-	# find the output file based on the test name and options flag
-	out_file = (".out/%s.log" % test.name) if not generate else (".expect/%s.txt" % test.path)
-	err_file = ".err/%s.log" % test.name
-
-	# remove any outputs from the previous tests to prevent side effects
-	sh("rm -f %s" % out_file, dry_run)
-	sh("rm -f %s > /dev/null 2>&1" % test.name, dry_run)
-
-	options = "-debug" if debug else "-nodebug";
-
-	# build, skipping to next test on error
-	make_ret, _ = sh("""%s EXTRA_FLAGS="-quiet %s" %s 2> %s 1> /dev/null""" % (make_cmd, options, test.name, out_file), dry_run)
-
-	# if the make command succeds continue otherwise skip to diff
-	if make_ret == 0 :
-		# fetch optional input
-		stdinput = "< .in/%s.txt" % test.name if isfile(".in/%s.txt" % test.path) else ""
-
-		if fileIsExecutable(test.name) :
-			# run test
-			sh("./%s %s > %s 2>&1" % (test.name, stdinput, out_file), dry_run)
+	try : 
+		# find the output file based on the test name and options flag
+		out_file = (".out/%s.log" % test.name) if not generate else (".expect/%s.txt" % test.path)
+		err_file = ".err/%s.log" % test.name
+
+		# remove any outputs from the previous tests to prevent side effects
+		sh("rm -f %s" % out_file, dry_run)
+		sh("rm -f %s > /dev/null 2>&1" % test.name, dry_run)
+
+		options = "-debug" if debug else "-nodebug";
+
+		# build, skipping to next test on error
+		make_ret, _ = sh("""%s EXTRA_FLAGS="-quiet %s" %s 2> %s 1> /dev/null""" % (make_cmd, options, test.name, out_file), dry_run)
+
+		# if the make command succeds continue otherwise skip to diff
+		if make_ret == 0 :
+			# fetch optional input
+			stdinput = "< .in/%s.txt" % test.name if isfile(".in/%s.txt" % test.path) else ""
+
+			if fileIsExecutable(test.name) :
+				# run test
+				sh("./%s %s > %s 2>&1" % (test.name, stdinput, out_file), dry_run)
+			else :
+				# simply cat the result into the output
+				sh("cat %s > %s" % (test.name, out_file), dry_run)
+
 		else :
-			# simply cat the result into the output
-			sh("cat %s > %s" % (test.name, out_file), dry_run)
-
+			# command failed save the log to less temporary file
+			sh("mv %s %s" % (err_file, out_file), dry_run)
+
+		retcode = 0
+		error = None
+
+		# # fix output to prevent make depth to cause issues
+		# fix_MakeLevel(out_file)
+
+		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 :
+			# diff the output of the files
+			diff_cmd = ("diff --ignore-all-space "
+						"--ignore-blank-lines "
+						"--old-group-format='\t\tmissing lines :\n"
+						"%%<' \\\n"
+						"--new-group-format='\t\tnew lines :\n"
+						"%%>' \\\n"
+						"--unchanged-group-format='%%=' \\"
+						"--changed-group-format='\t\texpected :\n"
+						"%%<\n"
+						"\t\tgot :\n"
+						"%%>' \\\n"
+						"--new-line-format='\t\t%%dn\t%%L' \\\n"
+						"--old-line-format='\t\t%%dn\t%%L' \\\n"
+						"--unchanged-line-format='' \\\n"
+						".expect/%s.txt .out/%s.log")
+
+			# fetch return code and error from the diff command
+			retcode, error = sh(diff_cmd % (test.path, test.name), dry_run, False)	
+	finally :
+		# clean the executable
+		sh("rm -f %s > /dev/null 2>&1" % test.name, dry_run)
+
+	return retcode, error
+
+def run_test_instance(t, generate, dry_run, debug) :
+
+	signal.signal(signal.SIGINT, signal.SIG_DFL)
+	# print formated name
+	name_txt = "%20s  " % t.name
+
+	#run the test instance and collect the result
+	test_failed, error = run_single_test(t, generate, dry_run, debug)
+
+	# update output based on current action
+	if generate :
+		failed_txt = "ERROR"
+		success_txt = "Done"
 	else :
-		# command failed save the log to less temporary file
-		sh("mv %s %s" % (err_file, out_file), dry_run)
-
-	retcode = 0
-	error = None
-
-	# # fix output to prevent make depth to cause issues
-	# fix_MakeLevel(out_file)
-
-	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 :
-		# diff the output of the files
-		diff_cmd = ("diff --ignore-all-space "
-					"--ignore-blank-lines "
-					"--old-group-format='\t\tmissing lines :\n"
-					"%%<' \\\n"
-					"--new-group-format='\t\tnew lines :\n"
-					"%%>' \\\n"
-					"--unchanged-group-format='%%=' \\"
-					"--changed-group-format='\t\texpected :\n"
-					"%%<\n"
-					"\t\tgot :\n"
-					"%%>' \\\n"
-					"--new-line-format='\t\t%%dn\t%%L' \\\n"
-					"--old-line-format='\t\t%%dn\t%%L' \\\n"
-					"--unchanged-line-format='' \\\n"
-					".expect/%s.txt .out/%s.log")
-
-		# fetch return code and error from the diff command
-		retcode, error = sh(diff_cmd % (test.path, test.name), dry_run, False)
-
-	# clean the executable
-	sh("rm -f %s > /dev/null 2>&1" % test.name, dry_run)
-
-	return retcode, error
-
-def run_test_instance(t, generate, dry_run, debug) :
-	try :
-		# print formated name
-		name_txt = "%20s  " % t.name
-
-		#run the test instance and collect the result
-		test_failed, 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"
-
-		#print result with error if needed
-		text = name_txt + (failed_txt if test_failed else success_txt)
-		out = sys.stdout
-		if error :
-			text = text + "\n" + error
-			out = sys.stderr
-
-		print(text, file = out);
-		sys.stdout.flush()
-		sys.stderr.flush()
-		return test_failed
-
-	except KeyboardInterrupt:
-		test_failed = True
+		failed_txt = "FAILED"
+		success_txt = "PASSED"
+
+	#print result with error if needed
+	text = name_txt + (failed_txt if test_failed else success_txt)
+	out = sys.stdout
+	if error :
+		text = text + "\n" + error
+		out = sys.stderr
+
+	print(text, file = out);
+	sys.stdout.flush()
+	sys.stderr.flush()
+	signal.signal(signal.SIGINT, signal.SIG_IGN)
+
+	return test_failed
 
 
@@ -231,5 +233,7 @@
 
 	# for each test to run
+	original_sigint_handler = signal.signal(signal.SIGINT, signal.SIG_IGN)
 	pool = Pool(jobs)
+	signal.signal(signal.SIGINT, original_sigint_handler)
 	try :
 		results = pool.map_async(partial(run_test_instance, generate=generate, dry_run=dry_run, debug=debug), tests ).get(9999)
