mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-03 15:55:53 +00:00
zdtm: check sequence numbers for tcp sockets
They have to be the same on each iteration. travis-ci: success for series starting with [01/21] build: install libnet-dev Signed-off-by: Andrei Vagin <avagin@virtuozzo.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
d61c75bc5d
commit
1a89b88c08
@@ -3,7 +3,7 @@ set -x -e
|
||||
|
||||
TRAVIS_PKGS="protobuf-c-compiler libprotobuf-c0-dev libaio-dev
|
||||
libprotobuf-dev protobuf-compiler python-ipaddr libcap-dev
|
||||
libnl-3-dev gdb bash python-protobuf libnet-dev"
|
||||
libnl-3-dev gdb bash python-protobuf libnet-dev util-linux"
|
||||
|
||||
travis_prep () {
|
||||
[ -n "$SKIP_TRAVIS_PREP" ] && return
|
||||
|
@@ -1017,6 +1017,7 @@ def cr(cr_api, test, opts):
|
||||
try_run_hook(test, ["--pre-restore"])
|
||||
cr_api.restore()
|
||||
os.environ["ZDTM_TEST_PID"] = str(test.getpid())
|
||||
os.environ["ZDTM_IMG_DIR"] = cr_api.logs()
|
||||
try_run_hook(test, ["--post-restore"])
|
||||
sbs('post-restore')
|
||||
|
||||
|
1
test/zdtm/static/socket-tcp-close-wait.hook
Symbolic link
1
test/zdtm/static/socket-tcp-close-wait.hook
Symbolic link
@@ -0,0 +1 @@
|
||||
socket-tcp-fin-wait1.hook
|
1
test/zdtm/static/socket-tcp-closed.hook
Symbolic link
1
test/zdtm/static/socket-tcp-closed.hook
Symbolic link
@@ -0,0 +1 @@
|
||||
socket-tcp-fin-wait1.hook
|
1
test/zdtm/static/socket-tcp-closing.hook
Symbolic link
1
test/zdtm/static/socket-tcp-closing.hook
Symbolic link
@@ -0,0 +1 @@
|
||||
socket-tcp-fin-wait1.hook
|
66
test/zdtm/static/socket-tcp-fin-wait1.hook
Executable file
66
test/zdtm/static/socket-tcp-fin-wait1.hook
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
|
||||
sys.path.append("../crit")
|
||||
|
||||
import pycriu
|
||||
import os, os.path
|
||||
import json
|
||||
import difflib
|
||||
import subprocess
|
||||
|
||||
if sys.argv[1] in ["--pre-dump", "--post-restore"]:
|
||||
pid = os.getenv("ZDTM_TEST_PID")
|
||||
try:
|
||||
subprocess.Popen(["nsenter", "-t", pid, "-n", "ss", "-t", "-a", "-n"]).wait()
|
||||
except OSError, e:
|
||||
pass
|
||||
|
||||
if sys.argv[1] != "--post-restore":
|
||||
sys.exit(0)
|
||||
|
||||
print "Check TCP images"
|
||||
|
||||
def get_sockets(image_dir):
|
||||
f = open(os.path.join(image_dir, "inetsk.img"))
|
||||
sockets = pycriu.images.load(f)
|
||||
sockets = sockets["entries"]
|
||||
|
||||
for s in sockets:
|
||||
f = open(os.path.join(image_dir, "inetsk.img"))
|
||||
ids = pycriu.images.load(f)
|
||||
tcp_img = os.path.join(image_dir, "tcp-stream-%x.img" % int(s["ino"]))
|
||||
print tcp_img
|
||||
if os.access(tcp_img, os.F_OK):
|
||||
f = open(tcp_img)
|
||||
tcp = pycriu.images.load(f)
|
||||
s['tcp'] = tcp["entries"][0]
|
||||
s["tcp"].pop("extra", None)
|
||||
s["tcp"].pop("timestamp", None)
|
||||
s["tcp"].pop("snd_wl1", None)
|
||||
s["tcp"].pop("rcv_wnd", None)
|
||||
s["tcp"].pop("snd_wnd", None)
|
||||
s["tcp"].pop("max_window", None)
|
||||
s.pop("id", None)
|
||||
s.pop("ino")
|
||||
sockets.sort(lambda a, b: cmp(a["src_port"] + a["dst_port"], b["src_port"] + b["dst_port"]))
|
||||
return sockets
|
||||
|
||||
path = os.getenv("ZDTM_IMG_DIR")
|
||||
prev = None
|
||||
exit_code = 0
|
||||
for d in os.listdir(path):
|
||||
sockets = get_sockets(os.path.join(path, d))
|
||||
if not prev:
|
||||
prev = sockets
|
||||
continue
|
||||
|
||||
if prev == sockets:
|
||||
continue
|
||||
|
||||
sockets_str = json.dumps(sockets, sys.stdout, indent=8, sort_keys=True)
|
||||
prev_str = json.dumps(prev, sys.stdout, indent=8, sort_keys=True)
|
||||
|
||||
print "\n".join(difflib.unified_diff(prev_str.split("\n"), sockets_str.split("\n")))
|
||||
|
||||
sys.exit(exit_code)
|
1
test/zdtm/static/socket-tcp-fin-wait2.hook
Symbolic link
1
test/zdtm/static/socket-tcp-fin-wait2.hook
Symbolic link
@@ -0,0 +1 @@
|
||||
socket-tcp-fin-wait1.hook
|
1
test/zdtm/static/socket-tcp-last-ack.hook
Symbolic link
1
test/zdtm/static/socket-tcp-last-ack.hook
Symbolic link
@@ -0,0 +1 @@
|
||||
socket-tcp-fin-wait1.hook
|
1
test/zdtm/static/socket-tcp-local.hook
Symbolic link
1
test/zdtm/static/socket-tcp-local.hook
Symbolic link
@@ -0,0 +1 @@
|
||||
socket-tcp-fin-wait2.hook
|
1
test/zdtm/static/socket-tcp-syn-sent.hook
Symbolic link
1
test/zdtm/static/socket-tcp-syn-sent.hook
Symbolic link
@@ -0,0 +1 @@
|
||||
socket-tcp-fin-wait1.hook
|
Reference in New Issue
Block a user