Skip to content

Commit

Permalink
zdtm: add --pidfd-store option in RPC mode
Browse files Browse the repository at this point in the history
When testing pid reuse using pidfd_store feature in RPC mode we need
to pass a unix socket fd used to CRIU in the RPC option
pidfd_store_sk to store the pidfds between predump/dump iterations.

Signed-off-by: Zeyad Yasser <zeyady98@gmail.com>
  • Loading branch information
ZeyadYasser committed Apr 20, 2021
1 parent 0886b5e commit 9f0cd78
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/zdtm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import sys
import tempfile
import time
import socket
from builtins import (input, int, open, range, str, zip)

import pycriu as crpc
Expand Down Expand Up @@ -890,6 +891,8 @@ def terminate(self):


class criu_rpc:
pidfd_store_socket = None

@staticmethod
def __set_opts(criu, args, ctx):
while len(args) != 0:
Expand Down Expand Up @@ -943,6 +946,10 @@ def __set_opts(criu, args, ctx):
fd, key = key.split(":", 1)
inhfd.fd = int(fd[3:-1])
inhfd.key = key
elif "--pidfd-store" == arg:
if criu_rpc.pidfd_store_socket is None:
criu_rpc.pidfd_store_socket = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
criu.opts.pidfd_store_sk = criu_rpc.pidfd_store_socket.fileno()
else:
raise test_fail_exc('RPC for %s(%s) required' % (arg, args.pop(0)))

Expand Down

0 comments on commit 9f0cd78

Please sign in to comment.