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-tools

[Xen-tools] Re: [PATCH] Fix up xenstored testsuite

To: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Subject: [Xen-tools] Re: [PATCH] Fix up xenstored testsuite
From: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>
Date: Tue, 13 Sep 2005 10:11:02 +0100
Cc: Xen Tools <xen-tools@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 13 Sep 2005 09:08:43 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1126601662.1287.1.camel@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-tools-request@lists.xensource.com?subject=help>
List-id: Xen control tools developers <xen-tools.lists.xensource.com>
List-post: <mailto:xen-tools@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-tools>, <mailto:xen-tools-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-tools>, <mailto:xen-tools-request@lists.xensource.com?subject=unsubscribe>
References: <1126601662.1287.1.camel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-tools-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.1i
On Tue, Sep 13, 2005 at 06:54:21PM +1000, Rusty Russell wrote:
> I don't particularly enjoy pooper-scooping, but I'm happy to do it if it
> frees up other people to do more important things.

Appreciated!  Thanks!

    christian

> 
> # HG changeset patch
> # User Rusty Russell <rusty@xxxxxxxxxxxxxxx>
> # Node ID 8ab5cf8f3051576e9b41dbc558ad2cf22c8b2d4a
> # Parent  d8637529dafff3c610e4bb31349d4ae00a23a18e
> Fix up testsuite from recent changes.
> 
> (1) Make TESTDIR relative (my directory exceeded 108 chars, breaking sockets)
> (2) Make TESTDIR if it doesn't exist
> (3) Add dummy xc_domain_getinfo and xc_evtchn_bind_virq for fake libxc
> (4) Fix tests broken by b594bb976a743d509f1ffabb5bc698874ab90d8f
> (5) domain_cleanup() can be static, as it's not used elsewhere.
> (6) With -Werror, "use" unused variable in domain_init() if TESTING
> (7) Remove debugging printf on watch without perms.
> (8) Loosen timeout in xs_test (valgrind + slow machine == bogus timeouts)
> 
> Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx> (authored)
> 
> diff -r d8637529daff -r 8ab5cf8f3051 tools/xenstore/Makefile
> --- a/tools/xenstore/Makefile Mon Sep 12 21:42:26 2005
> +++ b/tools/xenstore/Makefile Tue Sep 13 08:51:45 2005
> @@ -20,7 +20,7 @@
>  
>  CFLAGS  += $(BASECFLAGS)
>  LDFLAGS += $(PROFILE) -L$(XEN_LIBXC)
> -TESTDIR  = `pwd`/testsuite/tmp
> +TESTDIR  = testsuite/tmp
>  TESTFLAGS= -DTESTING
>  TESTENV  = XENSTORED_ROOTDIR=$(TESTDIR) XENSTORED_RUNDIR=$(TESTDIR)
>  
> @@ -80,10 +80,13 @@
>  
>  fullcheck: testsuite-run randomcheck stresstest
>  
> -testsuite-run: xenstored_test xs_test
> +$(TESTDIR):
> +     mkdir $@
> +
> +testsuite-run: xenstored_test xs_test $(TESTDIR)
>       $(TESTENV) testsuite/test.sh && echo
>  
> -testsuite-fast: xenstored_test xs_test
> +testsuite-fast: xenstored_test xs_test $(TESTDIR)
>       @$(TESTENV) testsuite/test.sh --fast
>  
>  testsuite-clean:
> @@ -92,21 +95,21 @@
>  # Make this visible so they can see repeat tests without --fast if they
>  # fail.
>  RANDSEED=$(shell date +%s)
> -randomcheck: xs_random xenstored_test
> +randomcheck: xs_random xenstored_test $(TESTDIR)
>       $(TESTENV) ./xs_random --simple --fast /tmp/xs_random 200000 
> $(RANDSEED) && echo
>       $(TESTENV) ./xs_random --fast /tmp/xs_random 100000 $(RANDSEED) && echo
>       $(TESTENV) ./xs_random --fail /tmp/xs_random 10000 $(RANDSEED)
>  
> -crashme:  xs_crashme xenstored_test
> +crashme:  xs_crashme xenstored_test $(TESTDIR)
>       rm -rf $(TESTDIR)/store $(TESTDIR)/transactions /tmp/xs_crashme.vglog* 
> /tmp/trace
>       export $(TESTENV); ./xs_crashme 5000 $(RANDSEED) 2>/dev/null
>       if [ -n "`cat /tmp/xs_crashme.vglog*`" ]; then echo Valgrind 
> complained; cat /tmp/xs_crashme.vglog*; exit 1; fi
>       rm -rf $(TESTDIR)/store $(TESTDIR)/transactions /tmp/xs_crashme.vglog* 
> /tmp/trace
>  
> -randomcheck-fast: xs_random xenstored_test
> +randomcheck-fast: xs_random xenstored_test $(TESTDIR)
>       @$(TESTENV) ./xs_random --fast /tmp/xs_random 2000 $(RANDSEED)
>  
> -stresstest: xs_stress xenstored_test
> +stresstest: xs_stress xenstored_test $(TESTDIR)
>       rm -rf $(TESTDIR)/store $(TESTDIR)/transactions
>       export $(TESTENV); PID=`./xenstored_test --output-pid 
> --trace-file=/tmp/trace`; ./xs_stress 5000; ret=$$?; kill $$PID; exit $$ret
>  
> diff -r d8637529daff -r 8ab5cf8f3051 tools/xenstore/fake_libxc.c
> --- a/tools/xenstore/fake_libxc.c     Mon Sep 12 21:42:26 2005
> +++ b/tools/xenstore/fake_libxc.c     Tue Sep 13 08:51:45 2005
> @@ -83,6 +83,39 @@
>       return 0;
>  }
>  
> +int xc_domain_getinfo(int xc_handle __attribute__((unused)),
> +                   u32 first_domid, unsigned int max_doms,
> +                      xc_dominfo_t *info)
> +{
> +     assert(max_doms == 1);
> +        info->domid = first_domid;
> +
> +        info->dying    = 0;
> +        info->shutdown = 0;
> +        info->paused   = 0;
> +        info->blocked  = 0;
> +        info->running  = 1;
> +
> +        info->shutdown_reason = 0;
> +
> +        if ( info->shutdown && (info->shutdown_reason == SHUTDOWN_crash) )
> +        {
> +            info->shutdown = 0;
> +            info->crashed  = 1;
> +        }
> +
> +     return 1;
> +}
> +
> +int xc_evtchn_bind_virq(int xc_handle __attribute__((unused)),
> +                     int virq __attribute__((unused)),
> +                     int *port)
> +{
> +     if (port)
> +             *port = 0;
> +     return 0;
> +}
> +
>  static void send_to_fd(int signo __attribute__((unused)))
>  {
>       int saved_errno = errno;
> diff -r d8637529daff -r 8ab5cf8f3051 tools/xenstore/testsuite/07watch.test
> --- a/tools/xenstore/testsuite/07watch.test   Mon Sep 12 21:42:26 2005
> +++ b/tools/xenstore/testsuite/07watch.test   Tue Sep 13 08:51:45 2005
> @@ -34,12 +34,13 @@
>  1 close
>  2 close
>  
> -# We don't get a watch from our own commands.
> -watch /dir token
> -mkdir /dir/newdir
> -expect waitwatch failed: Connection timed out
> -waitwatch
> -close
> +# Changed in b594bb976a743d509f1ffabb5bc698874ab90d8f
> +## We don't get a watch from our own commands.
> +#watch /dir token
> +#mkdir /dir/newdir
> +#expect waitwatch failed: Connection timed out
> +#waitwatch
> +#close
>  
>  # ignore watches while doing commands, should work.
>  watch /dir token
> diff -r d8637529daff -r 8ab5cf8f3051 
> tools/xenstore/testsuite/14complexperms.test
> --- a/tools/xenstore/testsuite/14complexperms.test    Mon Sep 12 21:42:26 2005
> +++ b/tools/xenstore/testsuite/14complexperms.test    Tue Sep 13 08:51:45 2005
> @@ -30,10 +30,8 @@
>  expect *Permission denied
>  setperm /dir/file 0 NONE 
>  watch /dir/file token 
> -setid 0
> -write /dir/file create contents
> -rm /dir/file
> -setid 1
> +1 write /dir/file create contents
> +1 rm /dir/file
>  expect waitwatch failed: Connection timed out
>  waitwatch
>  unwatch /dir/file token 
> @@ -78,10 +76,8 @@
>  expect *Permission denied
>  setperm /dir/file 0 NONE 
>  watch /dir/file token 
> -setid 0
> -write /dir/file create contents
> -rm /dir/file
> -setid 1
> +1 write /dir/file create contents
> +1 rm /dir/file
>  expect waitwatch failed: Connection timed out
>  waitwatch
>  unwatch /dir/file token 
> diff -r d8637529daff -r 8ab5cf8f3051 tools/xenstore/xenstored_core.c
> --- a/tools/xenstore/xenstored_core.c Mon Sep 12 21:42:26 2005
> +++ b/tools/xenstore/xenstored_core.c Tue Sep 13 08:51:45 2005
> @@ -1640,8 +1640,10 @@
>  
>       /* Session leader so ^C doesn't whack us. */
>       setsid();
> +#ifndef TESTING      /* Relative paths for socket names */
>       /* Move off any mount points we might be in. */
>       chdir("/");
> +#endif
>       /* Discard our parent's old-fashioned umask prejudices. */
>       umask(0);
>  }
> diff -r d8637529daff -r 8ab5cf8f3051 tools/xenstore/xenstored_domain.c
> --- a/tools/xenstore/xenstored_domain.c       Mon Sep 12 21:42:26 2005
> +++ b/tools/xenstore/xenstored_domain.c       Tue Sep 13 08:51:45 2005
> @@ -216,6 +216,26 @@
>               munmap(domain->page, getpagesize());
>  
>       return 0;
> +}
> +
> +static void domain_cleanup(void)
> +{
> +     xc_dominfo_t dominfo;
> +     struct domain *domain, *tmp;
> +     int released = 0;
> +
> +     list_for_each_entry_safe(domain, tmp, &domains, list) {
> +             if (xc_domain_getinfo(*xc_handle, domain->domid, 1,
> +                                   &dominfo) == 1 &&
> +                 dominfo.domid == domain->domid &&
> +                 !dominfo.dying && !dominfo.crashed && !dominfo.shutdown)
> +                     continue;
> +             talloc_free(domain->conn);
> +             released++;
> +     }
> +
> +     if (released)
> +             fire_watches(NULL, "@releaseDomain", false);
>  }
>  
>  /* We scan all domains rather than use the information given here. */
> @@ -371,26 +391,6 @@
>       send_ack(conn, XS_RELEASE);
>  }
>  
> -void domain_cleanup(void)
> -{
> -     xc_dominfo_t dominfo;
> -     struct domain *domain, *tmp;
> -     int released = 0;
> -
> -     list_for_each_entry_safe(domain, tmp, &domains, list) {
> -             if (xc_domain_getinfo(*xc_handle, domain->domid, 1,
> -                                   &dominfo) == 1 &&
> -                 dominfo.domid == domain->domid &&
> -                 !dominfo.dying && !dominfo.crashed && !dominfo.shutdown)
> -                     continue;
> -             talloc_free(domain->conn);
> -             released++;
> -     }
> -
> -     if (released)
> -             fire_watches(NULL, "@releaseDomain", false);
> -}
> -
>  void do_get_domain_path(struct connection *conn, const char *domid_str)
>  {
>       struct domain *domain;
> @@ -457,6 +457,7 @@
>  
>  #ifdef TESTING
>       eventchn_fd = fake_open_eventchn();
> +     (void)&st;
>  #else
>       /* Make sure any existing device file links to correct device. */
>       if ((lstat(EVTCHN_DEV_NAME, &st) != 0) || !S_ISCHR(st.st_mode) ||
> diff -r d8637529daff -r 8ab5cf8f3051 tools/xenstore/xenstored_domain.h
> --- a/tools/xenstore/xenstored_domain.h       Mon Sep 12 21:42:26 2005
> +++ b/tools/xenstore/xenstored_domain.h       Tue Sep 13 08:51:45 2005
> @@ -28,10 +28,6 @@
>  /* domid */
>  void do_release(struct connection *conn, const char *domid_str);
>  
> -/* Enumerate domains and release connections for non-existant or dying
> - * domains. */
> -void domain_cleanup(void);
> -
>  /* domid */
>  void do_get_domain_path(struct connection *conn, const char *domid_str);
>  
> diff -r d8637529daff -r 8ab5cf8f3051 tools/xenstore/xenstored_watch.c
> --- a/tools/xenstore/xenstored_watch.c        Mon Sep 12 21:42:26 2005
> +++ b/tools/xenstore/xenstored_watch.c        Tue Sep 13 08:51:45 2005
> @@ -105,7 +105,6 @@
>        */
>       if (!check_node_perms(conn, node, XS_PERM_READ|XS_PERM_ENOENT_OK) &&
>           !check_event_node(node)) {
> -             fprintf(stderr, "No permission for %s\n", node);
>               return;
>       }
>  
> diff -r d8637529daff -r 8ab5cf8f3051 tools/xenstore/xs_test.c
> --- a/tools/xenstore/xs_test.c        Mon Sep 12 21:42:26 2005
> +++ b/tools/xenstore/xs_test.c        Tue Sep 13 08:51:45 2005
> @@ -43,7 +43,7 @@
>  
>  static struct xs_handle *handles[10] = { NULL };
>  
> -static unsigned int timeout_ms = 200;
> +static unsigned int timeout_ms = 500;
>  static bool timeout_suppressed = true;
>  static bool readonly = false;
>  static bool print_input = false;
> 
> -- 
> A bad analogy is like a leaky screwdriver -- Richard Braakman
> 
> 

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

<Prev in Thread] Current Thread [Next in Thread>