Mercurial > ~astiob > upreckon > hgweb
comparison testcases.py @ 55:c726235e49ee
Hopefully somewhat improve accuracy of run-time reporting
author | Oleg Oshmyan <chortos@inbox.lv> |
---|---|
date | Mon, 20 Dec 2010 23:03:28 +0200 |
parents | 1914ae9cfdce |
children | 693a938bdeee |
comparison
equal
deleted
inserted
replaced
54:1914ae9cfdce | 55:c726235e49ee |
---|---|
392 if now >= time_next_check: | 392 if now >= time_next_check: |
393 if canceled(): | 393 if canceled(): |
394 raise CanceledByUser | 394 raise CanceledByUser |
395 else: | 395 else: |
396 time_next_check = now + .15 | 396 time_next_check = now + .15 |
397 time.sleep(0) | 397 time.sleep(.001) |
398 else: | 398 else: |
399 time_end = case.time_started + case.maxtime | 399 time_end = case.time_started + case.maxtime |
400 while True: | 400 while True: |
401 exitcode, now = case.process.poll(), clock() | 401 exitcode, now = case.process.poll(), clock() |
402 if exitcode is not None: | 402 if exitcode is not None: |
408 if now >= time_next_check: | 408 if now >= time_next_check: |
409 if canceled(): | 409 if canceled(): |
410 raise CanceledByUser | 410 raise CanceledByUser |
411 else: | 411 else: |
412 time_next_check = now + .15 | 412 time_next_check = now + .15 |
413 time.sleep(0) | 413 time.sleep(.001) |
414 if config.globalconf.force_zero_exitcode and case.process.returncode: | 414 if config.globalconf.force_zero_exitcode and case.process.returncode: |
415 raise NonZeroExitCode(case.process.returncode) | 415 raise NonZeroExitCode(case.process.returncode) |
416 callback() | 416 callback() |
417 case.has_called_back = True | 417 case.has_called_back = True |
418 outfile.seek(0) | 418 outfile.seek(0) |
441 if now >= time_next_check: | 441 if now >= time_next_check: |
442 if canceled(): | 442 if canceled(): |
443 raise CanceledByUser | 443 raise CanceledByUser |
444 else: | 444 else: |
445 time_next_check = now + .15 | 445 time_next_check = now + .15 |
446 time.sleep(0) | 446 time.sleep(.001) |
447 else: | 447 else: |
448 time_end = case.time_started + case.maxtime | 448 time_end = case.time_started + case.maxtime |
449 while True: | 449 while True: |
450 exitcode, now = case.process.poll(), clock() | 450 exitcode, now = case.process.poll(), clock() |
451 if exitcode is not None: | 451 if exitcode is not None: |
457 if now >= time_next_check: | 457 if now >= time_next_check: |
458 if canceled(): | 458 if canceled(): |
459 raise CanceledByUser | 459 raise CanceledByUser |
460 else: | 460 else: |
461 time_next_check = now + .15 | 461 time_next_check = now + .15 |
462 time.sleep(0) | 462 time.sleep(.001) |
463 if config.globalconf.force_zero_exitcode and case.process.returncode: | 463 if config.globalconf.force_zero_exitcode and case.process.returncode: |
464 raise NonZeroExitCode(case.process.returncode) | 464 raise NonZeroExitCode(case.process.returncode) |
465 callback() | 465 callback() |
466 case.has_called_back = True | 466 case.has_called_back = True |
467 with open(case.problem.config.outname, 'rU') as output: | 467 with open(case.problem.config.outname, 'rU') as output: |