[CRIU] [PATCH] zdtm.py: Make print_sep shorter and print aligned lines

Pavel Emelyanov xemul at parallels.com
Mon Oct 26 12:37:22 PDT 2015


Current implementation of print_sep has off-by-one-like issue -- it
can print one character more :) Fix this and make the code shorter.

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

diff --git a/test/zdtm.py b/test/zdtm.py
index f38566d..3f1ad13 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -657,9 +657,7 @@ def self_checkskip(tname):
 	return False
 
 def print_sep(title, sep = "="):
-	sep_len = (80 - len(title) - 2) / 2
-	sep = sep * sep_len
-	print "%s %s %s" % (sep, title, sep)
+	print (" " + title + " ").center(80, sep)
 
 def grep_errors(fname):
 	print_sep("grep Error")
-- 
1.9.3



More information about the CRIU mailing list