mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-17 16:47:50 +00:00
test/exhaustive: catch Exception instead of
BaseException Replace bare except clauses with except Exception to avoid catching BaseException subclasses like SystemExit and KeyboardInterrupt. Assisted-by: Claude Code (claude-opus-4-6) Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
parent
673876cee2
commit
185f9e63ff
2 changed files with 11 additions and 11 deletions
|
|
@ -56,7 +56,7 @@ def make_pipes(task_nr, nr_pipes, pipes, comb, status_pipe):
|
|||
def get_pipe_ino(pid, fd):
|
||||
try:
|
||||
return os.stat('/proc/%d/fd/%d' % (pid, fd)).st_ino
|
||||
except:
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
|
|
@ -205,7 +205,7 @@ def cr_test(pid):
|
|||
criu_bin, 'dump', '-t',
|
||||
'%d' % pid, '-D', img_dir, '-o', 'dump.log', '-v4', '-j'
|
||||
])
|
||||
except:
|
||||
except Exception:
|
||||
print('`- dump fail')
|
||||
return False
|
||||
|
||||
|
|
@ -215,7 +215,7 @@ def cr_test(pid):
|
|||
criu_bin, 'restore', '-D', img_dir, '-o', 'rst.log', '-v4', '-j',
|
||||
'-d', '-S'
|
||||
])
|
||||
except:
|
||||
except Exception:
|
||||
print('`- restore fail')
|
||||
return False
|
||||
|
||||
|
|
@ -248,7 +248,7 @@ def run(comb, opts):
|
|||
try:
|
||||
# Kick the test to check its state
|
||||
s.sendto(res, '\0CRIUPCSK')
|
||||
except:
|
||||
except Exception:
|
||||
# Restore might have failed or smth else happened
|
||||
os.kill(pid, signal.SIGKILL)
|
||||
s.close()
|
||||
|
|
|
|||
|
|
@ -476,7 +476,7 @@ def chk_real_state(st):
|
|||
rsk = st.real_sockets[sk.sk_id]
|
||||
try:
|
||||
s_st = os.fstat(rsk.fileno())
|
||||
except:
|
||||
except Exception:
|
||||
print('FAIL: Socket %d lost' % sk.sk_id)
|
||||
return CHK_FAIL_SOCKET
|
||||
if not stat.S_ISSOCK(s_st.st_mode):
|
||||
|
|
@ -518,7 +518,7 @@ def chk_real_state(st):
|
|||
acc.act(st)
|
||||
try:
|
||||
acc.do(st)
|
||||
except:
|
||||
except Exception:
|
||||
print('FAIL: Cannot accept pending connection for %d' %
|
||||
sk.sk_id)
|
||||
return CHK_FAIL_ACCEPT
|
||||
|
|
@ -537,7 +537,7 @@ def chk_real_state(st):
|
|||
msg = sk.inqueue.pop(0)
|
||||
try:
|
||||
r_msg, m_from = rsk.recvfrom(128)
|
||||
except:
|
||||
except Exception:
|
||||
print('FAIL: No message in queue for %d' % sk.sk_id)
|
||||
return CHK_FAIL_RECV_0
|
||||
|
||||
|
|
@ -570,7 +570,7 @@ def chk_real_state(st):
|
|||
try:
|
||||
rsk.send(msgv)
|
||||
rmsg = psk.recv(128)
|
||||
except:
|
||||
except Exception:
|
||||
print('FAIL: Connectivity %d -> %d lost' % (sk.sk_id, sk.peer))
|
||||
return CHK_FAIL_CONNECT
|
||||
|
||||
|
|
@ -621,7 +621,7 @@ def chk_state(st, opts):
|
|||
criu_bin, "dump", "-t",
|
||||
"%d" % pid, "-D", img_path, "-v4", "-o", "dump.log", "-j"
|
||||
])
|
||||
except:
|
||||
except Exception:
|
||||
print("Dump failed")
|
||||
os.kill(pid, signal.SIGKILL)
|
||||
return CHK_FAIL_DUMP
|
||||
|
|
@ -633,7 +633,7 @@ def chk_state(st, opts):
|
|||
criu_bin, "restore", "-D", img_path, "-v4", "-o", "rst.log", "-j",
|
||||
"-d", "-S"
|
||||
])
|
||||
except:
|
||||
except Exception:
|
||||
print("Restore failed")
|
||||
return CHK_FAIL_RESTORE
|
||||
|
||||
|
|
@ -641,7 +641,7 @@ def chk_state(st, opts):
|
|||
signal_sk = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM, 0)
|
||||
try:
|
||||
signal_sk.sendto('check', sigsk_name)
|
||||
except:
|
||||
except Exception:
|
||||
# Probably the peer has died before us or smth else went wrong
|
||||
os.kill(pid, signal.SIGKILL)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue