| 1 |
/* |
| 2 |
* global_vars.stp |
| 3 |
* |
| 4 |
* Check that global variables with a ; termination work fine |
| 5 |
*/ |
| 6 |
|
| 7 |
probe begin { println("systemtap starting probe") } |
| 8 |
probe end { println("systemtap ending probe") } |
| 9 |
|
| 10 |
global a; |
| 11 |
global c, d; |
| 12 |
global g = 42; |
| 13 |
global e[1], f; |
| 14 |
global gstr = "foobar"; |
| 15 |
|
| 16 |
global gstr_saved; |
| 17 |
probe begin(-9223372036854775808) { |
| 18 |
c = g |
| 19 |
d = c + g |
| 20 |
a = d |
| 21 |
f = c |
| 22 |
e[0] = "a"; |
| 23 |
gstr_saved = gstr |
| 24 |
} |
| 25 |
|
| 26 |
probe end { |
| 27 |
rc = 0 |
| 28 |
if (c == 42) |
| 29 |
rc += 1 |
| 30 |
else |
| 31 |
printf("systemtap test failure - c:%d != 42\n", c) |
| 32 |
|
| 33 |
if (d == (c + g)) |
| 34 |
rc += 1 |
| 35 |
else |
| 36 |
printf("systemtap test failure - d:%d != %d\n", d, (c+g)) |
| 37 |
|
| 38 |
if (a == d) |
| 39 |
rc += 1 |
| 40 |
else |
| 41 |
printf("systemtap test failure - a:%d != %d\n", a, d) |
| 42 |
|
| 43 |
if (f == c) |
| 44 |
rc += 1 |
| 45 |
else |
| 46 |
printf("systemtap test failure - f:%d != %d\n", f, c) |
| 47 |
|
| 48 |
if (e[0] == "a") |
| 49 |
rc += 1 |
| 50 |
else |
| 51 |
printf("systemtap test failure - e:%s != a\n", e[0]) |
| 52 |
|
| 53 |
if (gstr_saved == "foobar") |
| 54 |
rc += 1 |
| 55 |
else |
| 56 |
printf("systemtap test failure - gstr_saved:%s != foobar\n", gstr_saved) |
| 57 |
|
| 58 |
if (rc == 6) |
| 59 |
println("systemtap test success") |
| 60 |
else |
| 61 |
printf("systemtap test failure (%d passes)\n", rc) |
| 62 |
} |
| 63 |
|