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