From ed84572312108e0420735cf3639e7be3b02c44b9 Mon Sep 17 00:00:00 2001
From: Alberto Bertogli <albertito@blitiri.com.ar>
Date: Wed, 15 Jul 2009 15:54:15 -0300
Subject: [PATCH 40/74] tests/stress: Wrap around jfsck()

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

diff --git a/tests/stress/jiostress b/tests/stress/jiostress
index 83973cb..dc0e2a7 100755
--- a/tests/stress/jiostress
+++ b/tests/stress/jiostress
@@ -43,6 +43,16 @@ def randfloat(min, max):
 class ConsistencyError (Exception):
 	pass
 
+def jfsck(fname):
+	try:
+		r = libjio.jfsck(fname)
+		return r
+	except IOError as e:
+		if e.args[0] == libjio.J_ENOJOURNAL:
+			return { 'total': 0 }
+		else:
+			raise
+
 
 #
 # The test itself
@@ -151,14 +161,8 @@ class Stresser:
 
 	def reopen(self):
 		self.jf = None
-		r = { 'total': 0 }
-		try:
-			r = libjio.jfsck(self.fname)
-		except IOError as e:
-			if e.args[0] == libjio.J_ENOJOURNAL:
-				pass
-			else:
-				raise
+		r = jfsck(self.fname)
+
 		self.verify()
 
 		self.jf = libjio.open(self.fname,
@@ -265,7 +269,7 @@ def main():
 	print("  %d operations" % nops)
 	print("  %d simulated failures" % nfailures)
 
-	r = libjio.jfsck(fname)
+	r = jfsck(fname)
 	assert r['total'] == 0
 	print("Final check completed")
 	#os.unlink(fname)
-- 
1.6.2.2.646.gb214


