diff testcases.py @ 62:593ad09cd69b

Multiple exit code handling fixes call() on POSIX now always gets the exit code of the process. force_zero_exitcode now has no effect if the process got killed by a signal.
author Oleg Oshmyan <chortos@inbox.lv>
date Wed, 22 Dec 2010 15:03:47 +0200
parents 24f144e11b5e
children fb9d0223a871
line wrap: on
line diff
--- a/testcases.py	Tue Dec 21 19:38:58 2010 +0200
+++ b/testcases.py	Wed Dec 22 15:03:47 2010 +0200
@@ -206,6 +206,8 @@
 				except select_error:
 					if sys.exc_info()[1].args[0] != EINTR:
 						raise
+					else:
+						case.process.poll()
 			else:
 				time_end = clock() + case.maxtime
 				try:
@@ -220,6 +222,8 @@
 				except select_error:
 					if sys.exc_info()[1].args[0] != EINTR:
 						raise
+					else:
+						case.process.poll()
 		del bury_child.case
 	def call(*args, **kwargs):
 		if 'preexec_fn' in kwargs:
@@ -561,7 +565,7 @@
 											else:
 												time_next_check = now + .15
 										time.sleep(.001)
-						if config.globalconf.force_zero_exitcode and case.process.returncode:
+						if config.globalconf.force_zero_exitcode and case.process.returncode or case.process.returncode < 0:
 							raise NonZeroExitCode(case.process.returncode)
 						callback()
 						case.has_called_back = True
@@ -613,7 +617,7 @@
 								else:
 									time_next_check = now + .15
 							time.sleep(.001)
-			if config.globalconf.force_zero_exitcode and case.process.returncode:
+			if config.globalconf.force_zero_exitcode and case.process.returncode or case.process.returncode < 0:
 				raise NonZeroExitCode(case.process.returncode)
 			callback()
 			case.has_called_back = True