Mercurial > ~astiob > upreckon > hgweb
comparison 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 |
comparison
equal
deleted
inserted
replaced
61:24f144e11b5e | 62:593ad09cd69b |
---|---|
204 if sys.stdin.read(1) == '\33': | 204 if sys.stdin.read(1) == '\33': |
205 raise CanceledByUser | 205 raise CanceledByUser |
206 except select_error: | 206 except select_error: |
207 if sys.exc_info()[1].args[0] != EINTR: | 207 if sys.exc_info()[1].args[0] != EINTR: |
208 raise | 208 raise |
209 else: | |
210 case.process.poll() | |
209 else: | 211 else: |
210 time_end = clock() + case.maxtime | 212 time_end = clock() + case.maxtime |
211 try: | 213 try: |
212 while case.process.poll() is None: | 214 while case.process.poll() is None: |
213 remaining = time_end - clock() | 215 remaining = time_end - clock() |
218 else: | 220 else: |
219 raise TimeLimitExceeded | 221 raise TimeLimitExceeded |
220 except select_error: | 222 except select_error: |
221 if sys.exc_info()[1].args[0] != EINTR: | 223 if sys.exc_info()[1].args[0] != EINTR: |
222 raise | 224 raise |
225 else: | |
226 case.process.poll() | |
223 del bury_child.case | 227 del bury_child.case |
224 def call(*args, **kwargs): | 228 def call(*args, **kwargs): |
225 if 'preexec_fn' in kwargs: | 229 if 'preexec_fn' in kwargs: |
226 try: | 230 try: |
227 return call_real(*args, **kwargs) | 231 return call_real(*args, **kwargs) |
559 if canceled(): | 563 if canceled(): |
560 raise CanceledByUser | 564 raise CanceledByUser |
561 else: | 565 else: |
562 time_next_check = now + .15 | 566 time_next_check = now + .15 |
563 time.sleep(.001) | 567 time.sleep(.001) |
564 if config.globalconf.force_zero_exitcode and case.process.returncode: | 568 if config.globalconf.force_zero_exitcode and case.process.returncode or case.process.returncode < 0: |
565 raise NonZeroExitCode(case.process.returncode) | 569 raise NonZeroExitCode(case.process.returncode) |
566 callback() | 570 callback() |
567 case.has_called_back = True | 571 case.has_called_back = True |
568 outfile.seek(0) | 572 outfile.seek(0) |
569 return case.validate(outfile) | 573 return case.validate(outfile) |
611 if canceled(): | 615 if canceled(): |
612 raise CanceledByUser | 616 raise CanceledByUser |
613 else: | 617 else: |
614 time_next_check = now + .15 | 618 time_next_check = now + .15 |
615 time.sleep(.001) | 619 time.sleep(.001) |
616 if config.globalconf.force_zero_exitcode and case.process.returncode: | 620 if config.globalconf.force_zero_exitcode and case.process.returncode or case.process.returncode < 0: |
617 raise NonZeroExitCode(case.process.returncode) | 621 raise NonZeroExitCode(case.process.returncode) |
618 callback() | 622 callback() |
619 case.has_called_back = True | 623 case.has_called_back = True |
620 with open(case.problem.config.outname, 'rU') as output: | 624 with open(case.problem.config.outname, 'rU') as output: |
621 return case.validate(output) | 625 return case.validate(output) |