diff options
-rwxr-xr-x | test/others/rpc/config_file.py | 17 | ||||
-rw-r--r-- | test/others/rpc/setup_swrk.py | 16 | ||||
-rwxr-xr-x | test/others/rpc/version.py | 13 |
3 files changed, 21 insertions, 25 deletions
diff --git a/test/others/rpc/config_file.py b/test/others/rpc/config_file.py index e4b395e31..7b07bc145 100755 --- a/test/others/rpc/config_file.py +++ b/test/others/rpc/config_file.py @@ -1,31 +1,18 @@ #!/usr/bin/python import os -import socket import sys import rpc_pb2 as rpc import argparse -import subprocess from tempfile import mkstemp import time +from setup_swrk import setup_swrk + log_file = 'config_file_test.log' does_not_exist = 'does-not.exist' -def setup_swrk(): - print('Connecting to CRIU in swrk mode.') - s1, s2 = socket.socketpair(socket.AF_UNIX, socket.SOCK_SEQPACKET) - - kwargs = {} - if sys.version_info.major == 3: - kwargs["pass_fds"] = [s1.fileno()] - - swrk = subprocess.Popen(['./criu', "swrk", "%d" % s1.fileno()], **kwargs) - s1.close() - return swrk, s2 - - def setup_config_file(content): # Creating a temporary file which will be used as configuration file. fd, path = mkstemp() diff --git a/test/others/rpc/setup_swrk.py b/test/others/rpc/setup_swrk.py new file mode 100644 index 000000000..c7f84f952 --- /dev/null +++ b/test/others/rpc/setup_swrk.py @@ -0,0 +1,16 @@ +import sys +import socket +import subprocess + +def setup_swrk(): + print('Connecting to CRIU in swrk mode.') + s1, s2 = socket.socketpair(socket.AF_UNIX, socket.SOCK_SEQPACKET) + + kwargs = {} + if sys.version_info.major == 3: + kwargs["pass_fds"] = [s1.fileno()] + + swrk = subprocess.Popen(['./criu', "swrk", "%d" % s1.fileno()], **kwargs) + s1.close() + return swrk, s2 + diff --git a/test/others/rpc/version.py b/test/others/rpc/version.py index 3b8f1b961..9d7fa745b 100755 --- a/test/others/rpc/version.py +++ b/test/others/rpc/version.py @@ -1,20 +1,13 @@ #!/usr/bin/python -import socket import sys import rpc_pb2 as rpc -import subprocess -print('Connecting to CRIU in swrk mode to check the version:') - -s1, s2 = socket.socketpair(socket.AF_UNIX, socket.SOCK_SEQPACKET) +from setup_swrk import setup_swrk -kwargs = {} -if sys.version_info.major == 3: - kwargs["pass_fds"] = [s2.fileno()] +print('Connecting to CRIU in swrk mode to check the version:') -swrk = subprocess.Popen(['./criu', "swrk", "%d" % s2.fileno()], **kwargs) -s2.close() +swrk, s1 = setup_swrk() # Create criu msg, set it's type to dump request # and set dump options. Checkout more options in protobuf/rpc.proto |