Mercurial > hg-stable
changeset 27926:4c6053a6b17d stable
run-tests: fix race condition
Before this patch, it was possible for run-tests to crash on a race condition.
The race condition happens in the following case:
- the last test finishes and calls: done.put(None)
- the context switches to the main thread that clears the channels list
- the context switches to the last test mentioned above, it tries to access
channels[channel] and crashes
This happened to me while running run-tests.
This patch fixes the issue by clearing the channel before considering that the
test is done.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Thu, 21 Jan 2016 12:37:12 -0800 |
parents | f6d73c8756e2 |
children | 0de4dfc9af0c |
files | tests/run-tests.py |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/run-tests.py Thu Jan 21 21:15:52 2016 +0000 +++ b/tests/run-tests.py Thu Jan 21 12:37:12 2016 -0800 @@ -1526,13 +1526,13 @@ channels[channel] = "=" + test.name[5:].split(".")[0] try: test(result) + channels[channel] = '' done.put(None) except KeyboardInterrupt: - pass + channels[channel] = '' except: # re-raises done.put(('!', test, 'run-test raised an error, see traceback')) raise - channels[channel] = '' def stat(): count = 0