tests: Fix startone

- Fix cgroup test to work on multi-core systems
 - Drop user interaction

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
Stéphane Graber 2014-01-24 15:51:27 -05:00
parent 52d21d4051
commit a38c2e6f8d

View File

@ -158,12 +158,6 @@ int main(int argc, char *argv[])
goto out; goto out;
} }
printf("hit return to start container");
char mychar;
ret = scanf("%c", &mychar);
if (ret < 0)
goto out;
if (!lxc_container_get(c)) { if (!lxc_container_get(c)) {
fprintf(stderr, "%d: failed to get extra ref to container\n", __LINE__); fprintf(stderr, "%d: failed to get extra ref to container\n", __LINE__);
exit(1); exit(1);
@ -196,7 +190,7 @@ int main(int argc, char *argv[])
} }
len = c->get_cgroup_item(c, "cpuset.cpus", buf, 200); len = c->get_cgroup_item(c, "cpuset.cpus", buf, 200);
if (len <= 0 || strcmp(buf, "0\n")) { if (len <= 0 || strncmp(buf, "0", 1)) {
fprintf(stderr, "%d: not able to get cpuset.cpus (len %d buf %s)\n", __LINE__, len, buf); fprintf(stderr, "%d: not able to get cpuset.cpus (len %d buf %s)\n", __LINE__, len, buf);
goto out; goto out;
} }
@ -217,10 +211,6 @@ int main(int argc, char *argv[])
c->set_cgroup_item(c, "freezer.state", "THAWED"); c->set_cgroup_item(c, "freezer.state", "THAWED");
printf("hit return to finish");
ret = scanf("%c", &mychar);
if (ret < 0)
goto out;
c->stop(c); c->stop(c);
/* feh - multilib has moved the lxc-init crap */ /* feh - multilib has moved the lxc-init crap */