Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/list.exp

raw
1 # PR14297-related testing
2 set stap_path [file normalize $env(SYSTEMTAP_PATH)/stap]
3
4 proc test_list { test input output_re } {
5 spawn stap -l $input
6 expect {
7 -timeout 180
8 -re $output_re { pass $test }
9 timeout { fail $test }
10 eof { fail $test }
11 }
12 catch { close }; catch { wait }
13 }
14
15 proc test_uprobes_list { test input output_re } {
16 if {[uprobes_p]} {
17 test_list $test $input $output_re
18 } else {
19 unsupported $test
20 }
21 }
22
23 proc test_plt_list { test input output_re } {
24 if {[plt_probes_p]} {
25 test_list $test $input $output_re
26 } else {
27 unsupported $test
28 }
29 }
30
31 test_plt_list plt-glob {process("stap").plt("re??")} \
32 "^process\\\(\"$stap_path\"\\\)\\\.plt\\\(\"read\"\\\)\r\n$"
33
34 test_plt_list plt-glob2 {process("stap").plt("re*")} \
35 "^process\\\(\"$stap_path\"\\\)\\\.plt\\\(\"re\[a-zA-Z0-9_\]*\"\\\)\r\n"
36
37 test_plt_list plt-non-glob {process("stap").plt("read")} \
38 "^process\\\(\"$stap_path\"\\\)\\\.plt\\\(\"read\"\\\)\r\n$"
39
40 test_plt_list plt-glob-ret {process("stap").plt("re??").return} \
41 "^process\\\(\"$stap_path\"\\\)\\\.plt\\\(\"read\"\\\).return\r\n$"
42
43 test_plt_list plt-glob2-ret {process("stap").plt("re*").return} \
44 "^process\\\(\"$stap_path\"\\\)\\\.plt\\\(\"re\[a-zA-Z0-9_\]*\"\\\).return\r\n"
45
46 test_plt_list plt-non-glob-ret {process("stap").plt("read").return} \
47 "^process\\\(\"$stap_path\"\\\)\\\.plt\\\(\"read\"\\\).return\r\n$"
48
49 test_uprobes_list mark-non-glob {process("stap").mark("pass5__end")} \
50 "^process\\\(\"$stap_path\"\\\)\\\.mark\\\(\"pass5__end\"\\\)\r\n$"
51
52 test_uprobes_list mark-non-glob2 {process("stap").mark("pass5-end")} \
53 "^process\\\(\"$stap_path\"\\\)\\\.mark\\\(\"pass5__end\"\\\)\r\n$"
54
55 test_uprobes_list mark-glob {process("stap").mark("pass[123456]__end")} \
56 "^process\\\(\"$stap_path\"\\\)\\\.mark\\\(\"pass\[123456\]__end\"\\\)\r\n"
57
58 test_uprobes_list mark-glob2 {process("stap").mark("pass*__end")} \
59 "^process\\\(\"$stap_path\"\\\)\\\.mark\\\(\"pass\[0123456\]__end\"\\\)\r\n"
60
61 test_list syscall-glob {syscall.rea*} \
62 {syscall.read\r\n}
63
64 test_list syscall-noglob {syscall.read} \
65 {syscall.read\r\n}
66
67 test_list init_once-glob {kernel.function("init_once*")} \
68 {kernel.function."init_once@fs/inode.c:\d+".\r\n}
69
70 test_list init_once-noglob {kernel.function("init_once")} \
71 {kernel.function."init_once@fs/inode.c:\d+".\r\n}
72
73 test_list begin-glob {begin*} \
74 {begin\r\n}
75
76 test_list begin-noglob {begin} \
77 {begin\r\n}
78
79 # This one is not so interesting, but we want to make sure the following test
80 # statements are actually within an inline.
81 #
82 # PR18554: Originally, this test only looked for an inlined version of
83 # copy_signal(). However, on 3.10.0-229.el7.ppc64, copy_signal() isn't
84 # inlined. But there are other functions from within that same file -
85 # like copy_files(), copy_flags(), copy_fs(), copy_io(), copy_mm(),
86 # copy_process(), and copy_sighand() - that will (hopefully) have
87 # inlined versions.
88 test_list copy_signal-inline {kernel.function("copy_*@kernel/fork.c").inline} \
89 {kernel.function."copy_[^@]+@kernel/fork.c:\d+"..inline\r\n}
90
91 # PR15587: make sure we have line numbers on statements of an inline function
92 test_list copy_signal-statement {kernel.statement("copy_*@kernel/fork.c:*")} \
93 {kernel.statement."copy_[^@]+@kernel/fork.c:\d+".\r\n}
94
95 # PR10208: ensure we can probe weak symbols
96 test_uprobes_list function-weak {process("/lib*/libc.so.*").function("chmod")} \
97 {process.*.function."chmod".\r\n}