comparison tests/run-tests.py @ 27933:a6833e464b07 stable

run-tests: "fix" race condition in race condition fix Laurent's commit 3203dfe341f9 still suffers from a race: by the time the "job" function tries to assign to channels[channel], that list has been truncated to empty. The result is that every job thread raises an IndexError. Earlier, I tried an approach of correctly locking channels, but that caused run-tests to hang on KeyboardInterrupt sometimes. This approach is strictly hackier, but seems to actually work reliably.
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 22 Jan 2016 11:00:13 -0800
parents 0de4dfc9af0c
children fb92927f9775
comparison
equal deleted inserted replaced
27932:6bc2299cc12f 27933:a6833e464b07
1524 channel = n 1524 channel = n
1525 break 1525 break
1526 channels[channel] = "=" + test.name[5:].split(".")[0] 1526 channels[channel] = "=" + test.name[5:].split(".")[0]
1527 try: 1527 try:
1528 test(result) 1528 test(result)
1529 channels[channel] = ''
1530 done.put(None) 1529 done.put(None)
1531 except KeyboardInterrupt: 1530 except KeyboardInterrupt:
1532 channels[channel] = '' 1531 pass
1533 except: # re-raises 1532 except: # re-raises
1534 done.put(('!', test, 'run-test raised an error, see traceback')) 1533 done.put(('!', test, 'run-test raised an error, see traceback'))
1535 raise 1534 raise
1535 try:
1536 channels[channel] = ''
1537 except IndexError:
1538 pass
1536 1539
1537 def stat(): 1540 def stat():
1538 count = 0 1541 count = 0
1539 while channels: 1542 while channels:
1540 d = '\n%03s ' % count 1543 d = '\n%03s ' % count