Commit a83b53d2 authored by Kinsbursky Stanislav's avatar Kinsbursky Stanislav Committed by Andrey Vagin

zdtm: transition/ipc test update

Added cloning to new IPC ns depends on built option.
Signed-off-by: 's avatarStanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: 's avatarAndrey Vagin <avagin@gmail.com>
parent 53ababc6
...@@ -56,6 +56,7 @@ $(TST): $(LIB) ...@@ -56,6 +56,7 @@ $(TST): $(LIB)
ptrace.o: override CFLAGS += -pthread ptrace.o: override CFLAGS += -pthread
ptrace: override LDFLAGS += -pthread ptrace: override LDFLAGS += -pthread
ipc: override CFLAGS += -DNEW_IPC_NS
%: %.sh %: %.sh
cp $< $@ cp $< $@
......
#define _GNU_SOURCE
#include <sched.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -77,7 +80,7 @@ static int child(key_t key) ...@@ -77,7 +80,7 @@ static int child(key_t key)
return res; return res;
} }
int main(int argc, char **argv) static int test_fn(int argc, char **argv)
{ {
key_t key; key_t key;
int sem, shm, pid1, pid2; int sem, shm, pid1, pid2;
...@@ -86,8 +89,6 @@ int main(int argc, char **argv) ...@@ -86,8 +89,6 @@ int main(int argc, char **argv)
uint32_t crc; uint32_t crc;
int ret; int ret;
test_init(argc, argv);
key = ftok(argv[0], 822155650); key = ftok(argv[0], 822155650);
if (key == -1) { if (key == -1) {
err("Can't make key"); err("Can't make key");
...@@ -197,3 +198,14 @@ out_sem: ...@@ -197,3 +198,14 @@ out_sem:
out: out:
return 0; return 0;
} }
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;
}
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