[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 05/33] mg-schema-test-database: Make `daemons' be cleverer



Now you can tell it which daemons to run.  This is helpful if you want
to run them separately.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 mg-schema-test-database | 35 +++++++++++++++++++++++++----------
 1 file changed, 25 insertions(+), 10 deletions(-)

diff --git a/mg-schema-test-database b/mg-schema-test-database
index 85cc050..e95b6c5 100755
--- a/mg-schema-test-database
+++ b/mg-schema-test-database
@@ -27,9 +27,14 @@
 # deletes your test database and removes the local-config file
 #
 #
-#  ./mg-schema-test-database daemons [_SUFFIX]
+#  ./mg-schema-test-database daemons [_SUFFIX] [DAEMON...]
 #
-# synchronously runs owner and queue daemons for your test database
+# Synchronously runs owner and queue daemons for your test database.
+# If any DAEMON is specified, runs only those daemons.  DAEMON
+# may be `queue' or `owner'; otherwise it is a command which will
+# be broken at spaces, and have `./' prepended if it contains no `/'.
+# If any DAEMON contains the string `queue', it causes the data-plan.pl
+# to be cleared.
 #
 # NB that you can't drop a test database with these daemons running,
 # because Postgres will refuse to drop a database that anyone is
@@ -557,26 +562,36 @@ END
 #========== DAEMONS ==========
 
 daemons)
+       wantdaemons=()
+
        for arg in "$@"; do
                case "$arg" in
                _*)     suffix="$arg" ;;
-               *)      fail 'bad usage' ;;
+               owner|queue)    wantdaemons+=("./ms-${arg}daemon") ;;
+               */*)            wantdaemons+=("$arg") ;;
+               *)              wantdaemons+=("./$arg") ;;
                esac
        done
 
+       if [ "${#wantdaemons[*]}" = 0 ]; then
+               wantdaemons=(./ms-ownerdaemon ./ms-queuedaemon)
+       fi
+
        dbname
 
-       printf "Running daemons for %s....\n" "$dbname"
+       printf "Running daemons (${wantdaemons[*]}) for %s....\n" "$dbname"
 
-       withtest \
-       exec_resetting_sigint ./ms-ownerdaemon &
+       for d in "${wantdaemons[@]}"; do
 
-       sleep 1
+               case "$d" in
+               *queuedaemon*)  rm -f data-plan.pl      ;;
+               esac
 
-       withtest \
-       exec_resetting_sigint ./ms-queuedaemon &
+               withtest \
+               exec_resetting_sigint $d &
 
-       rm -f data-plan.pl
+               sleep 1
+       done
 
        wait
 
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.