From de5f21f9ebc9b437a94cdb85fb961ecc5cd2d1e4 Mon Sep 17 00:00:00 2001
From: Alberto Bertogli <albertito@blitiri.com.ar>
Date: Wed, 15 Jul 2009 15:55:02 -0300
Subject: [PATCH 41/74] tests/stress: Implement pread() properly

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
---
 tests/stress/jiostress |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

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):
-- 
1.6.2.2.646.gb214


