diff options
author | Martin Schwenke <martin@meltin.net> | 2013-08-02 16:03:42 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@gmail.com> | 2013-08-14 15:57:03 +1000 |
commit | 2afb5632c719bc8bd8569b6af309227401f4d9b4 (patch) | |
tree | 05bdab008d26ff23f2e53584d3fa764e588ce245 /ctdb/tests | |
parent | df539a66cb92bdfa29bafbe3b33cca36375e8e0e (diff) | |
download | samba-2afb5632c719bc8bd8569b6af309227401f4d9b4.tar.gz samba-2afb5632c719bc8bd8569b6af309227401f4d9b4.tar.xz samba-2afb5632c719bc8bd8569b6af309227401f4d9b4.zip |
tests/eventscripts: Override background_with_logging(), just prepend "&"
That is, output that goes through background_with_logging() just gets
"&" prepended to each line. This is cleaner than having the tests
grovel through logs.
Update some 49.winbind/50.samba tests to deal with this.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 3ba933d806106d12bc48b83b22d0f314d9d1e5e5)
Diffstat (limited to 'ctdb/tests')
-rwxr-xr-x | ctdb/tests/eventscripts/49.winbind.monitor.050.sh | 9 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/49.winbind.monitor.051.sh | 9 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/50.samba.monitor.050.sh | 9 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/50.samba.monitor.051.sh | 9 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/etc-ctdb/rc.local | 6 | ||||
-rw-r--r-- | ctdb/tests/eventscripts/scripts/local.sh | 23 |
6 files changed, 34 insertions, 31 deletions
diff --git a/ctdb/tests/eventscripts/49.winbind.monitor.050.sh b/ctdb/tests/eventscripts/49.winbind.monitor.050.sh index d0d55f079c7..02589b33e89 100755 --- a/ctdb/tests/eventscripts/49.winbind.monitor.050.sh +++ b/ctdb/tests/eventscripts/49.winbind.monitor.050.sh @@ -9,9 +9,8 @@ setup_winbind "down" export CTDB_SERVICE_AUTOSTARTSTOP="yes" export CTDB_MANAGED_SERVICES="foo winbind bar" -ok 'Starting service "winbind" - now managed' +ok <<EOF +Starting service "winbind" - now managed +&Starting winbind: OK +EOF simple_test - -# This depends on output in the log file from the above test -ok 'Starting winbind: OK' -check_ctdb_logfile diff --git a/ctdb/tests/eventscripts/49.winbind.monitor.051.sh b/ctdb/tests/eventscripts/49.winbind.monitor.051.sh index 1d68068e304..fbad928acad 100755 --- a/ctdb/tests/eventscripts/49.winbind.monitor.051.sh +++ b/ctdb/tests/eventscripts/49.winbind.monitor.051.sh @@ -10,9 +10,8 @@ export CTDB_SERVICE_AUTOSTARTSTOP="yes" export CTDB_MANAGED_SERVICES="foo" unset CTDB_MANAGES_WINBIND -ok 'Stopping service "winbind" - no longer managed' +ok <<EOF +Stopping service "winbind" - no longer managed +&Stopping winbind: OK +EOF simple_test - -# This depends on output in the log file from the above test -ok 'Stopping winbind: OK' -check_ctdb_logfile diff --git a/ctdb/tests/eventscripts/50.samba.monitor.050.sh b/ctdb/tests/eventscripts/50.samba.monitor.050.sh index db66f66e3a8..69530f3dac4 100755 --- a/ctdb/tests/eventscripts/50.samba.monitor.050.sh +++ b/ctdb/tests/eventscripts/50.samba.monitor.050.sh @@ -9,9 +9,8 @@ setup_samba "down" export CTDB_SERVICE_AUTOSTARTSTOP="yes" export CTDB_MANAGED_SERVICES="foo samba winbind bar" -ok 'Starting service "samba" - now managed' +ok <<EOF +Starting service "samba" - now managed +&Starting smb: OK +EOF simple_test - -# This depends on output in the log file from the above test -ok 'Starting smb: OK' -check_ctdb_logfile diff --git a/ctdb/tests/eventscripts/50.samba.monitor.051.sh b/ctdb/tests/eventscripts/50.samba.monitor.051.sh index 1a9ab22a10c..04c1fce1141 100755 --- a/ctdb/tests/eventscripts/50.samba.monitor.051.sh +++ b/ctdb/tests/eventscripts/50.samba.monitor.051.sh @@ -10,9 +10,8 @@ export CTDB_SERVICE_AUTOSTARTSTOP="yes" export CTDB_MANAGED_SERVICES="foo" unset CTDB_MANAGES_SAMBA -ok 'Stopping service "samba" - no longer managed' +ok <<EOF +Stopping service "samba" - no longer managed +&Stopping smb: OK +EOF simple_test - -# This depends on output in the log file from the above test -ok 'Stopping smb: OK' -check_ctdb_logfile diff --git a/ctdb/tests/eventscripts/etc-ctdb/rc.local b/ctdb/tests/eventscripts/etc-ctdb/rc.local index 9cd4d551361..b11c7ecbf7e 100755 --- a/ctdb/tests/eventscripts/etc-ctdb/rc.local +++ b/ctdb/tests/eventscripts/etc-ctdb/rc.local @@ -48,5 +48,11 @@ get_proc () # Always succeeds iptables () { : ; } +# Do not actually background - we want to see the output +background_with_logging () +{ + "$@" 2>&1 </dev/null | sed -e 's@^@\&@' +} + CTDB_INIT_STYLE="redhat" PATH="${EVENTSCRIPTS_PATH}:$PATH" diff --git a/ctdb/tests/eventscripts/scripts/local.sh b/ctdb/tests/eventscripts/scripts/local.sh index 509e14e51d0..594656c4134 100644 --- a/ctdb/tests/eventscripts/scripts/local.sh +++ b/ctdb/tests/eventscripts/scripts/local.sh @@ -701,8 +701,12 @@ program $_pn version $_ver is not available" _opts="${STATD_HOSTNAME:+ -n }${STATD_HOSTNAME}" ;; esac - case "${_progname}${_action#restart}" in - nfsd*) + case "$_action" in + *:b) _bg="&" ;; + *) _bg="" ;; + esac + case "$_progname" in + nfsd) _t="\ Trying to restart NFS service" @@ -710,23 +714,20 @@ Trying to restart NFS service" for _pid in $FAKE_NFSD_THREAD_PIDS ; do _t="\ $_t -Stack trace for stuck nfsd thread [${_pid}]: -[<ffffffff87654321>] fake_stack_trace_for_pid_${_pid}/stack+0x0/0xff" +${_bg}Stack trace for stuck nfsd thread [${_pid}]: +${_bg}[<ffffffff87654321>] fake_stack_trace_for_pid_${_pid}/stack+0x0/0xff" done fi _t="\ ${_t} -Starting nfslock: OK -Starting nfs: OK" - ;; - nfsd:b) - _t="Trying to restart NFS service" +${_bg}Starting nfslock: OK +${_bg}Starting nfs: OK" ;; - lockd|lockd:b) + lockd) _t="\ Trying to restart lock manager service -Starting nfslock: OK" +${_bg}Starting nfslock: OK" ;; *) _t="Trying to restart $_progname [${_p}${_opts}]" |