Skip to content

Commit 83e540f

Browse files
committed
dumper, restorer, python tests
1 parent 6a7df77 commit 83e540f

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

Diff for: dumper.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
rm -rf ../dump/*
4+
../criu/criu/criu dump -v4 -t $(pgrep tcp_server) --images-dir ../dump/ --tcp-established -o dump.log
5+

Diff for: restorer.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
../criu/criu/criu restore -v4 --images-dir ../dump/ --tcp-established -o restore.log

Diff for: testClient.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env python3
2+
3+
import socket
4+
import sys
5+
6+
HOST = 'localhost' # The server's hostname or IP address
7+
PORT = 8888 # The port used by the server
8+
9+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
10+
s.connect((HOST, PORT))
11+
for line in sys.stdin:
12+
s.sendall(line.encode())
13+
data = s.recv(1024)
14+
print('Received', repr(data))
15+

Diff for: testServer.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env python3
2+
3+
import socket
4+
5+
PORT = 8888 # Port to listen on (non-privileged ports are > 1023)
6+
7+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
8+
s.bind(('', PORT))
9+
s.listen()
10+
print("Testing something")
11+
while True:
12+
conn, addr = s.accept()
13+
with conn:
14+
print('Connected by', addr)
15+
while True:
16+
data = conn.recv(1024)
17+
if not data:
18+
break
19+
print("Received %s" % data.decode())
20+
conn.sendall(data)

0 commit comments

Comments
 (0)