[CRIU] [PATCH] zdtm.py: Fix eval error if empty desc file provided

Cyrill Gorcunov gorcunov at openvz.org
Fri Jan 20 10:38:32 PST 2017


If desc is empty we should not try to eval it,
otherwise it would lead to exceptio. So test
for its size as well.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 test/zdtm.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/zdtm.py b/test/zdtm.py
index 89563bf0d98b..43db2ad426f6 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -1483,7 +1483,7 @@ default_test = {}
 
 def get_test_desc(tname):
 	d_path = tname + '.desc'
-	if os.access(d_path, os.F_OK):
+	if os.access(d_path, os.F_OK) and os.path.getsize(d_path) > 0:
 		return eval(open(d_path).read())
 
 	return default_test
-- 
2.7.4



More information about the CRIU mailing list