| 1 |
set test "lock-pushdown-bugs" |
| 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: PR31018: if stmt needing locks before a map op stmt (check at runtime)" |
| 10 |
|
| 11 |
set res [target_compile ${testpath}/${test}_1.c ./a.out executable \ |
| 12 |
"additional_flags=-O additional_flags=-g additional_flags=-Wno-unused-parameter"] |
| 13 |
if {$res ne ""} { |
| 14 |
verbose "target_compile failed: $res" 2 |
| 15 |
fail "$test: $subtest1: unable to compile ${test}_1.c" |
| 16 |
} else { |
| 17 |
foreach runtime [get_runtime_list] { |
| 18 |
if {$runtime eq ""} { |
| 19 |
set runtime "kernel" |
| 20 |
} |
| 21 |
set test_name "$test: $subtest1 ($runtime)" |
| 22 |
set cmd "stap -g --runtime=$runtime -c ./a.out '$srcdir/$subdir/${test}_1.stp'" |
| 23 |
set exit_code [run_cmd_2way $cmd out stderr] |
| 24 |
set exp_out "ok\n" |
| 25 |
is "${test_name}: stdout" $out $exp_out |
| 26 |
set exp_stderr "" |
| 27 |
is "${test_name}: stderr" $stderr $exp_stderr |
| 28 |
is "${test_name}: exit code" $exit_code 0 |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
# --- TEST 2 --- |
| 33 |
|
| 34 |
set subtest2 "TEST 2: PR31018: if stmt needing locks before a map op stmt (check at runtime, if entered)" |
| 35 |
|
| 36 |
set res [target_compile ${testpath}/${test}_1.c ./a.out executable \ |
| 37 |
"additional_flags=-O additional_flags=-g additional_flags=-Wno-unused-parameter"] |
| 38 |
if {$res ne ""} { |
| 39 |
verbose "target_compile failed: $res" 2 |
| 40 |
fail "$test: $subtest2: unable to compile ${test}_1.c" |
| 41 |
} else { |
| 42 |
foreach runtime [get_runtime_list] { |
| 43 |
if {$runtime eq ""} { |
| 44 |
set runtime "kernel" |
| 45 |
} |
| 46 |
set test_name "$test: $subtest2 ($runtime)" |
| 47 |
set cmd "stap -g --runtime=$runtime -c ./a.out '$srcdir/$subdir/${test}_2.stp'" |
| 48 |
set exit_code [run_cmd_2way $cmd out stderr] |
| 49 |
set exp_out "ok\n" |
| 50 |
is "${test_name}: stdout" $out $exp_out |
| 51 |
set exp_stderr "" |
| 52 |
is "${test_name}: stderr" $stderr $exp_stderr |
| 53 |
is "${test_name}: exit code" $exit_code 0 |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
# --- TEST 3 --- |
| 58 |
|
| 59 |
set subtest3 "TEST 3: PR31018: nested block stmt needing locks before a map op stmt (check at runtime)" |
| 60 |
|
| 61 |
set res [target_compile ${testpath}/${test}_1.c ./a.out executable \ |
| 62 |
"additional_flags=-O additional_flags=-g additional_flags=-Wno-unused-parameter"] |
| 63 |
if {$res ne ""} { |
| 64 |
verbose "target_compile failed: $res" 2 |
| 65 |
fail "$test: $subtest3: unable to compile ${test}_1.c" |
| 66 |
} else { |
| 67 |
foreach runtime [get_runtime_list] { |
| 68 |
if {$runtime eq ""} { |
| 69 |
set runtime "kernel" |
| 70 |
} |
| 71 |
set test_name "$test: $subtest3 ($runtime)" |
| 72 |
set cmd "stap -g --runtime=$runtime -c ./a.out '$srcdir/$subdir/${test}_3.stp'" |
| 73 |
set exit_code [run_cmd_2way $cmd out stderr] |
| 74 |
set exp_out "ok\n" |
| 75 |
is "${test_name}: stdout" $out $exp_out |
| 76 |
set exp_stderr "" |
| 77 |
is "${test_name}: stderr" $stderr $exp_stderr |
| 78 |
is "${test_name}: exit code" $exit_code 0 |
| 79 |
} |
| 80 |
} |
| 81 |
|
| 82 |
# --- TEST 4 --- |
| 83 |
|
| 84 |
set subtest4 "TEST 4: PR31018: nested block stmt needing locks before a map op stmt (check at runtime, if taken)" |
| 85 |
|
| 86 |
set res [target_compile ${testpath}/${test}_1.c ./a.out executable \ |
| 87 |
"additional_flags=-O additional_flags=-g additional_flags=-Wno-unused-parameter"] |
| 88 |
if {$res ne ""} { |
| 89 |
verbose "target_compile failed: $res" 2 |
| 90 |
fail "$test: $subtest4: unable to compile ${test}_1.c" |
| 91 |
} else { |
| 92 |
foreach runtime [get_runtime_list] { |
| 93 |
if {$runtime eq ""} { |
| 94 |
set runtime "kernel" |
| 95 |
} |
| 96 |
set test_name "$test: $subtest4 ($runtime)" |
| 97 |
set cmd "stap -g --runtime=$runtime -c ./a.out '$srcdir/$subdir/${test}_4.stp'" |
| 98 |
set exit_code [run_cmd_2way $cmd out stderr] |
| 99 |
set exp_out "ok\n" |
| 100 |
is "${test_name}: stdout" $out $exp_out |
| 101 |
set exp_stderr "" |
| 102 |
is "${test_name}: stderr" $stderr $exp_stderr |
| 103 |
is "${test_name}: exit code" $exit_code 0 |
| 104 |
} |
| 105 |
} |
| 106 |
|
| 107 |
# --- TEST 5 --- |
| 108 |
|
| 109 |
set subtest5 "TEST 5: PR31018: if stmt needing locks before a map op stmt (check at runtime)" |
| 110 |
|
| 111 |
set res [target_compile ${testpath}/${test}_1.c ./a.out executable \ |
| 112 |
"additional_flags=-O additional_flags=-g additional_flags=-Wno-unused-parameter"] |
| 113 |
if {$res ne ""} { |
| 114 |
verbose "target_compile failed: $res" 2 |
| 115 |
fail "$test: $subtest5: unable to compile ${test}_1.c" |
| 116 |
} else { |
| 117 |
foreach runtime [get_runtime_list] { |
| 118 |
if {$runtime eq ""} { |
| 119 |
set runtime "kernel" |
| 120 |
} |
| 121 |
set test_name "$test: $subtest5 ($runtime)" |
| 122 |
set cmd "stap -g --runtime=$runtime -c ./a.out '$srcdir/$subdir/${test}_5.stp'" |
| 123 |
set exit_code [run_cmd_2way $cmd out stderr] |
| 124 |
set exp_out "ok\n" |
| 125 |
is "${test_name}: stdout" $out $exp_out |
| 126 |
set exp_stderr "" |
| 127 |
is "${test_name}: stderr" $stderr $exp_stderr |
| 128 |
is "${test_name}: exit code" $exit_code 0 |
| 129 |
} |
| 130 |
} |