[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Fix up testsuite from recent changes.
# HG changeset patch # User cl349@xxxxxxxxxxxxxxxxxxxx # Node ID f1bb1316b26ffc7ad01391719b72fce9d496b38e # Parent 1cb7adaa33555ac81d79c3f3cc868bc981557220 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) Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx> diff -r 1cb7adaa3355 -r f1bb1316b26f tools/xenstore/Makefile --- a/tools/xenstore/Makefile Tue Sep 13 08:35:41 2005 +++ b/tools/xenstore/Makefile Tue Sep 13 09:09:13 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 1cb7adaa3355 -r f1bb1316b26f tools/xenstore/fake_libxc.c --- a/tools/xenstore/fake_libxc.c Tue Sep 13 08:35:41 2005 +++ b/tools/xenstore/fake_libxc.c Tue Sep 13 09:09:13 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 1cb7adaa3355 -r f1bb1316b26f tools/xenstore/testsuite/07watch.test --- a/tools/xenstore/testsuite/07watch.test Tue Sep 13 08:35:41 2005 +++ b/tools/xenstore/testsuite/07watch.test Tue Sep 13 09:09:13 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 1cb7adaa3355 -r f1bb1316b26f tools/xenstore/testsuite/14complexperms.test --- a/tools/xenstore/testsuite/14complexperms.test Tue Sep 13 08:35:41 2005 +++ b/tools/xenstore/testsuite/14complexperms.test Tue Sep 13 09:09:13 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 1cb7adaa3355 -r f1bb1316b26f tools/xenstore/xenstored_core.c --- a/tools/xenstore/xenstored_core.c Tue Sep 13 08:35:41 2005 +++ b/tools/xenstore/xenstored_core.c Tue Sep 13 09:09:13 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 1cb7adaa3355 -r f1bb1316b26f tools/xenstore/xenstored_domain.c --- a/tools/xenstore/xenstored_domain.c Tue Sep 13 08:35:41 2005 +++ b/tools/xenstore/xenstored_domain.c Tue Sep 13 09:09:13 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 1cb7adaa3355 -r f1bb1316b26f tools/xenstore/xenstored_domain.h --- a/tools/xenstore/xenstored_domain.h Tue Sep 13 08:35:41 2005 +++ b/tools/xenstore/xenstored_domain.h Tue Sep 13 09:09:13 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 1cb7adaa3355 -r f1bb1316b26f tools/xenstore/xenstored_watch.c --- a/tools/xenstore/xenstored_watch.c Tue Sep 13 08:35:41 2005 +++ b/tools/xenstore/xenstored_watch.c Tue Sep 13 09:09:13 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 1cb7adaa3355 -r f1bb1316b26f tools/xenstore/xs_test.c --- a/tools/xenstore/xs_test.c Tue Sep 13 08:35:41 2005 +++ b/tools/xenstore/xs_test.c Tue Sep 13 09:09:13 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; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |