summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.base/cmd_parse.exp
blob: cbce045555004e8dc4a6400f8a7a48a3e2e5ec5f (plain)
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
if {![installtest_p]} {
    for {set i 0} { $i < 8} {incr i} {
        untested cmd_parse$i
    }
    return
}

# stap -c 'echo "hello world"' -e 'probe begin {}'
spawn stap -c {echo "hello world"} -e {probe begin {}}
expect {
    -timeout 60
    "hello world" {pass "cmd_parse1"}
    timeout {fail "cmd_parse1: unexpected timeout"}
    eof {fail "cmd_parse1: unexpected EOF"}
}
wait

# stap -c 'echo "hello "\"world\"' -e 'probe begin {}'
spawn stap -c {echo "hello "\"world\"} -e {probe begin {}}
expect {
    -timeout 60
    "hello \"world\"" {pass "cmd_parse2"}
    timeout {fail "cmd_parse2: unexpected timeout"}
    eof {fail "cmd_parse2: unexpected EOF"}
}
wait

#stap -c '(a="hello world"; echo $a)' -e 'probe begin {}'
spawn stap -c {(a="hello world"; echo $a)} -e {probe begin {}}
expect {
    -timeout 60
    "hello world" {pass "cmd_parse3"}
    timeout {fail "cmd_parse3: unexpected timeout"}
    eof {fail "cmd_parse3: unexpected EOF"}
}
wait

#stap -c '(a="hello "\"world\"; echo $a)' -e 'probe begin {}'
spawn stap -c {(a="hello "\"world\"; echo $a)} -e {probe begin {}}
expect {
    -timeout 60
    "hello \"world\"" {pass "cmd_parse4"}
    timeout {fail "cmd_parse4: unexpected timeout"}
    eof {fail "cmd_parse4: unexpected EOF"}
}
wait

#stap -c '(a="hello "world; echo $a)' -e 'probe begin {}'
spawn stap -c {(a="hello "world; echo $a)} -e {probe begin {}}
expect {
    -timeout 60
    "hello world" {pass "cmd_parse5"}
    timeout {fail "cmd_parse5: unexpected timeout"}
    eof {fail "cmd_parse5: unexpected EOF"}
}
wait

#stap -c '(((a=42+7)); echo "The answer is $a")' -e 'probe begin {}'
# NB: not  ((a=42+7)) - must not assume bash
spawn stap -c {(a=49; echo "The answer is $a")} -e {probe begin {}}
expect {
    -timeout 60
    "The answer is 49" {pass "cmd_parse6"}
    timeout {fail "cmd_parse6: unexpected timeout"}
    eof {fail "cmd_parse6: unexpected EOF"}
}
wait

#stap -c '(echo "Hello World" 1>&2) > /dev/null' -e 'probe begin {}'
spawn stap -c {(echo "Hello World" 1>&2) > /dev/null} -e {probe begin {}}
expect {
    -timeout 60
    "Hello World" {pass "cmd_parse7"}
    timeout {fail "cmd_parse7: unexpected timeout"}
    eof {fail "cmd_parse7: unexpected EOF"}
}
wait

spawn stap -l {vm.*}
expect {
    -timeout 60
    -re "vm.*" {pass "cmd_parse8"}
    timeout {fail "cmd_parse8: unexpected timeout"}
    eof {fail "cmd_parse8: unexpected EOF"}
}
wait