sourcebots / robot-api

(Legacy) API to interface with robotd
http://docs.sourcebots.co.uk/api/
MIT License
4 stars 1 forks source link

Fix race condition in power board tests #65

Closed kierdavis closed 6 years ago

kierdavis commented 6 years ago

See inline comment.

This fixes race conditions in the test_buzz_message and test_fractional_buzz_duration power board tests.

Previously, clear_queue would be called immediately after initialising the Robot instance. If the board runner subprocess hasn't had time to decode the packets sent by Robot.__init__ before clear_queue was called, then these packets will end up at the head of the queue after the call to clear_queue. This means that the check to see if the packet at the head of the queue is buzz packet sometimes fails, depending on the nondeterministicness of the process scheduler.