mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 09:58:09 +00:00
test: check restoring external fifo-s
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
c26da2fd59
commit
3e0e65dd50
35
test/inhfd/fifo.py
Executable file
35
test/inhfd/fifo.py
Executable file
@ -0,0 +1,35 @@
|
||||
import os, tempfile
|
||||
|
||||
id_str = ""
|
||||
|
||||
def create_fds():
|
||||
tdir = tempfile.mkdtemp("zdtm.inhfd.XXXXXX")
|
||||
if os.system("mount -t tmpfs zdtm.inhfd %s" % tdir) != 0:
|
||||
raise Exception("Unable to mount tmpfs")
|
||||
tfifo = os.path.join(tdir, "test_fifo")
|
||||
os.mkfifo(tfifo)
|
||||
fd2 = open(tfifo, "w+")
|
||||
fd1 = open(tfifo, "r")
|
||||
os.system("umount -l %s" % tdir)
|
||||
os.rmdir(tdir)
|
||||
|
||||
mnt_id = -1;
|
||||
f = open("/proc/self/fdinfo/%d" % fd1.fileno())
|
||||
for l in f:
|
||||
l = l.split()
|
||||
if l[0] == "mnt_id:":
|
||||
mnt_id = int(l[1])
|
||||
break
|
||||
else:
|
||||
raise Exception("Unable to find mnt_id")
|
||||
|
||||
global id_str
|
||||
id_str = "file[%x:%x]" % (mnt_id, os.fstat(fd1.fileno()).st_ino)
|
||||
|
||||
return (fd2, fd1)
|
||||
|
||||
def filename(pipef):
|
||||
return id_str
|
||||
|
||||
def dump_opts(sockf):
|
||||
return [ "--external", id_str ]
|
1
test/inhfd/fifo.py.desc
Normal file
1
test/inhfd/fifo.py.desc
Normal file
@ -0,0 +1 @@
|
||||
{ 'flavor': 'h' }
|
Loading…
x
Reference in New Issue
Block a user