about summary refs log tree commit diff
path: root/Test/E02xtrace.ztst
blob: f1fb9edb02ac4f8dddb8297b78db911ea17a7378 (plain) (blame)
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
# Test that xtrace output is correctly generated

%prep
  mkdir xtrace.tmp && cd xtrace.tmp
  function xtf {
    local regression_test_dummy_variable
    print "$*"
  }
  echo 'print "$*"' > xt.in

%test

  set -x
  print 'Tracing: builtin'
  print 'Tracing: builtin 2>file' 2>xtrace.err
  cat <<<'Tracing: external'
  cat <<<'Tracing: external 2>file' 2>>xtrace.err
  ( print 'Tracing: ( builtin )' )
  ( print 'Tracing: ( builtin ) 2>file' ) 2>>xtrace.err
  ( cat <<<'Tracing: ( external )' )
  ( cat <<<'Tracing: ( external ) 2>file' ) 2>>xtrace.err
  { print 'Tracing: { builtin }' }
  { print 'Tracing: { builtin } 2>file' } 2>>xtrace.err
  { cat <<<'Tracing: { external }' }
  { cat <<<'Tracing: { external } 2>file' } 2>>xtrace.err
  repeat 1 do print 'Tracing: do builtin done'; done
  repeat 1 do print 'Tracing: do builtin done 2>file'; done 2>>xtrace.err
  repeat 1 do cat <<<'Tracing: do external done'; done
  repeat 1 do cat <<<'Tracing: do external done 2>file'; done 2>>xtrace.err
  xtf 'Tracing: function'
  xtf 'Tracing: function 2>file' 2>>xtrace.err
  . ./xt.in 'Tracing: source'
  . ./xt.in 'Tracing: source 2>file' 2>>xtrace.err
  set +x
  cat xtrace.err
0:xtrace with and without redirection
>Tracing: builtin
>Tracing: builtin 2>file
>Tracing: external
>Tracing: external 2>file
>Tracing: ( builtin )
>Tracing: ( builtin ) 2>file
>Tracing: ( external )
>Tracing: ( external ) 2>file
>Tracing: { builtin }
>Tracing: { builtin } 2>file
>Tracing: { external }
>Tracing: { external } 2>file
>Tracing: do builtin done
>Tracing: do builtin done 2>file
>Tracing: do external done
>Tracing: do external done 2>file
>Tracing: function
>Tracing: function 2>file
>Tracing: source
>Tracing: source 2>file
>+ZTST_execchunk:7> print Tracing: ( builtin ) 2>file
>+ZTST_execchunk:9> cat
>+ZTST_execchunk:11> print Tracing: { builtin } 2>file
>+ZTST_execchunk:13> cat
>+ZTST_execchunk:15> print Tracing: do builtin done 2>file
>+ZTST_execchunk:17> cat
?+ZTST_execchunk:2> print Tracing: builtin
?+ZTST_execchunk:3> print Tracing: builtin 2>file
?+ZTST_execchunk:4> cat
?+ZTST_execchunk:5> cat
?+ZTST_execchunk:6> print Tracing: ( builtin )
?+ZTST_execchunk:8> cat
?+ZTST_execchunk:10> print Tracing: { builtin }
?+ZTST_execchunk:12> cat
?+ZTST_execchunk:14> print Tracing: do builtin done
?+ZTST_execchunk:16> cat
?+ZTST_execchunk:18> xtf Tracing: function
?+xtf:1> local regression_test_dummy_variable
?+xtf:2> print Tracing: function
?+ZTST_execchunk:19> xtf Tracing: function 2>file
?+xtf:1> local regression_test_dummy_variable
?+xtf:2> print Tracing: function 2>file
?+ZTST_execchunk:20> . ./xt.in Tracing: source
?+./xt.in:1> print Tracing: source
?+ZTST_execchunk:21> . ./xt.in Tracing: source 2>file
?+./xt.in:1> print Tracing: source 2>file
?+ZTST_execchunk:22> set +x