Index: tests/pybin/tools.py
===================================================================
--- tests/pybin/tools.py	(revision f9128a579682d99eadea38d7faf6034d7a714a29)
+++ tests/pybin/tools.py	(revision 504eb72fc3a32710df1a99fba0601f0cbc45cc12)
@@ -179,4 +179,15 @@
 			os.chdir(cwd)
 
+def killgroup():
+	try:
+		os.killpg(os.getpgrp(), signal.SIGINT)
+	except KeyboardInterrupt:
+		pass # expected
+	except Exception as exc:
+		print("Unexpected exception", file=sys.stderr)
+		print(exc, file=sys.stderr)
+		sys.stderr.flush()
+		sys.exit(2)
+
 ################################################################################
 #               file handling
@@ -301,2 +312,8 @@
         self.end = time.time()
         self.duration = self.end - self.start
+
+def timed(src, timeout):
+	expire = time.time() + timeout
+	i = iter(src)
+	while True:
+		yield i.next(max(expire - time.time(), 0))
