racetest: Review
- Factor common logic to spawn and run group of test threads into TestGroup. This way the extra checks and robustness improvements, that Dieter just added to check_race_external_invalidate_vs_disconnect, become available to all tests in racetest module. Rework moved code so that nwork is not fixed beforehand and test threads can be added dynamically. - fix waiting logic in Finished: * on py2 Condition.wait does not return True/False as it does on py3 - we need to manually inspect the state. * fix race for when wait is called with already met condition: previously in such case it was waiting indefinitely and reporting failure on timeout - rename Finished to well-established concept of WaitGroup and adjust its interface accordingly (see https://pkg.go.dev/sync#WaitGroup, https://lab.nexedi.com/nexedi/pygolang/blob/master/golang/sync.py and https://lab.nexedi.com/nexedi/pygolang/blob/39dde7eb/golang/sync.cpp#L153-200) - no need to wrap try/except with additional try/finally, as try/except/finally works out of the box.
Showing
This diff is collapsed.
Please register or sign in to comment