[CRIU] [PATCH 2/2] zdtm: check in-flight data in ttys
Cyrill Gorcunov
gorcunov at openvz.org
Thu May 12 11:21:46 PDT 2016
From: Andrew Vagin <avagin at virtuozzo.com>
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
test/zdtm/static/pty00.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/test/zdtm/static/pty00.c b/test/zdtm/static/pty00.c
index 7aa9c8a0797d..8d4a0f9976c7 100644
--- a/test/zdtm/static/pty00.c
+++ b/test/zdtm/static/pty00.c
@@ -21,9 +21,9 @@ static void signal_handler_sighup(int signum)
int main(int argc, char ** argv)
{
- int fdm, fds, ret, tty;
+ int fdm, fds, ret, tty, i;
char *slavename;
- char buf[10];
+ char buf[4096];
const char teststr[] = "hello\n";
struct sigaction sa = {
@@ -77,21 +77,24 @@ int main(int argc, char ** argv)
close(fds);
fds = 100;
- test_daemon();
+ for (i = 0; i < 10; i++) {
+ /* Check connectivity */
+ ret = write(fdm, teststr, sizeof(teststr) - 1);
+ if (ret != sizeof(teststr) - 1) {
+ pr_perror("write(fdm) failed");
+ return 1;
+ }
+ }
+ test_daemon();
test_waitsig();
- /* Check connectivity */
- ret = write(fdm, teststr, sizeof(teststr) - 1);
- if (ret != sizeof(teststr) - 1) {
- pr_perror("write(fdm) failed");
- return 1;
- }
-
- ret = read(fds, buf, sizeof(teststr) - 1);
- if (ret != sizeof(teststr) - 1) {
- pr_perror("read(fds) failed");
- return 1;
+ for (i = 0; i < 10; i++) {
+ ret = read(fds, buf, sizeof(teststr) - 1);
+ if (ret != sizeof(teststr) - 1) {
+ pr_perror("read(fds) failed");
+ return 1;
+ }
}
if (strncmp(teststr, buf, sizeof(teststr) - 1)) {
--
2.5.5
More information about the CRIU
mailing list