| 1 |
set test "kernel-hw-breakpoint-addr-err" |
| 2 |
set testpath "$srcdir/$subdir" |
| 3 |
|
| 4 |
if {! [installtest_p]} { untested $test; return } |
| 5 |
if {! [uretprobes_p]} { untested $test; return } |
| 6 |
|
| 7 |
# --- TEST 1 --- |
| 8 |
|
| 9 |
set subtest1 "TEST 1: kernel.data(ADDR).rw 2nd probe failed to register" |
| 10 |
|
| 11 |
set res [target_compile ${testpath}/${test}_1.c ./a.out executable \ |
| 12 |
"additional_flags=-O additional_flags=-g additional_flags=-O0 additional_flags=-g additional_flags=-fno-PIC additional_flags=-no-pie"] |
| 13 |
if {$res ne ""} { |
| 14 |
verbose "target_compile failed: $res" 2 |
| 15 |
fail "$test: $subtest1: unable to compile ${test}_1.c" |
| 16 |
} else { |
| 17 |
if {! [process_template_file "$srcdir/$subdir/${test}_1.stp" \ |
| 18 |
"./${test}_1.stp" "./a.out" nm_err]} { |
| 19 |
fail "$test: $subtest1: $nm_err" |
| 20 |
} else { |
| 21 |
foreach runtime [get_runtime_list] { |
| 22 |
if {$runtime eq ""} { |
| 23 |
set runtime "kernel" |
| 24 |
} |
| 25 |
set test_name "$test: $subtest1 ($runtime)" |
| 26 |
set cmd "stap --runtime=$runtime -c ./a.out './${test}_1.stp'" |
| 27 |
set exit_code [run_cmd_2way_as_root $cmd out stderr] |
| 28 |
set exp_out "" |
| 29 |
is "${test_name}: stdout" $out $exp_out |
| 30 |
isnt "${test_name}: exit code" $exit_code 0 |
| 31 |
set stderr_pat "^ERROR: Probe kernel\\.data\\(\"blah_no_such_symbol\"\\)\\.length\\(1\\)\\.rw registration failed: invalid symbol 'blah_no_such_symbol'" |
| 32 |
like "${test_name}: stderr" $stderr $stderr_pat "-lineanchor" |
| 33 |
} |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
# --- TEST 2 --- |
| 38 |
|
| 39 |
set subtest2 "TEST 2: kernel.data(ADDR).rw 1st probe failed to register" |
| 40 |
|
| 41 |
set res [target_compile ${testpath}/${test}_1.c ./a.out executable \ |
| 42 |
"additional_flags=-O additional_flags=-g additional_flags=-O0 additional_flags=-g additional_flags=-fno-PIC additional_flags=-no-pie"] |
| 43 |
if {$res ne ""} { |
| 44 |
verbose "target_compile failed: $res" 2 |
| 45 |
fail "$test: $subtest2: unable to compile ${test}_1.c" |
| 46 |
} else { |
| 47 |
if {! [process_template_file "$srcdir/$subdir/${test}_2.stp" \ |
| 48 |
"./${test}_2.stp" "./a.out" nm_err]} { |
| 49 |
fail "$test: $subtest2: $nm_err" |
| 50 |
} else { |
| 51 |
foreach runtime [get_runtime_list] { |
| 52 |
if {$runtime eq ""} { |
| 53 |
set runtime "kernel" |
| 54 |
} |
| 55 |
set test_name "$test: $subtest2 ($runtime)" |
| 56 |
set cmd "stap --runtime=$runtime -c ./a.out './${test}_2.stp'" |
| 57 |
set exit_code [run_cmd_2way_as_root $cmd out stderr] |
| 58 |
set exp_out "" |
| 59 |
is "${test_name}: stdout" $out $exp_out |
| 60 |
isnt "${test_name}: exit code" $exit_code 0 |
| 61 |
set stderr_pat "^ERROR: Probe kernel\\.data\\(\"blah_no_such_symbol\"\\)\\.length\\(1\\)\\.write registration failed: invalid symbol 'blah_no_such_symbol'" |
| 62 |
like "${test_name}: stderr" $stderr $stderr_pat "-lineanchor" |
| 63 |
} |
| 64 |
} |
| 65 |
} |