comparison tests/run-tests.py @ 49214:eca367970253 stable

run-tests: send the test result after freeing the channel Sending the message about the test being "done" signals to the main thread that a new test can be started. Before this changeset, we sent this signal before freeing the channel, there is room for a race condition where a new test would search for a channel before the old test freed the one it used. This is an example of the failure it would produce: https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/552404
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 24 May 2022 09:57:53 +0200
parents c95e5ba4de1e
children 8d31ef3017c9
comparison
equal deleted inserted replaced
49213:c95e5ba4de1e 49214:eca367970253
2561 channel = n 2561 channel = n
2562 break 2562 break
2563 else: 2563 else:
2564 raise ValueError('Could not find output channel') 2564 raise ValueError('Could not find output channel')
2565 channels[channel] = "=" + test.name[5:].split(".")[0] 2565 channels[channel] = "=" + test.name[5:].split(".")[0]
2566
2567 r = None
2566 try: 2568 try:
2567 test(result) 2569 test(result)
2568 done.put(None)
2569 except KeyboardInterrupt: 2570 except KeyboardInterrupt:
2570 done.put(None) 2571 pass
2571 except: # re-raises 2572 except: # re-raises
2572 done.put(('!', test, 'run-test raised an error, see traceback')) 2573 r = ('!', test, 'run-test raised an error, see traceback')
2573 raise 2574 raise
2574 finally: 2575 finally:
2575 try: 2576 try:
2576 channels[channel] = '' 2577 channels[channel] = ''
2577 except IndexError: 2578 except IndexError:
2578 pass 2579 pass
2580 done.put(r)
2579 2581
2580 def stat(): 2582 def stat():
2581 count = 0 2583 count = 0
2582 while channels: 2584 while channels:
2583 d = '\n%03s ' % count 2585 d = '\n%03s ' % count