diff options
author | Tudor Florea <tudor.florea@enea.com> | 2014-10-08 03:43:27 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-10-10 16:44:32 +0100 |
commit | d8b5b2690ba6e57fe6e3ae5dd978789c38092db7 (patch) | |
tree | d0343d8377c88623b87beba8185779dc942a197e /meta/recipes-devtools/valgrind | |
parent | 0aedb382b397ab374a77851c837df2a622d5f47d (diff) | |
download | poky-d8b5b2690ba6e57fe6e3ae5dd978789c38092db7.tar.gz |
valgrind: Enforce 30 seconds limit for each test
(From OE-Core rev: ae9a89fc1beac13f30395d191954fd70c3a9f85e)
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/valgrind')
-rw-r--r-- | meta/recipes-devtools/valgrind/valgrind/add-ptest.patch | 68 |
1 files changed, 53 insertions, 15 deletions
diff --git a/meta/recipes-devtools/valgrind/valgrind/add-ptest.patch b/meta/recipes-devtools/valgrind/valgrind/add-ptest.patch index fdc9cc0e83..225f84305f 100644 --- a/meta/recipes-devtools/valgrind/valgrind/add-ptest.patch +++ b/meta/recipes-devtools/valgrind/valgrind/add-ptest.patch | |||
@@ -1,6 +1,6 @@ | |||
1 | Modify vg_test wrapper to support PTEST formats | 1 | Modify vg_test wrapper to support PTEST formats |
2 | 2 | ||
3 | This commit changes the valgrind regression test script vg_regtest to | 3 | Change the valgrind regression test script vg_regtest to |
4 | support the yocto ptest stdout reporting format. The commit adds | 4 | support the yocto ptest stdout reporting format. The commit adds |
5 | '--yocto-ptest' as an optional argument to vg_regtest, which alters | 5 | '--yocto-ptest' as an optional argument to vg_regtest, which alters |
6 | the output to use the ptest infrastructure reporting format: | 6 | the output to use the ptest infrastructure reporting format: |
@@ -8,12 +8,16 @@ the output to use the ptest infrastructure reporting format: | |||
8 | instead of valgrind's internal test reporting format. Without the added | 8 | instead of valgrind's internal test reporting format. Without the added |
9 | option, --yocto-ptest, the valgrind regression test output is unchanged. | 9 | option, --yocto-ptest, the valgrind regression test output is unchanged. |
10 | 10 | ||
11 | Enforce 30 seconds limit for the test. | ||
12 | This resume execution of the remaining tests when valgrind hangs. | ||
13 | |||
11 | Upstream-Status: Pending | 14 | Upstream-Status: Pending |
12 | 15 | ||
13 | Signed-off-by: Dave Lerner <dave.lerner@windriver.com> | 16 | Signed-off-by: Dave Lerner <dave.lerner@windriver.com> |
17 | Signed-off-by: Tudor Florea <tudor.florea@enea.com> | ||
14 | 18 | ||
15 | diff --git a/tests/vg_regtest.in b/tests/vg_regtest.in | 19 | diff --git a/tests/vg_regtest.in b/tests/vg_regtest.in |
16 | index 224385f..dbbd23d 100755 | 20 | index 224385f..3e0383b 100755 |
17 | --- a/tests/vg_regtest.in | 21 | --- a/tests/vg_regtest.in |
18 | +++ b/tests/vg_regtest.in | 22 | +++ b/tests/vg_regtest.in |
19 | @@ -39,11 +39,11 @@ | 23 | @@ -39,11 +39,11 @@ |
@@ -55,7 +59,41 @@ index 224385f..dbbd23d 100755 | |||
55 | } else { | 59 | } else { |
56 | die $usage; | 60 | die $usage; |
57 | } | 61 | } |
58 | @@ -394,19 +397,21 @@ sub do_diffs($$$$) | 62 | @@ -340,13 +343,28 @@ sub read_vgtest_file($) |
63 | #---------------------------------------------------------------------------- | ||
64 | # Since most of the program time is spent in system() calls, need this to | ||
65 | # propagate a Ctrl-C enabling us to quit. | ||
66 | -sub mysystem($) | ||
67 | +# Enforce 30 seconds limit for the test. | ||
68 | +# This resume execution of the remaining tests if valgrind hangs. | ||
69 | +sub mysystem($) | ||
70 | { | ||
71 | - my $exit_code = system($_[0]); | ||
72 | - ($exit_code == 2) and exit 1; # 2 is SIGINT | ||
73 | - return $exit_code; | ||
74 | + my $exit_code=0; | ||
75 | + eval { | ||
76 | + local $SIG{'ALRM'} = sub { die "timed out\n" }; | ||
77 | + alarm(30); | ||
78 | + $exit_code = system($_[0]); | ||
79 | + alarm (0); | ||
80 | + ($exit_code == 2) and die "SIGINT\n"; # 2 is SIGINT | ||
81 | + }; | ||
82 | + if ($@) { | ||
83 | + if ($@ eq "timed out\n") { | ||
84 | + print "timed out\n"; | ||
85 | + return 1; | ||
86 | + } | ||
87 | + if ($@ eq "SIGINT\n") { | ||
88 | + exit 1; | ||
89 | + } | ||
90 | + } | ||
91 | } | ||
92 | - | ||
93 | # if $keepunfiltered, copies $1 to $1.unfiltered.out | ||
94 | # renames $0 tp $1 | ||
95 | sub filtered_rename($$) | ||
96 | @@ -394,19 +412,21 @@ sub do_diffs($$$$) | ||
59 | # A match; remove .out and any previously created .diff files. | 97 | # A match; remove .out and any previously created .diff files. |
60 | unlink("$name.$mid.out"); | 98 | unlink("$name.$mid.out"); |
61 | unlink(<$name.$mid.diff*>); | 99 | unlink(<$name.$mid.diff*>); |
@@ -79,7 +117,7 @@ index 224385f..dbbd23d 100755 | |||
79 | $vgtest =~ /^(.*)\.vgtest/; | 117 | $vgtest =~ /^(.*)\.vgtest/; |
80 | my $name = $1; | 118 | my $name = $1; |
81 | my $fullname = "$dir/$name"; | 119 | my $fullname = "$dir/$name"; |
82 | @@ -425,7 +430,11 @@ sub do_one_test($$) | 120 | @@ -425,7 +445,11 @@ sub do_one_test($$) |
83 | } elsif (256 == $prereq_res) { | 121 | } elsif (256 == $prereq_res) { |
84 | # Nb: weird Perl-ism -- exit code of '1' is seen by Perl as 256... | 122 | # Nb: weird Perl-ism -- exit code of '1' is seen by Perl as 256... |
85 | # Prereq failed, skip. | 123 | # Prereq failed, skip. |
@@ -92,7 +130,7 @@ index 224385f..dbbd23d 100755 | |||
92 | return; | 130 | return; |
93 | } else { | 131 | } else { |
94 | # Bad prereq; abort. | 132 | # Bad prereq; abort. |
95 | @@ -438,7 +447,7 @@ sub do_one_test($$) | 133 | @@ -438,7 +462,7 @@ sub do_one_test($$) |
96 | if (defined $progB) { | 134 | if (defined $progB) { |
97 | # If there is a progB, let's start it in background: | 135 | # If there is a progB, let's start it in background: |
98 | printf("%-16s valgrind $extraopts $vgopts $prog $args (progB: $progB $argsB)\n", | 136 | printf("%-16s valgrind $extraopts $vgopts $prog $args (progB: $progB $argsB)\n", |
@@ -101,7 +139,7 @@ index 224385f..dbbd23d 100755 | |||
101 | # progB.done used to detect child has finished. See below. | 139 | # progB.done used to detect child has finished. See below. |
102 | # Note: redirection of stdout and stderr is before $progB to allow argsB | 140 | # Note: redirection of stdout and stderr is before $progB to allow argsB |
103 | # to e.g. redirect stdoutB to stderrB | 141 | # to e.g. redirect stdoutB to stderrB |
104 | @@ -452,7 +461,8 @@ sub do_one_test($$) | 142 | @@ -452,7 +476,8 @@ sub do_one_test($$) |
105 | . "touch progB.done) &"); | 143 | . "touch progB.done) &"); |
106 | } | 144 | } |
107 | } else { | 145 | } else { |
@@ -111,7 +149,7 @@ index 224385f..dbbd23d 100755 | |||
111 | } | 149 | } |
112 | 150 | ||
113 | # Pass the appropriate --tool option for the directory (can be overridden | 151 | # Pass the appropriate --tool option for the directory (can be overridden |
114 | @@ -487,7 +497,7 @@ sub do_one_test($$) | 152 | @@ -487,7 +512,7 @@ sub do_one_test($$) |
115 | # Find all the .stdout.exp files. If none, use /dev/null. | 153 | # Find all the .stdout.exp files. If none, use /dev/null. |
116 | my @stdout_exps = <$name.stdout.exp*>; | 154 | my @stdout_exps = <$name.stdout.exp*>; |
117 | @stdout_exps = ( "/dev/null" ) if (0 == scalar @stdout_exps); | 155 | @stdout_exps = ( "/dev/null" ) if (0 == scalar @stdout_exps); |
@@ -120,7 +158,7 @@ index 224385f..dbbd23d 100755 | |||
120 | 158 | ||
121 | # Filter stderr | 159 | # Filter stderr |
122 | $stderr_filter_args = $name if (! defined $stderr_filter_args); | 160 | $stderr_filter_args = $name if (! defined $stderr_filter_args); |
123 | @@ -496,7 +506,7 @@ sub do_one_test($$) | 161 | @@ -496,7 +521,7 @@ sub do_one_test($$) |
124 | # Find all the .stderr.exp files. At least one must exist. | 162 | # Find all the .stderr.exp files. At least one must exist. |
125 | my @stderr_exps = <$name.stderr.exp*>; | 163 | my @stderr_exps = <$name.stderr.exp*>; |
126 | (0 != scalar @stderr_exps) or die "Could not find `$name.stderr.exp*'\n"; | 164 | (0 != scalar @stderr_exps) or die "Could not find `$name.stderr.exp*'\n"; |
@@ -129,7 +167,7 @@ index 224385f..dbbd23d 100755 | |||
129 | 167 | ||
130 | if (defined $progB) { | 168 | if (defined $progB) { |
131 | # wait for the child to be finished | 169 | # wait for the child to be finished |
132 | @@ -520,7 +530,7 @@ sub do_one_test($$) | 170 | @@ -520,7 +545,7 @@ sub do_one_test($$) |
133 | # Find all the .stdoutB.exp files. If none, use /dev/null. | 171 | # Find all the .stdoutB.exp files. If none, use /dev/null. |
134 | my @stdoutB_exps = <$name.stdoutB.exp*>; | 172 | my @stdoutB_exps = <$name.stdoutB.exp*>; |
135 | @stdoutB_exps = ( "/dev/null" ) if (0 == scalar @stdoutB_exps); | 173 | @stdoutB_exps = ( "/dev/null" ) if (0 == scalar @stdoutB_exps); |
@@ -138,7 +176,7 @@ index 224385f..dbbd23d 100755 | |||
138 | 176 | ||
139 | # Filter stderr | 177 | # Filter stderr |
140 | $stderrB_filter_args = $name if (! defined $stderrB_filter_args); | 178 | $stderrB_filter_args = $name if (! defined $stderrB_filter_args); |
141 | @@ -529,7 +539,7 @@ sub do_one_test($$) | 179 | @@ -529,7 +554,7 @@ sub do_one_test($$) |
142 | # Find all the .stderrB.exp files. At least one must exist. | 180 | # Find all the .stderrB.exp files. At least one must exist. |
143 | my @stderrB_exps = <$name.stderrB.exp*>; | 181 | my @stderrB_exps = <$name.stderrB.exp*>; |
144 | (0 != scalar @stderrB_exps) or die "Could not find `$name.stderrB.exp*'\n"; | 182 | (0 != scalar @stderrB_exps) or die "Could not find `$name.stderrB.exp*'\n"; |
@@ -147,7 +185,7 @@ index 224385f..dbbd23d 100755 | |||
147 | } | 185 | } |
148 | 186 | ||
149 | # Maybe do post-test check | 187 | # Maybe do post-test check |
150 | @@ -541,7 +551,7 @@ sub do_one_test($$) | 188 | @@ -541,7 +566,7 @@ sub do_one_test($$) |
151 | # Find all the .post.exp files. If none, use /dev/null. | 189 | # Find all the .post.exp files. If none, use /dev/null. |
152 | my @post_exps = <$name.post.exp*>; | 190 | my @post_exps = <$name.post.exp*>; |
153 | @post_exps = ( "/dev/null" ) if (0 == scalar @post_exps); | 191 | @post_exps = ( "/dev/null" ) if (0 == scalar @post_exps); |
@@ -156,7 +194,7 @@ index 224385f..dbbd23d 100755 | |||
156 | } | 194 | } |
157 | } | 195 | } |
158 | 196 | ||
159 | @@ -550,6 +560,13 @@ sub do_one_test($$) | 197 | @@ -550,6 +575,13 @@ sub do_one_test($$) |
160 | print("(cleanup operation failed: $cleanup)\n"); | 198 | print("(cleanup operation failed: $cleanup)\n"); |
161 | } | 199 | } |
162 | 200 | ||
@@ -170,7 +208,7 @@ index 224385f..dbbd23d 100755 | |||
170 | $num_tests_done++; | 208 | $num_tests_done++; |
171 | } | 209 | } |
172 | 210 | ||
173 | @@ -589,7 +606,7 @@ sub test_one_dir($$) | 211 | @@ -589,7 +621,7 @@ sub test_one_dir($$) |
174 | my $found_tests = (0 != (grep { $_ =~ /\.vgtest$/ } @fs)); | 212 | my $found_tests = (0 != (grep { $_ =~ /\.vgtest$/ } @fs)); |
175 | 213 | ||
176 | if ($found_tests) { | 214 | if ($found_tests) { |
@@ -179,7 +217,7 @@ index 224385f..dbbd23d 100755 | |||
179 | } | 217 | } |
180 | foreach my $f (@fs) { | 218 | foreach my $f (@fs) { |
181 | if (-d $f) { | 219 | if (-d $f) { |
182 | @@ -599,7 +616,7 @@ sub test_one_dir($$) | 220 | @@ -599,7 +631,7 @@ sub test_one_dir($$) |
183 | } | 221 | } |
184 | } | 222 | } |
185 | if ($found_tests) { | 223 | if ($found_tests) { |
@@ -188,7 +226,7 @@ index 224385f..dbbd23d 100755 | |||
188 | } | 226 | } |
189 | 227 | ||
190 | chdir(".."); | 228 | chdir(".."); |
191 | @@ -625,10 +642,12 @@ sub summarise_results | 229 | @@ -625,10 +657,12 @@ sub summarise_results |
192 | $num_failures{"stdout"}, plural($num_failures{"stdout"}), | 230 | $num_failures{"stdout"}, plural($num_failures{"stdout"}), |
193 | $num_failures{"stderrB"}, plural($num_failures{"stderrB"}), | 231 | $num_failures{"stderrB"}, plural($num_failures{"stderrB"}), |
194 | $num_failures{"stdoutB"}, plural($num_failures{"stdoutB"}), | 232 | $num_failures{"stdoutB"}, plural($num_failures{"stdoutB"}), |