doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/if.stp
raw| 1 | /* |
| 2 | * if.stp |
| 3 | * |
| 4 | * Check the systemtap if statement works |
| 5 | */ |
| 6 | |
| 7 | probe begin { println("systemtap starting probe") } |
| 8 | |
| 9 | probe end |
| 10 | { |
| 11 | rc = 0 |
| 12 | println("systemtap ending probe") |
| 13 | if (1) { |
| 14 | rc += 1 |
| 15 | } else { |
| 16 | println("systemtap test failure"); |
| 17 | } |
| 18 | if (0) { |
| 19 | println("systemtap test failure"); |
| 20 | } else { |
| 21 | rc += 1 |
| 22 | } |
| 23 | |
| 24 | if (rc == 2) |
| 25 | println("systemtap test success") |
| 26 | else |
| 27 | printf("systemtap test failure (%d passes)\n", rc) |
| 28 | } |