Commit fe44213e authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

zdtm: allow to execute ipc_namespace and utsname tests in userns

Signed-off-by: 's avatarAndrew Vagin <avagin@openvz.org>
Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 5dc505c0
...@@ -193,11 +193,11 @@ generate_test_list() ...@@ -193,11 +193,11 @@ generate_test_list()
ns/static/mnt_ro_bind ns/static/mnt_ro_bind
ns/static/mount_paths ns/static/mount_paths
ns/static/bind-mount ns/static/bind-mount
static/utsname ns/static/utsname
static/ipc_namespace ns/static/ipc_namespace
static/shm static/shm
static/msgque static/msgque
static/sem ns/static/sem
transition/ipc transition/ipc
static/netns-nf static/netns-nf
static/netns static/netns
...@@ -292,6 +292,8 @@ generate_test_list() ...@@ -292,6 +292,8 @@ generate_test_list()
ns/static/rtc ns/static/rtc
ns/static/cow01 ns/static/cow01
ns/static/tempfs_ro ns/static/tempfs_ro
ns/static/ipc_namespace
ns/static/utsname
" "
# Add tests which can be executed in an user namespace # Add tests which can be executed in an user namespace
...@@ -360,6 +362,8 @@ apparmor ...@@ -360,6 +362,8 @@ apparmor
seccomp_strict seccomp_strict
different_creds different_creds
inotify01 inotify01
ipc_namespace
utsname
" "
TEST_EXPECTED_FAILURE=" TEST_EXPECTED_FAILURE="
......
...@@ -327,10 +327,12 @@ static void show_ipc_entry(struct ipc_ns *old, struct ipc_ns *new) ...@@ -327,10 +327,12 @@ static void show_ipc_entry(struct ipc_ns *old, struct ipc_ns *new)
old->mq_msgsize_max, new->mq_msgsize_max); old->mq_msgsize_max, new->mq_msgsize_max);
} }
static int test_fn(int argc, char **argv) int main(int argc, char **argv)
{ {
int ret; int ret;
test_init(argc, argv);
ret = rand_ipc_ns(); ret = rand_ipc_ns();
if (ret) { if (ret) {
pr_perror("Failed to randomize ipc ns before migration"); pr_perror("Failed to randomize ipc ns before migration");
...@@ -361,9 +363,3 @@ static int test_fn(int argc, char **argv) ...@@ -361,9 +363,3 @@ static int test_fn(int argc, char **argv)
pass(); pass();
return 0; return 0;
} }
int main(int argc, char **argv)
{
test_init_ns(argc, argv, CLONE_NEWIPC, test_fn);
return -1;
}
...@@ -105,11 +105,13 @@ static int check_sem_by_id(int id, int val) ...@@ -105,11 +105,13 @@ static int check_sem_by_id(int id, int val)
sizeof(unlock)/sizeof(struct sembuf)); sizeof(unlock)/sizeof(struct sembuf));
} }
static int test_fn(int argc, char **argv) int main(int argc, char **argv)
{ {
int id, key, val; int id, key, val;
int ret, fail_count = 0; int ret, fail_count = 0;
test_init(argc, argv);
key = ftok(argv[0], 89063453); key = ftok(argv[0], 89063453);
if (key == -1) { if (key == -1) {
pr_perror("Can't make key"); pr_perror("Can't make key");
...@@ -168,14 +170,3 @@ out: ...@@ -168,14 +170,3 @@ out:
pass(); pass();
return fail_count; return fail_count;
} }
int main(int argc, char **argv)
{
#ifdef NEW_IPC_NS
test_init_ns(argc, argv, CLONE_NEWIPC, test_fn);
#else
test_init(argc, argv);
test_fn(argc, argv);
#endif
return 0;
}
{'flavor': 'h'} {'flavor': 'ns uns'}
...@@ -13,11 +13,13 @@ static struct utsname after; ...@@ -13,11 +13,13 @@ static struct utsname after;
#define ZDTM_NODE "zdtm.nodename.ru" #define ZDTM_NODE "zdtm.nodename.ru"
#define ZDTM_DOMAIN "zdtm.nodename.ru" #define ZDTM_DOMAIN "zdtm.nodename.ru"
static int test_fn(int argc, char **argv) int main(int argc, char **argv)
{ {
int ret; int ret;
int fd; int fd;
test_init(argc, argv);
fd = open("/proc/sys/kernel/hostname", O_WRONLY); fd = open("/proc/sys/kernel/hostname", O_WRONLY);
if (fd < 0) { if (fd < 0) {
pr_perror("Can't open hostname"); pr_perror("Can't open hostname");
...@@ -63,9 +65,3 @@ static int test_fn(int argc, char **argv) ...@@ -63,9 +65,3 @@ static int test_fn(int argc, char **argv)
pass(); pass();
return 0; return 0;
} }
int main(int argc, char **argv)
{
test_init_ns(argc, argv, CLONE_NEWUTS, test_fn);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment