File: lock-pushdown-bugs.exp

package info (click to toggle)
systemtap 5.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 47,556 kB
  • sloc: cpp: 81,117; ansic: 54,933; xml: 49,795; exp: 43,595; sh: 11,526; python: 5,003; perl: 2,252; tcl: 1,312; makefile: 1,006; javascript: 149; lisp: 105; awk: 101; asm: 91; java: 70; sed: 16
file content (130 lines) | stat: -rw-r--r-- 4,798 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
set test "lock-pushdown-bugs"
set testpath "$srcdir/$subdir"

if {! [installtest_p]} { untested $test; return }
if {! [uretprobes_p]} { untested $test; return }

# --- TEST 1 ---

set subtest1 "TEST 1: PR31018: if stmt needing locks before a map op stmt (check at runtime)"

set res [target_compile ${testpath}/${test}_1.c ./a.out executable \
    "additional_flags=-O additional_flags=-g additional_flags=-Wno-unused-parameter"]
if {$res ne ""} {
    verbose "target_compile failed: $res" 2
    fail "$test: $subtest1: unable to compile ${test}_1.c"
} else {
    foreach runtime [get_runtime_list] {
        if {$runtime eq ""} {
            set runtime "kernel"
        }
        set test_name "$test: $subtest1 ($runtime)"
        set cmd "stap -g --runtime=$runtime -c ./a.out '$srcdir/$subdir/${test}_1.stp'"
        set exit_code [run_cmd_2way $cmd out stderr]
        set exp_out "ok\n"
        is "${test_name}: stdout" $out $exp_out
        set exp_stderr ""
        is "${test_name}: stderr" $stderr $exp_stderr
        is "${test_name}: exit code" $exit_code 0
    }
}

# --- TEST 2 ---

set subtest2 "TEST 2: PR31018: if stmt needing locks before a map op stmt (check at runtime, if entered)"

set res [target_compile ${testpath}/${test}_1.c ./a.out executable \
    "additional_flags=-O additional_flags=-g additional_flags=-Wno-unused-parameter"]
if {$res ne ""} {
    verbose "target_compile failed: $res" 2
    fail "$test: $subtest2: unable to compile ${test}_1.c"
} else {
    foreach runtime [get_runtime_list] {
        if {$runtime eq ""} {
            set runtime "kernel"
        }
        set test_name "$test: $subtest2 ($runtime)"
        set cmd "stap -g --runtime=$runtime -c ./a.out '$srcdir/$subdir/${test}_2.stp'"
        set exit_code [run_cmd_2way $cmd out stderr]
        set exp_out "ok\n"
        is "${test_name}: stdout" $out $exp_out
        set exp_stderr ""
        is "${test_name}: stderr" $stderr $exp_stderr
        is "${test_name}: exit code" $exit_code 0
    }
}

# --- TEST 3 ---

set subtest3 "TEST 3: PR31018: nested block stmt needing locks before a map op stmt (check at runtime)"

set res [target_compile ${testpath}/${test}_1.c ./a.out executable \
    "additional_flags=-O additional_flags=-g additional_flags=-Wno-unused-parameter"]
if {$res ne ""} {
    verbose "target_compile failed: $res" 2
    fail "$test: $subtest3: unable to compile ${test}_1.c"
} else {
    foreach runtime [get_runtime_list] {
        if {$runtime eq ""} {
            set runtime "kernel"
        }
        set test_name "$test: $subtest3 ($runtime)"
        set cmd "stap -g --runtime=$runtime -c ./a.out '$srcdir/$subdir/${test}_3.stp'"
        set exit_code [run_cmd_2way $cmd out stderr]
        set exp_out "ok\n"
        is "${test_name}: stdout" $out $exp_out
        set exp_stderr ""
        is "${test_name}: stderr" $stderr $exp_stderr
        is "${test_name}: exit code" $exit_code 0
    }
}

# --- TEST 4 ---

set subtest4 "TEST 4: PR31018: nested block stmt needing locks before a map op stmt (check at runtime, if taken)"

set res [target_compile ${testpath}/${test}_1.c ./a.out executable \
    "additional_flags=-O additional_flags=-g additional_flags=-Wno-unused-parameter"]
if {$res ne ""} {
    verbose "target_compile failed: $res" 2
    fail "$test: $subtest4: unable to compile ${test}_1.c"
} else {
    foreach runtime [get_runtime_list] {
        if {$runtime eq ""} {
            set runtime "kernel"
        }
        set test_name "$test: $subtest4 ($runtime)"
        set cmd "stap -g --runtime=$runtime -c ./a.out '$srcdir/$subdir/${test}_4.stp'"
        set exit_code [run_cmd_2way $cmd out stderr]
        set exp_out "ok\n"
        is "${test_name}: stdout" $out $exp_out
        set exp_stderr ""
        is "${test_name}: stderr" $stderr $exp_stderr
        is "${test_name}: exit code" $exit_code 0
    }
}

# --- TEST 5 ---

set subtest5 "TEST 5: PR31018: if stmt needing locks before a map op stmt (check at runtime)"

set res [target_compile ${testpath}/${test}_1.c ./a.out executable \
    "additional_flags=-O additional_flags=-g additional_flags=-Wno-unused-parameter"]
if {$res ne ""} {
    verbose "target_compile failed: $res" 2
    fail "$test: $subtest5: unable to compile ${test}_1.c"
} else {
    foreach runtime [get_runtime_list] {
        if {$runtime eq ""} {
            set runtime "kernel"
        }
        set test_name "$test: $subtest5 ($runtime)"
        set cmd "stap -g --runtime=$runtime -c ./a.out '$srcdir/$subdir/${test}_5.stp'"
        set exit_code [run_cmd_2way $cmd out stderr]
        set exp_out "ok\n"
        is "${test_name}: stdout" $out $exp_out
        set exp_stderr ""
        is "${test_name}: stderr" $stderr $exp_stderr
        is "${test_name}: exit code" $exit_code 0
    }
}