Debian Codegraph @

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

raw
1 set test "register_aarch64"
2 set testpath "$srcdir/$subdir"
3
4 if {! [installtest_p]} { untested $test; return }
5 if {! [uretprobes_p]} { untested $test; return }
6 set arch [exec uname -m]
7 if {$arch ne "aarch64"} { untested $test; return }
8
9 # --- TEST 1 ---
10
11 set subtest1 "TEST 1: 64-bit x0"
12
13 set res [target_compile ${testpath}/${test}_1.c ./a.out executable \
14 "additional_flags=-O additional_flags=-g additional_flags=-O0"]
15 if {$res ne ""} {
16 verbose "target_compile failed: $res" 2
17 fail "$test: $subtest1: unable to compile ${test}_1.c"
18 } else {
19 foreach runtime [get_runtime_list] {
20 if {$runtime eq ""} {
21 set runtime "kernel"
22 }
23 set test_name "$test: $subtest1 ($runtime)"
24 set cmd "stap --runtime=$runtime -c ./a.out '$srcdir/$subdir/${test}_1.stp'"
25 set exit_code [run_cmd_2way $cmd out stderr]
26 set exp_out "x0 = 0x56781234beefdead
27 u x0 = 0x56781234beefdead
28
29 w0 = 0xffffffffbeefdead
30 u w0 = 0xbeefdead
31 "
32 is "${test_name}: stdout" $out $exp_out
33 is "${test_name}: exit code" $exit_code 0
34 if {$stderr ne ""} {
35 send_log "stderr:\n$stderr"
36 }
37 }
38 }
39
40 # --- TEST 2 ---
41
42 set subtest2 "TEST 2: 64-bit x1"
43
44 set res [target_compile ${testpath}/${test}_2.c ./a.out executable \
45 "additional_flags=-O additional_flags=-g additional_flags=-O0"]
46 if {$res ne ""} {
47 verbose "target_compile failed: $res" 2
48 fail "$test: $subtest2: unable to compile ${test}_2.c"
49 } else {
50 foreach runtime [get_runtime_list] {
51 if {$runtime eq ""} {
52 set runtime "kernel"
53 }
54 set test_name "$test: $subtest2 ($runtime)"
55 set cmd "stap --runtime=$runtime -c ./a.out '$srcdir/$subdir/${test}_2.stp'"
56 set exit_code [run_cmd_2way $cmd out stderr]
57 set exp_out "x1 = 0x56781234beefdead
58 u x1 = 0x56781234beefdead
59
60 w1 = 0xffffffffbeefdead
61 u w1 = 0xbeefdead
62 "
63 is "${test_name}: stdout" $out $exp_out
64 is "${test_name}: exit code" $exit_code 0
65 if {$stderr ne ""} {
66 send_log "stderr:\n$stderr"
67 }
68 }
69 }
70
71 # --- TEST 3 ---
72
73 set subtest3 "TEST 3: 64-bit x2"
74
75 set res [target_compile ${testpath}/${test}_3.c ./a.out executable \
76 "additional_flags=-O additional_flags=-g additional_flags=-O0"]
77 if {$res ne ""} {
78 verbose "target_compile failed: $res" 2
79 fail "$test: $subtest3: unable to compile ${test}_3.c"
80 } else {
81 foreach runtime [get_runtime_list] {
82 if {$runtime eq ""} {
83 set runtime "kernel"
84 }
85 set test_name "$test: $subtest3 ($runtime)"
86 set cmd "stap --runtime=$runtime -c ./a.out '$srcdir/$subdir/${test}_3.stp'"
87 set exit_code [run_cmd_2way $cmd out stderr]
88 set exp_out "x2 = 0x56781234beefdead
89 u x2 = 0x56781234beefdead
90
91 w2 = 0xffffffffbeefdead
92 u w2 = 0xbeefdead
93 "
94 is "${test_name}: stdout" $out $exp_out
95 is "${test_name}: exit code" $exit_code 0
96 if {$stderr ne ""} {
97 send_log "stderr:\n$stderr"
98 }
99 }
100 }
101
102 # --- TEST 4 ---
103
104 set subtest4 "TEST 4: 64-bit x3"
105
106 set res [target_compile ${testpath}/${test}_4.c ./a.out executable \
107 "additional_flags=-O additional_flags=-g additional_flags=-O0"]
108 if {$res ne ""} {
109 verbose "target_compile failed: $res" 2
110 fail "$test: $subtest4: unable to compile ${test}_4.c"
111 } else {
112 foreach runtime [get_runtime_list] {
113 if {$runtime eq ""} {
114 set runtime "kernel"
115 }
116 set test_name "$test: $subtest4 ($runtime)"
117 set cmd "stap --runtime=$runtime -c ./a.out '$srcdir/$subdir/${test}_4.stp'"
118 set exit_code [run_cmd_2way $cmd out stderr]
119 set exp_out "x3 = 0x56781234beefdead
120 u x3 = 0x56781234beefdead
121
122 w3 = 0xffffffffbeefdead
123 u w3 = 0xbeefdead
124 "
125 is "${test_name}: stdout" $out $exp_out
126 is "${test_name}: exit code" $exit_code 0
127 if {$stderr ne ""} {
128 send_log "stderr:\n$stderr"
129 }
130 }
131 }
132
133 # --- TEST 5 ---
134
135 set subtest5 "TEST 5: 64-bit x29"
136
137 set res [target_compile ${testpath}/${test}_5.c ./a.out executable \
138 "additional_flags=-O additional_flags=-g additional_flags=-O0"]
139 if {$res ne ""} {
140 verbose "target_compile failed: $res" 2
141 fail "$test: $subtest5: unable to compile ${test}_5.c"
142 } else {
143 foreach runtime [get_runtime_list] {
144 if {$runtime eq ""} {
145 set runtime "kernel"
146 }
147 set test_name "$test: $subtest5 ($runtime)"
148 set cmd "stap --runtime=$runtime -c ./a.out '$srcdir/$subdir/${test}_5.stp'"
149 set exit_code [run_cmd_2way $cmd out stderr]
150 set exp_out "x29 = 0x56781234beefdead
151 u x29 = 0x56781234beefdead
152
153 w29 = 0xffffffffbeefdead
154 u w29 = 0xbeefdead
155 "
156 is "${test_name}: stdout" $out $exp_out
157 is "${test_name}: exit code" $exit_code 0
158 if {$stderr ne ""} {
159 send_log "stderr:\n$stderr"
160 }
161 }
162 }