Unverified Commit 04e0ad4e by Christian Brauner Committed by Stéphane Graber

test: update terminology

parent 0332ef2c
...@@ -37,14 +37,14 @@ ...@@ -37,14 +37,14 @@
} while (0) } while (0)
static void test_console_close_all(int ttyfd[MAXCONSOLES], static void test_console_close_all(int ttyfd[MAXCONSOLES],
int masterfd[MAXCONSOLES]) int ptmxfd[MAXCONSOLES])
{ {
int i; int i;
for (i = 0; i < MAXCONSOLES; i++) { for (i = 0; i < MAXCONSOLES; i++) {
if (masterfd[i] != -1) { if (ptmxfd[i] != -1) {
close(masterfd[i]); close(ptmxfd[i]);
masterfd[i] = -1; ptmxfd[i] = -1;
} }
if (ttyfd[i] != -1) { if (ttyfd[i] != -1) {
...@@ -59,14 +59,14 @@ static int test_console_running_container(struct lxc_container *c) ...@@ -59,14 +59,14 @@ static int test_console_running_container(struct lxc_container *c)
int nrconsoles, i, ret = -1; int nrconsoles, i, ret = -1;
int ttynum [MAXCONSOLES]; int ttynum [MAXCONSOLES];
int ttyfd [MAXCONSOLES]; int ttyfd [MAXCONSOLES];
int masterfd[MAXCONSOLES]; int ptmxfd[MAXCONSOLES];
for (i = 0; i < MAXCONSOLES; i++) for (i = 0; i < MAXCONSOLES; i++)
ttynum[i] = ttyfd[i] = masterfd[i] = -1; ttynum[i] = ttyfd[i] = ptmxfd[i] = -1;
ttynum[0] = 1; ttynum[0] = 1;
ret = c->console_getfd(c, &ttynum[0], &masterfd[0]); ret = c->console_getfd(c, &ttynum[0], &ptmxfd[0]);
if (ret < 0) { if (ret < 0) {
TSTERR("console allocate failed"); TSTERR("console allocate failed");
goto err1; goto err1;
...@@ -79,12 +79,12 @@ static int test_console_running_container(struct lxc_container *c) ...@@ -79,12 +79,12 @@ static int test_console_running_container(struct lxc_container *c)
} }
/* attempt to alloc same ttynum */ /* attempt to alloc same ttynum */
ret = c->console_getfd(c, &ttynum[0], &masterfd[1]); ret = c->console_getfd(c, &ttynum[0], &ptmxfd[1]);
if (ret != -1) { if (ret != -1) {
TSTERR("console allocate should fail for allocated ttynum %d", ttynum[0]); TSTERR("console allocate should fail for allocated ttynum %d", ttynum[0]);
goto err2; goto err2;
} }
close(masterfd[0]); masterfd[0] = -1; close(ptmxfd[0]); ptmxfd[0] = -1;
close(ttyfd[0]); ttyfd[0] = -1; close(ttyfd[0]); ttyfd[0] = -1;
/* ensure we can allocate all consoles, we do this a few times to /* ensure we can allocate all consoles, we do this a few times to
...@@ -92,7 +92,7 @@ static int test_console_running_container(struct lxc_container *c) ...@@ -92,7 +92,7 @@ static int test_console_running_container(struct lxc_container *c)
*/ */
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
for (nrconsoles = 0; nrconsoles < MAXCONSOLES; nrconsoles++) { for (nrconsoles = 0; nrconsoles < MAXCONSOLES; nrconsoles++) {
ret = c->console_getfd(c, &ttynum[nrconsoles], &masterfd[nrconsoles]); ret = c->console_getfd(c, &ttynum[nrconsoles], &ptmxfd[nrconsoles]);
if (ret < 0) if (ret < 0)
break; break;
ttyfd[nrconsoles] = ret; ttyfd[nrconsoles] = ret;
...@@ -103,13 +103,13 @@ static int test_console_running_container(struct lxc_container *c) ...@@ -103,13 +103,13 @@ static int test_console_running_container(struct lxc_container *c)
goto err2; goto err2;
} }
test_console_close_all(ttyfd, masterfd); test_console_close_all(ttyfd, ptmxfd);
} }
ret = 0; ret = 0;
err2: err2:
test_console_close_all(ttyfd, masterfd); test_console_close_all(ttyfd, ptmxfd);
err1: err1:
return ret; return ret;
......
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