doc/SystemTap_Beginners_Guide/testsuite/systemtap.bpf/bpf_tests/increment1.stp
raw| 1 | global res |
| 2 | probe begin { |
| 3 | printf("BEGIN\n") |
| 4 | x = 0; y = 2 |
| 5 | if (x++ == 0 && y++ == 2 && ++x == 2 && ++y == 4) |
| 6 | res = 1 |
| 7 | } |
| 8 | |
| 9 | probe kernel.function("vfs_read") { |
| 10 | x = 0; y = 2 |
| 11 | if (!(x++ == 0 && y++ == 2 && ++x == 2 && ++y == 4)) |
| 12 | res = 0 |
| 13 | exit() |
| 14 | } |
| 15 | |
| 16 | probe end { |
| 17 | x = 0; y = 2 |
| 18 | if (res && x++ == 0 && y++ == 2 && ++x == 2 && ++y == 4) |
| 19 | printf("END PASS\n") |
| 20 | else |
| 21 | printf("END FAIL\n") |
| 22 | } |