mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
rpc/log: return first error always
Use shared first error buffer to return correct first error in rpc. Fixes: #338 Signed-off-by: Ivan Pravdin <ipravdin.official@gmail.com>
This commit is contained in:
parent
a79b33d0c5
commit
922754dffd
3 changed files with 48 additions and 2 deletions
|
|
@ -40,7 +40,7 @@ class test:
|
|||
resp.ParseFromString(self.s.recv(self._MAX_MSG_SIZE))
|
||||
return resp
|
||||
|
||||
def check_resp(self, resp, typ, err):
|
||||
def check_resp(self, resp, typ, err, errmsg = None):
|
||||
if resp.type != typ:
|
||||
raise Exception('Unexpected response type ' + str(resp.type))
|
||||
|
||||
|
|
@ -49,6 +49,9 @@ class test:
|
|||
|
||||
if err and resp.cr_errno != err:
|
||||
raise Exception('Unexpected cr_errno ' + str(resp.cr_errno))
|
||||
|
||||
if errmsg and errmsg not in resp.cr_errmsg:
|
||||
raise Exception('Unexpected cr_msg \'' + str(resp.cr_errmsg) + '\'')
|
||||
|
||||
def no_process(self):
|
||||
print('Try to dump unexisting process')
|
||||
|
|
@ -131,12 +134,29 @@ class test:
|
|||
self.check_resp(resp, rpc.EMPTY, None)
|
||||
|
||||
print('Success')
|
||||
|
||||
def child_first_err(self):
|
||||
print('Receive correct first error message')
|
||||
|
||||
req = self.get_base_req()
|
||||
req.type = rpc.CHECK
|
||||
|
||||
# mntns_compat_mode options is only allowed on restore
|
||||
req.opts.mntns_compat_mode = True
|
||||
|
||||
self.send_req(req)
|
||||
resp = self.recv_resp()
|
||||
|
||||
self.check_resp(resp, rpc.CHECK, None, "Option --mntns-compat-mode is only valid on restore\n")
|
||||
|
||||
print('Success')
|
||||
|
||||
def run(self):
|
||||
self.no_process()
|
||||
self.process_exists()
|
||||
self.bad_options()
|
||||
self.bad_request()
|
||||
self.child_first_err()
|
||||
|
||||
|
||||
t = test()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue