Debian Codegraph @

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

raw
1 /*
2 * logical_and.stp
3 *
4 * Check that systemtap "logical and" works
5 */
6
7 global x1_0
8 global x2_1
9 global x3_0
10 global x4_1
11
12 probe begin
13 {
14 println("systemtap starting probe")
15 x1_0 = 0; x2_1 = 1; x3_0 = 0; x4_1 = 1;
16 }
17
18 probe end
19 {
20 rc = 0
21 println("systemtap ending probe")
22 if (x1_0 && x3_0 ) {
23 println("systemtap test failure");
24 } else {
25 rc += 1
26 }
27 if (x2_1 && x3_0 ) {
28 println("systemtap test failure");
29 } else {
30 rc += 1
31 }
32 if (x1_0 && x4_1 ) {
33 println("systemtap test failure");
34 } else {
35 rc += 1
36 }
37 if (x2_1 && x4_1 ) {
38 rc += 1
39 } else {
40 println("systemtap test failure");
41 }
42
43 if (rc == 4)
44 println("systemtap test success")
45 else
46 printf("systemtap test failure (%d passes)\n", rc)
47 }