diff options
author | Adrian Reber <areber@redhat.com> | 2018-10-29 19:05:48 +0300 |
---|---|---|
committer | Andrei Vagin <avagin@gmail.com> | 2018-11-04 21:45:06 +0300 |
commit | 565498a7743ba61084a0c93900832f90641c9ba9 (patch) | |
tree | 8849c8235a43ed4f91b00a4fc736af39fafb701a /test | |
parent | 12fb7f5af06062ff7d162bec6d5f521e99ae5258 (diff) |
tests: more python3 compatibility
This makes two zdtm test scripts python3 compatible to run
zdtm on a system without python2.
Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
Diffstat (limited to 'test')
-rwxr-xr-x | test/zdtm/static/file_locks06.checkskip | 6 | ||||
-rwxr-xr-x | test/zdtm/static/socket-tcp-fin-wait1.hook | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/test/zdtm/static/file_locks06.checkskip b/test/zdtm/static/file_locks06.checkskip index e5a4775f8..06ab58521 100755 --- a/test/zdtm/static/file_locks06.checkskip +++ b/test/zdtm/static/file_locks06.checkskip @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python import fcntl import tempfile import struct @@ -12,8 +12,8 @@ try: fcntl.fcntl(fd.fileno(), F_OFD_SETLK, flock) except IOError as e: if e.errno == errno.EINVAL: - print "I/O error({0}): {1}".format(e.errno, e.strerror) - print "OFD locks are not supported." + print("I/O error({0}): {1}".format(e.errno, e.strerror)) + print("OFD locks are not supported.") exit(1) exit(0) diff --git a/test/zdtm/static/socket-tcp-fin-wait1.hook b/test/zdtm/static/socket-tcp-fin-wait1.hook index 9630e0d74..9504557da 100755 --- a/test/zdtm/static/socket-tcp-fin-wait1.hook +++ b/test/zdtm/static/socket-tcp-fin-wait1.hook @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python import sys sys.path.append("../crit") @@ -13,13 +13,13 @@ if sys.argv[1] in ["--pre-dump", "--post-restore"]: pid = os.getenv("ZDTM_TEST_PID") try: subprocess.Popen(["nsenter", "-t", pid, "-n", "ss", "-t", "-a", "-n"]).wait() - except OSError, e: + except OSError as e: pass if sys.argv[1] != "--post-restore": sys.exit(0) -print "Check TCP images" +print("Check TCP images") def get_sockets(image_dir): fname = os.path.join(image_dir, "inetsk.img") @@ -34,7 +34,7 @@ def get_sockets(image_dir): f = open(os.path.join(image_dir, "inetsk.img")) ids = pycriu.images.load(f) tcp_img = os.path.join(image_dir, "tcp-stream-%x.img" % int(s["ino"])) - print tcp_img + print(tcp_img) if os.access(tcp_img, os.F_OK): f = open(tcp_img) tcp = pycriu.images.load(f) @@ -65,6 +65,6 @@ for d in os.listdir(path): sockets_str = json.dumps(sockets, sys.stdout, indent=8, sort_keys=True) prev_str = json.dumps(prev, sys.stdout, indent=8, sort_keys=True) - print "\n".join(difflib.unified_diff(prev_str.split("\n"), sockets_str.split("\n"))) + print("\n".join(difflib.unified_diff(prev_str.split("\n"), sockets_str.split("\n")))) sys.exit(exit_code) |