| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# $expressions and $autocast_expressions should mirror parseok/autocast01.stp. |
| 4 |
# But now we're running stap --compatible=2.5, so they should each fail. |
| 5 |
|
| 6 |
expressions=( |
| 7 |
'(6 * 9)' # any parenthesized expression |
| 8 |
'"the ultimate answer"' # literal_string |
| 9 |
'42' # literal_number |
| 10 |
'%{ 42 %}' # embedded_expr |
| 11 |
'answer' # symbol |
| 12 |
'@max(answer)' # stat_op |
| 13 |
'@defined(answer)' # defined_op |
| 14 |
'@entry(answer)' # entry_op |
| 15 |
'@perf("answer")' # perf_op |
| 16 |
'answer[6,9]' # symbol arrayindex |
| 17 |
'@hist_log(answer)[42]' # hist_op arrayindex |
| 18 |
'report(answer)' # functioncall |
| 19 |
'print(answer)' # print_format |
| 20 |
) |
| 21 |
|
| 22 |
ok=0 |
| 23 |
for e in "${expressions[@]}"; do |
| 24 |
|
| 25 |
autocast_expressions=( |
| 26 |
"& $e" |
| 27 |
"$e ->member" |
| 28 |
"$e [index]" |
| 29 |
"$e \$" |
| 30 |
"$e \$\$" |
| 31 |
"& $e ->member [index]" |
| 32 |
"$e [index] ->member\$" |
| 33 |
) |
| 34 |
|
| 35 |
for ae in "${autocast_expressions[@]}"; do |
| 36 |
if [ "$ae" == "answer [index]" ] ; then |
| 37 |
# this one reveals a flaw of this test iteration; |
| 38 |
# it's actually parsed as an arrayindex, always ok. |
| 39 |
continue |
| 40 |
fi |
| 41 |
|
| 42 |
if stap "$@" -g -p1 -e "probe begin { ( $ae ) }" --compatible=2.5 ; then |
| 43 |
echo >&2 "autocast '$ae' shouldn't work on stap 2.5!" |
| 44 |
ok=$(( $ok + 1 )) |
| 45 |
fi |
| 46 |
done |
| 47 |
|
| 48 |
done |
| 49 |
|
| 50 |
if [ $ok -eq 0 ] ; then |
| 51 |
echo >&2 "All autocasts failed correctly on stap 2.5" |
| 52 |
exit 1 # XFAIL |
| 53 |
else |
| 54 |
echo >&2 "$ok autocasts didn't fail correctly on stap 2.5!" |
| 55 |
exit 0 # XPASS |
| 56 |
fi |
| 57 |
|