Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/tri.stp

raw
1 /*
2 * tri.stp
3 *
4 * Check the systemtap ?: operator works
5 */
6
7 global x1, x2, x3, x4, x5, x6
8
9 probe begin
10 {
11 println("systemtap starting probe");
12 x1 = 0; x2 = 1; x3=30;
13 }
14
15 probe end
16 {
17 rc = 0
18 println("systemtap ending probe")
19 x4 = x1 ? 9: 10;
20 x5 = x2 ? 99: 100;
21 x6 = x3 ? 999: 1000;
22 if (x4 != 10 ) {
23 println("systemtap test failure");
24 } else {
25 rc += 1
26 }
27 if (x5 != 99 ) {
28 println("systemtap test failure");
29 } else {
30 rc += 1
31 }
32 if (x6 != 999 ) {
33 println("systemtap test failure");
34 } else {
35 rc += 1
36 }
37
38 if (rc == 3)
39 println("systemtap test success")
40 else
41 printf("systemtap test failure (%d passes)\n", rc)
42 }