WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Make testing more reliable: wait for event after async s

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Make testing more reliable: wait for event after async so we know
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 26 Jul 2005 20:26:12 -0400
Delivery-date: Wed, 27 Jul 2005 00:27:03 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 6f4d500001799c44be2f0267017ee409da9ae2ec
# Parent  4e833037159dd09a62ce10011592f9f67005a7e4
Make testing more reliable: wait for event after async so we know
child has done command
Signed-off-by: Rusty Russel <rusty@xxxxxxxxxxxxxxx>
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r 4e833037159d -r 6f4d50000179 tools/xenstore/testsuite/13watch-ack.sh
--- a/tools/xenstore/testsuite/13watch-ack.sh   Tue Jul 26 15:20:09 2005
+++ b/tools/xenstore/testsuite/13watch-ack.sh   Tue Jul 26 15:21:00 2005
@@ -16,8 +16,8 @@
 1 watch /test/2 token2 0
 1 watch /test/3 token3 0
 2 async write /test/2 create contents2
-1 waitwatch
 3 async write /test/1 create contents1
 4 async write /test/3 create contents3
+1 waitwatch
 1 ackwatch token2
 1 close' | ./xs_test 2>&1`" = "1:/test/2:token2" ]
diff -r 4e833037159d -r 6f4d50000179 tools/xenstore/xs_test.c
--- a/tools/xenstore/xs_test.c  Tue Jul 26 15:20:09 2005
+++ b/tools/xenstore/xs_test.c  Tue Jul 26 15:21:00 2005
@@ -406,6 +406,35 @@
                failed(handle);
 }
 
+static bool wait_for_input(unsigned int handle)
+{
+       unsigned int i;
+       for (i = 0; i < ARRAY_SIZE(handles); i++) {
+               int fd;
+
+               if (!handles[i] || i == handle)
+                       continue;
+
+               fd = xs_fileno(handles[i]);
+               if (fd == -2) {
+                       unsigned int avail;
+                       get_input_chunk(in, in->buf, &avail);
+                       if (avail != 0)
+                               return true;
+               } else {
+                       struct timeval tv = {.tv_sec = 0, .tv_usec = 0 };
+                       fd_set set;
+
+                       FD_ZERO(&set);
+                       FD_SET(fd, &set);
+                       if (select(fd+1, &set, NULL, NULL,&tv))
+                               return true;
+               }
+       }
+       return false;
+}
+
+
 /* Async wait for watch on handle */
 static void do_command(unsigned int default_handle, char *line);
 static void do_async(unsigned int handle, char *line)
@@ -413,8 +442,14 @@
        int child;
        unsigned int i;
        children++;
-       if ((child = fork()) != 0)
+       if ((child = fork()) != 0) {
+               /* Wait until *something* happens, which indicates
+                * child has created an event.  V. sloppy, but we can't
+                * select on fake domain connections.
+                */
+               while (!wait_for_input(handle));
                return;
+       }
 
        /* Don't keep other handles open in parent. */
        for (i = 0; i < ARRAY_SIZE(handles); i++) {
@@ -632,7 +667,7 @@
        command = arg(line, 0);
 
        if (timeout)
-               alarm(5);
+               alarm(1);
 
        if (streq(command, "dir"))
                do_dir(handle, arg(line, 1));

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Make testing more reliable: wait for event after async so we know, Xen patchbot -unstable <=