[CRIU] [PATCH 2/4] zdtm.py: Print out file if it exists

Pavel Emelyanov xemul at parallels.com
Thu Oct 8 13:07:56 PDT 2015


Sometimes tests fail before generating .out file, so print its
contents only if it exists.

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 test/zdtm.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/test/zdtm.py b/test/zdtm.py
index 8a3aa9c..ed87efb 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -265,9 +265,10 @@ class zdtm_test:
 			os.unlink(self.__pidfile())
 
 	def print_output(self):
-		print "Test output: " + "=" * 32
-		print open(self.__name + '.out').read()
-		print " <<< " + "=" * 32
+		if os.access(self.__name + '.out', os.R_OK):
+			print "Test output: " + "=" * 32
+			print open(self.__name + '.out').read()
+			print " <<< " + "=" * 32
 
 
 test_classes = { 'zdtm': zdtm_test }
-- 
1.9.3




More information about the CRIU mailing list