Commit b4afa080 authored by Andrei Vagin's avatar Andrei Vagin Committed by Pavel Emelyanov

test: make zdtm.py python2/python3 compatible

Cc: Adrian Reber <areber@redhat.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent c971d7a9
......@@ -32,7 +32,7 @@ prev_line = None
def alarm(*args):
print "==== ALARM ===="
print("==== ALARM ====")
signal.signal(signal.SIGALRM, alarm)
......@@ -480,14 +480,14 @@ class zdtm_test:
notify_fdout_path = "/proc/%s/fd/%s" % (self.__pid, env['ZDTM_NOTIFY_FDOUT'])
notify_fdin_path = "/proc/%s/fd/%s" % (self.__pid, env['ZDTM_NOTIFY_FDIN'])
print "Send pre-dump notify to %s" % (self.__pid)
print("Send pre-dump notify to %s" % (self.__pid))
with open(notify_fdout_path) as fdout:
with open(notify_fdin_path, "w") as fdin:
fdin.write(struct.pack("i", 0))
fdin.flush()
print "Wait pre-dump notify reply"
print("Wait pre-dump notify reply")
ret = struct.unpack('i', fdout.read(4))
print "Completed pre-dump notify with %d" % (ret)
print("Completed pre-dump notify with %d" % (ret))
def stop(self):
self.__freezer.thaw()
......@@ -500,7 +500,7 @@ class zdtm_test:
print_sep(self.__name + '.out.inprogress')
print(open(self.__name + '.out.inprogress').read())
print_sep(self.__name + '.out.inprogress')
raise test_fail_exc("result check")
raise test_fail_exc("result check: %s" % list(map(lambda s: s.strip(), res.split())) + res)
def getpid(self):
if self.__pid == 0:
......@@ -1635,7 +1635,7 @@ class Launcher:
while True:
try:
pid, status = os.waitpid(0, flags)
except OSError, e:
except OSError as e:
if e.errno == errno.EINTR:
subprocess.Popen(["ps", "axf"]).wait()
continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment