File: test.hello_world_trace

package info (click to toggle)
shellia 5.10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 792 kB
  • sloc: sh: 7,840; makefile: 34
file content (86 lines) | stat: -rwxr-xr-x 2,324 bytes parent folder | download | duplicates (4)
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
#!/bin/sh
# vim: set filetype=sh :
#        file: test.hello_world_trace
#   copyright: Bernd Schumacher <bernd.schumacher@hpe.com> (2007-2020)
#     license: GNU General Public License, version 3
# description: test "hello world" script with trace
#    see also: hello_world_trace

# The following tests are included:
# (1) Run with -c"
# (2) Run with -C"

. ./tstlib

quote="'"
shell="dash"
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" = "bash" ] && set -- "$@" -u "$UNIFY_mktemp"
[ "$shell" = "posh" ] && set -- "$@" -u "$UNIFY_mktemp"
[ "$shell" = "mksh" ] && set -- "$@" -u "$UNIFY_mktemp"
[ "$shell" = "dash" ] && set -- "$@" -u "$UNIFY_mktemp"
[ "$shell" = "busybox sh" ] && set -- "$@" -u "$UNIFY_mktemp"

cmd="$(dirname $0)/hello_world_trace"
use_locallib

check "(1) Run with -c" "$@" "$cmd -a -- \"shellia user\"" \
"+ mktemp
+ file=/tmp/tmp.mktemp
+ echo hello shellia user
+ write_file -- /tmp/tmp.mktemp shellia user
+ cat /tmp/tmp.mktemp
+ show_file -- /tmp/tmp.mktemp
hello shellia user
+ rm -f /tmp/tmp.mktemp
----
|hello_world_trace.tmp.locallib
|+ mktemp
|+ file=/tmp/tmp.mktemp
||hello_world_trace.tmp.locallib/write_file
||+ echo hello shellia user
|+ write_file -- /tmp/tmp.mktemp shellia user
||hello_world_trace.tmp.locallib/show_file
||+ cat /tmp/tmp.mktemp
||s:hello shellia user
|+ show_file -- /tmp/tmp.mktemp
|s:hello shellia user
|+ rm -f /tmp/tmp.mktemp
----"

cmd="$(dirname $0)/hello_world_trace.tmp.ia-C"
cat $(dirname $0)/hello_world_trace  | sed -e "s/\(\<ia\>.*\)-c/\1-C/" -e "/^\s*ia_stdout\>/ d"> $cmd
use_locallib

check "(2) Run with -C" "$@" "$cmd -a -- \"shellia user\"" \
"+ mktemp
+ file=/tmp/tmp.mktemp
+ echo hello shellia user
+ write_file -- /tmp/tmp.mktemp shellia user
+ cat /tmp/tmp.mktemp
+ show_file -- /tmp/tmp.mktemp
hello shellia user
+ rm -f /tmp/tmp.mktemp
----
|hello_world_trace.tmp.ia-C.tmp.locallib
|+ mktemp
|+ file=/tmp/tmp.mktemp
||hello_world_trace.tmp.ia-C.tmp.locallib/write_file
||+ echo hello shellia user
|+ write_file -- /tmp/tmp.mktemp shellia user
||hello_world_trace.tmp.ia-C.tmp.locallib/show_file
||+ cat /tmp/tmp.mktemp
||s:hello shellia user
|+ show_file -- /tmp/tmp.mktemp
|s:hello shellia user
|+ rm -f /tmp/tmp.mktemp
----"