[CRIU] [PATCH 0/3 v2] tty: Implemet c/r for queued data on paired PTYs
Andrey Vagin
avagin at virtuozzo.com
Thu Apr 14 16:44:15 PDT 2016
On Thu, Apr 14, 2016 at 04:22:17PM -0700, Andrey Vagin wrote:
> Hi Cyrill,
>
> Where is a test?
I played a bit with these patches and create a test which fails.
[root at fc22-vm criu]# python test/zdtm.py run --iter 0 -t zdtm/static/pty00 -k always
=== Run 1/1 ================
========================== Run zdtm/static/pty00 in h ==========================
Start test
./pty00 --pidfile=pty00.pid --outfile=pty00.out
Wait for zdtm/static/pty00 to die for 0.100000
========================= Test zdtm/static/pty00 PASS ==========================
========================= Run zdtm/static/pty00 in ns ==========================
Start test
./pty00 --pidfile=pty00.pid --outfile=pty00.out
Wait for zdtm/static/pty00 to die for 0.100000
========================= Test zdtm/static/pty00 PASS ==========================
========================= Run zdtm/static/pty00 in uns =========================
Start test
./pty00 --pidfile=pty00.pid --outfile=pty00.out
Wait for zdtm/static/pty00 to die for 0.100000
========================= Test zdtm/static/pty00 PASS ==========================
[root at fc22-vm criu]# python test/zdtm.py run --iter 1 -t zdtm/static/pty00 -k always
=== Run 1/1 ================
========================== Run zdtm/static/pty00 in h ==========================
Start test
./pty00 --pidfile=pty00.pid --outfile=pty00.out
Run criu dump
Run criu restore
Wait for zdtm/static/pty00 to die for 0.100000
Wait for zdtm/static/pty00 to die for 0.200000
Wait for zdtm/static/pty00 to die for 0.400000
Wait for zdtm/static/pty00 to die for 0.800000
Wait for zdtm/static/pty00 to die for 1.600000
Wait for zdtm/static/pty00 to die for 3.200000
>
> On Wed, Apr 13, 2016 at 10:25:41AM +0300, Cyrill Gorcunov wrote:
> > v2:
> > - fix travis complains
> > - don't fail if no queued data present on peers
> >
> > Cyrill Gorcunov (3):
> > tty: protobuf -- Add tty data image format
> > tty: Write unread pty buffers on post dump stage
> > tty: Restore unread data from the image
> >
> > criu/cr-dump.c | 2 +
> > criu/cr-restore.c | 1 +
> > criu/image-desc.c | 1 +
> > criu/include/image-desc.h | 1 +
> > criu/include/magic.h | 1 +
> > criu/include/protobuf-desc.h | 1 +
> > criu/include/tty.h | 2 +
> > criu/tty.c | 232 ++++++++++++++++++++++++++++++++++++++++++-
> > images/tty.proto | 5 +
> > 9 files changed, 244 insertions(+), 2 deletions(-)
> >
> > --
> > 2.5.5
> >
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
-------------- next part --------------
>From 60ab81b1703c1795aa152a7dbc444e0c5dd5f40a Mon Sep 17 00:00:00 2001
From: Andrew Vagin <avagin at virtuozzo.com>
Date: Fri, 15 Apr 2016 02:40:13 +0300
Subject: [PATCH] zdtm: check in-flight data in ttys
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
test/zdtm/static/pty00.c | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/test/zdtm/static/pty00.c b/test/zdtm/static/pty00.c
index 7aa9c8a..2e0109f 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,25 @@ int main(int argc, char ** argv)
close(fds);
fds = 100;
+ 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.0
More information about the CRIU
mailing list