1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
#!/bin/bash
# vim: set filetype=sh :
# file: test.debug
# copyright: Bernd Schumacher <bernd.schumacher@hpe.com> (2007-2020)
# license: GNU General Public License, version 3
# description: test provided debug features
# see also: example.debug
# The following tests are included:
# (1) Run without options
# (2) check the logfile
. ./tstlib
# change multiple + (as produced in bash set -x) to just one + (as produced in dash set -x)
quote="'"
shell=""
while [ $# -ne 0 ]; do
if [ "$1" = "-s" ]; then
shell="$2"
shift 2
else
echo "ERROR $0: unknown option <$1>" >&2
exit 1
fi
done
[ "$shell" ] && set -- "$@" -s "$shell"
[ "$shell" = "mksh" ] && set -- "$@" -u "$UNIFY_mksh"
[ "$shell" = "bash" ] && set -- "$@" -u "$UNIFY_bash"
bug913718_unify UNIFY_posh
[ "$shell" = "posh" ] && set -- "$@" -u "$UNIFY_posh"
ia_logfile="$(mktemp)"
export ia_logfile
cmd=$(dirname $0)/example.debug
bug913718_cmd
rm -f $ia_logfile
check "(1) Run without options" "$@" "$cmd" \
"testing: dbgon \"1 car bike\"
DEBUG 04:dbg_<1>_<car>
testing: dbgon \"1 car none bike\"
DEBUG 01:dbg_<>_<>
DEBUG 02:dbg_<1>_<>
DEBUG 04:dbg_<1>_<car>
testing: dbgon \"2 car bike\"
DEBUG 04:dbg_<1>_<car>
DEBUG 06:dbg_<2>_<car>
DEBUG 07:dbg_<2>_<bike>
testing: dbgon \"3 car bike\"
DEBUG 04:dbg_<1>_<car>
DEBUG 06:dbg_<2>_<car>
DEBUG 07:dbg_<2>_<bike>
testing: dbgon \"3 dog cat\"
DEBUG 05:dbg_<1>_<cat>
DEBUG 08:dbg_<3>_<dog>
DEBUG 09:dbg_<3>_<cat>
testing: dbgon \"3 dog cat none\"
DEBUG 01:dbg_<>_<>
DEBUG 02:dbg_<1>_<>
DEBUG 03:dbg_<3>_<>
DEBUG 05:dbg_<1>_<cat>
DEBUG 08:dbg_<3>_<dog>
DEBUG 09:dbg_<3>_<cat>
testing: dbgon \"9\"
DEBUG 01:dbg_<>_<>
DEBUG 02:dbg_<1>_<>
DEBUG 03:dbg_<3>_<>
DEBUG 04:dbg_<1>_<car>
DEBUG 05:dbg_<1>_<cat>
DEBUG 06:dbg_<2>_<car>
DEBUG 07:dbg_<2>_<bike>
DEBUG 08:dbg_<3>_<dog>
DEBUG 09:dbg_<3>_<cat>
testing: dbgon \"0\""
check "(2) check the logfile" "$@" "cat $ia_logfile" \
"|example.debug
||example.debug/f3
|||example.debug/f3/f2
||||example.debug/f3/f2/f1
|||DEBUG 04:dbg_<1>_<car>
||example.debug/f3
|||example.debug/f3/f2
||||example.debug/f3/f2/f1
||||DEBUG 01:dbg_<>_<>
||||DEBUG 02:dbg_<1>_<>
|||DEBUG 04:dbg_<1>_<car>
||example.debug/f3
|||example.debug/f3/f2
||||example.debug/f3/f2/f1
|||DEBUG 04:dbg_<1>_<car>
|||DEBUG 06:dbg_<2>_<car>
||DEBUG 07:dbg_<2>_<bike>
||example.debug/f3
|||example.debug/f3/f2
||||example.debug/f3/f2/f1
|||DEBUG 04:dbg_<1>_<car>
|||DEBUG 06:dbg_<2>_<car>
||DEBUG 07:dbg_<2>_<bike>
||example.debug/f3
|||example.debug/f3/f2
||||example.debug/f3/f2/f1
|||DEBUG 05:dbg_<1>_<cat>
||DEBUG 08:dbg_<3>_<dog>
||DEBUG 09:dbg_<3>_<cat>
||example.debug/f3
|||example.debug/f3/f2
||||example.debug/f3/f2/f1
||||DEBUG 01:dbg_<>_<>
||||DEBUG 02:dbg_<1>_<>
||||DEBUG 03:dbg_<3>_<>
|||DEBUG 05:dbg_<1>_<cat>
||DEBUG 08:dbg_<3>_<dog>
||DEBUG 09:dbg_<3>_<cat>
||example.debug/f3
|||example.debug/f3/f2
||||example.debug/f3/f2/f1
||||DEBUG 01:dbg_<>_<>
||||DEBUG 02:dbg_<1>_<>
||||DEBUG 03:dbg_<3>_<>
|||DEBUG 04:dbg_<1>_<car>
|||DEBUG 05:dbg_<1>_<cat>
|||DEBUG 06:dbg_<2>_<car>
||DEBUG 07:dbg_<2>_<bike>
||DEBUG 08:dbg_<3>_<dog>
||DEBUG 09:dbg_<3>_<cat>
||example.debug/f3
|||example.debug/f3/f2
||||example.debug/f3/f2/f1"
rm -f $ia_logfile
|