criu/test/zdtm/lib/groups.c
Pavel Emelyanov 0b0f40ecf8 zdtm.py: The groups_test class for running groups
So here's the new test class that handles the test from
groups set. The class is inherited from zdtm_test one as
what it does is -- starts the pseudo-init in ns/uns flavors
and asks one to spawn() the sub-tests from the list.

All groups tests can only be run inside ns flavor, so if
the host flavor is asked, just the pseudo-init is spawned.
This is because using ns flavor is the easiest way to spawn
all the sub tests under this init (however, h flavor can be
supported by marking the pseudo-init as sub-reaper).

On stop this pseudo-init is signalled to stop, it in turn
stops all the sub-tests and then exits. When the pid
namespace destruction is complete, the sub-tests .out-s are
checked.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-12-08 14:54:52 +03:00

46 lines
778 B
C

#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "zdtmtst.h"
const char *test_doc = "Group starter";
const char *test_author = "Pavel Emelianov <xemul@parallels.com>";
int main(int argc, char **argv)
{
int sret = 0;
char *env;
char sh[1024];
test_init(argc, argv);
env = getenv("ZDTM_TESTS");
if (env[0] != '\0') {
unsetenv("ZDTM_NEWNS");
unsetenv("ZDTM_GROUPS");
unsetenv("ZDTM_UID");
unsetenv("ZDTM_GID");
unsetenv("ZDTM_ROOT");
unsetenv("ZDTM_PIDFILE");
test_msg("List: [%s]\n", env);
sprintf(sh, "sh /%s.start", env);
system(sh);
}
test_daemon();
test_waitsig();
if (env[0] != '\0') {
sprintf(sh, "sh /%s.stop", env);
sret = system(sh);
}
if (sret == 0)
pass();
else
fail("Some subs failed");
return 0;
}