criu/test/zdtm/static/env00.c
Pavel Emelyanov 2e13f1f029 test: Get rid of live directory
Move static and transition into zdtm top. We can't move all the micro
tests themselves, as we need to distinguish static from non static (zdtm.py
makes additional checks on static ones).

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-20 13:40:52 +03:00

39 lines
734 B
C

#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "zdtmtst.h"
const char *test_doc = "Check that environment didn't change";
const char *test_author = "Pavel Emelianov <xemul@parallels.com>";
char *envname;
TEST_OPTION(envname, string, "environment variable name", 1);
int main(int argc, char **argv)
{
char *env;
test_init(argc, argv);
if (setenv(envname, test_author, 1)) {
pr_perror("Can't set env var \"%s\" to \"%s\"", envname, test_author);
exit(1);
}
test_daemon();
test_waitsig();
env = getenv(envname);
if (!env) {
fail("can't get env var \"%s\": %m\n", envname);
goto out;
}
if (strcmp(env, test_author))
fail("%s != %s\n", env, test_author);
else
pass();
out:
return 0;
}