mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-26 19:49:12 +00:00
zdtm: Test sit device C/R
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
87bfe58800
commit
fb85281c3b
3 changed files with 62 additions and 0 deletions
|
|
@ -172,6 +172,7 @@ TST_NOFILE := \
|
|||
helper_zombie_child \
|
||||
clone_fs \
|
||||
macvlan \
|
||||
sit \
|
||||
cr_veth \
|
||||
sock_peercred \
|
||||
s390x_mmap_high \
|
||||
|
|
|
|||
58
test/zdtm/static/sit.c
Normal file
58
test/zdtm/static/sit.c
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
#include <linux/limits.h>
|
||||
#include <signal.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <net/if.h>
|
||||
#include "zdtmtst.h"
|
||||
|
||||
const char *test_doc = "check sit devices";
|
||||
const char *test_author = "Pavel Emelyanov <xemul@virtuozzo.com>";
|
||||
|
||||
#define IF_NAME "zdtmsit0"
|
||||
#define LOCAL_ADDR "1.1.1.2"
|
||||
#define REMOT_ADDR "2.2.2.1"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int ret = 1;
|
||||
|
||||
test_init(argc, argv);
|
||||
|
||||
if (system("ip link add " IF_NAME " type sit ttl 13 local " LOCAL_ADDR " remote " REMOT_ADDR)) {
|
||||
pr_perror("Can't make sit device");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (system("ip -details addr list dev " IF_NAME " > sit.dump.test")) {
|
||||
fail("can't save net config");
|
||||
goto out;
|
||||
}
|
||||
|
||||
test_daemon();
|
||||
test_waitsig();
|
||||
|
||||
if (system("ip -details addr list dev " IF_NAME " > sit.rst.test")) {
|
||||
fail("can't get net config");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (system("diff sit.rst.test sit.dump.test")) {
|
||||
fail("Net config differs after restore");
|
||||
goto out;
|
||||
}
|
||||
|
||||
pass();
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
3
test/zdtm/static/sit.desc
Normal file
3
test/zdtm/static/sit.desc
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{ 'deps': [ '/bin/sh', '/sbin/ip|/bin/ip', '/usr/bin/diff' ],
|
||||
'flags': 'suid',
|
||||
'flavor': 'ns uns' }
|
||||
Loading…
Add table
Add a link
Reference in a new issue