git » libjio » commit de5f21f

tests/stress: Implement pread() properly

author Alberto Bertogli
2009-07-15 18:55:02 UTC
committer Alberto Bertogli
2009-07-15 18:56:21 UTC
parent ed84572312108e0420735cf3639e7be3b02c44b9

tests/stress: Implement pread() properly

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

tests/stress/jiostress +10 -1

diff --git a/tests/stress/jiostress b/tests/stress/jiostress
index dc0e2a7..7ae2dc5 100755
--- a/tests/stress/jiostress
+++ b/tests/stress/jiostress
@@ -90,8 +90,17 @@ class Stresser:
 	def pread(self, start, end):
 		ppos = self.f.tell()
 		self.f.seek(start, 0)
-		r = self.f.read(end - start)
+		r = bytes()
+		c = 0
+		total = end - start
+		while c < total:
+			n = self.f.read(total - c)
+			if (n == ''):
+				break
+			c += len(n)
+			r += n
 		self.f.seek(ppos, 0)
+		assert c == end - start
 		return r
 
 	def prep_randwrite(self):