[CRIU] [PATCH 2/7] zdtm: enhance namespaces isolation environment
Kinsbursky Stanislav
skinsbursky at openvz.org
Fri Feb 10 03:19:21 EST 2012
1) pass cmd line args to function to clone to - required for parametrized
tests.
2) handle function result - required for multi-process tests.
Signed-off-by: Stanislav Kinsbursky <skinsbursky at parallels.com>
---
test/zdtm/lib/test.c | 11 ++++++++---
test/zdtm/lib/zdtmtst.h | 2 +-
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/test/zdtm/lib/test.c b/test/zdtm/lib/test.c
index 2e39994..ea03e40 100644
--- a/test/zdtm/lib/test.c
+++ b/test/zdtm/lib/test.c
@@ -161,7 +161,9 @@ void test_init(int argc, char **argv)
struct zdtm_clone_arg {
FILE *pidf;
- void (*fn)(void);
+ int argc;
+ char **argv;
+ int (*fn)(int argc, char **argv);
};
static int do_test_fn(void *_arg)
@@ -190,12 +192,13 @@ static int do_test_fn(void *_arg)
srand48(time(NULL)); /* just in case we need it */
- if (ca->fn())
+ if (ca->fn(ca->argc, ca->argv))
exit(1);
exit(0);
}
-void test_init_ns(int argc, char **argv, unsigned long clone_flags, void (*fn)(void))
+void test_init_ns(int argc, char **argv, unsigned long clone_flags,
+ int (*fn)(int , char **))
{
extern void parseargs(int, char **);
@@ -240,6 +243,8 @@ void test_init_ns(int argc, char **argv, unsigned long clone_flags, void (*fn)(v
ca.pidf = pidf;
ca.fn = fn;
+ ca.argc = argc;
+ ca.argv = argv;
pid = clone(do_test_fn, stack + STACK_SIZE, clone_flags | SIGCHLD, &ca);
if (pid < 0) {
err("Daemonizing failed: %m\n");
diff --git a/test/zdtm/lib/zdtmtst.h b/test/zdtm/lib/zdtmtst.h
index fe329b0..6ef7804 100644
--- a/test/zdtm/lib/zdtmtst.h
+++ b/test/zdtm/lib/zdtmtst.h
@@ -5,7 +5,7 @@
/* set up test */
extern void test_init(int argc, char **argv);
-extern void test_init_ns(int argc, char **argv, unsigned long clone_flags, void (*fn)(void));
+extern void test_init_ns(int argc, char **argv, unsigned long clone_flags, int (*fn)(int , char **));
#ifndef CLONE_NEWUTS
#define CLONE_NEWUTS 0x04000000
More information about the CRIU
mailing list