1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
Description: Fix build for slower machines
Use a more flexible wait behaviour in the facilitator test.
Author: Ximin Luo <infinity0@torproject.org>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=765156
Applied-Upstream: commit:c89d0c04a6e454c54a58cd17c0b2e7c7267f15fc
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/facilitator/fp-facilitator-test.py
+++ b/facilitator/fp-facilitator-test.py
@@ -209,7 +209,20 @@
self.relay_file.seek(0)
fn = os.path.join(os.path.dirname(__file__), "./fp-facilitator")
self.process = subprocess.Popen(["python", fn, "-d", "-p", str(FACILITATOR_PORT), "-r", self.relay_file.name, "-l", "/dev/null"])
- time.sleep(0.1)
+ self.waitForChild()
+
+ def waitForChild(self):
+ """Wait until the child process is responsive. This takes different
+ times on different machines so be flexible in how long to wait. e.g.
+ see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=765156"""
+ for i in xrange(0, 20):
+ try:
+ s = fac.fac_socket(FACILITATOR_ADDR)
+ s.close()
+ return
+ except socket.error as e:
+ time.sleep(0.05)
+ raise e
def tearDown(self):
ret = self.process.poll()
|