1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

ctdb-tests: Simplify pstree output in eventd unit tests

pstree truncates output when it exceeds a maximum width - the default
is 132 columns.  A couple of recent
commits (12fd8d7a5c,
b23f3f9960) lengthened the command
string in the output so that it is more likely to exceed this limit
and be truncated, as below:

==================================================
Running "cat /memdisk/autobuild/fl/b1851760/ctdb/ctdb/tests/var/eventd/debug_script.log"
--------------------------------------------------
Output (Exit status: 0):
--------------------------------------------------
02.enabled.scri,PID /memdisk/autobuild/fl/b1851760/ctdb/ctdb/tests/var/eventd/events/random/02.enabled.script ...
  `-sleep,PID 99
01.disabled          DISABLED
02.enabled           TIMEDOUT   DATETIME
  OUTPUT: Sleeping for 99 seconds
--------------------------------------------------
Required output (Exit status: 0):
--------------------------------------------------
02.enabled.scri,PID /memdisk/autobuild/fl/b1851760/ctdb/ctdb/tests/var/eventd/events/random/02.enabled.script verbosetimeout
  `-sleep,PID 99
01.disabled          DISABLED
02.enabled           TIMEDOUT   DATETIME
  OUTPUT: Sleeping for 99 seconds

FAILED

It isn't clear that the above example exceeds 132 characters, given
that the PID has been filtered into a fixed string, but it certainly
goes close.  Whether or not it is truncated probably depends on the
width of the PID in the unfiltered output.  This would explain why the
test flaps.

Avoid the output truncation by dropping the -a and -p options to
simplify the pstree output.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13531

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2018-07-18 12:01:27 +10:00 committed by Amitay Isaacs
parent 7b0c1f8f19
commit da115efd2b
3 changed files with 3 additions and 4 deletions

View File

@ -8,7 +8,7 @@ case "$2" in
;;
"verbosetimeout")
(pstree -p -a $1 ; ctdb-event status random $2) > "$log"
(pstree $1 ; ctdb-event status random $2) > "$log"
;;
"verbosetimeout2")

View File

@ -15,8 +15,7 @@ simple_test run 5 random verbosetimeout
sleep 5
ok <<EOF
02.enabled.scri,PID $eventd_scriptdir/random/02.enabled.script verbosetimeout
\`-sleep,PID 99
02.enabled.scri---sleep
01.disabled DISABLED
02.enabled TIMEDOUT DATETIME
OUTPUT: Sleeping for 99 seconds

View File

@ -28,4 +28,4 @@ unit_test cat "${CTDB_BASE}/debug_script.log"
pid=$(cat "${CTDB_BASE}/debug_script.log" | awk '{print $2}')
ok_null
unit_test pstree -p -a "$pid"
unit_test pstree "$pid"