aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/ktest/ktest.pl
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2014-09-19 20:10:39 -0400
committerSteven Rostedt <rostedt@goodmis.org>2014-09-19 20:10:39 -0400
commit23a0e1611b880bd8d94bbebcb3577c9f78029435 (patch)
tree7c8cf99dfaebe721c4b4f94387f120e5d90a140a /tools/testing/ktest/ktest.pl
parent9e82bf014195d6f0054982c463575cdce24292be (diff)
ktest: Add PATCHCHECK_CHERRY
Add a way to run a patchcheck test on the commits that are in one branch but not in another. This uses git cherry to find a list of commits to test each one with. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools/testing/ktest/ktest.pl')
-rwxr-xr-xtools/testing/ktest/ktest.pl35
1 files changed, 29 insertions, 6 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 55ab700f6ba5..3b7a180d9c0d 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -194,6 +194,7 @@ my $config_bisect_check;
194 194
195my $patchcheck_type; 195my $patchcheck_type;
196my $patchcheck_start; 196my $patchcheck_start;
197my $patchcheck_cherry;
197my $patchcheck_end; 198my $patchcheck_end;
198 199
199# set when a test is something other that just building or install 200# set when a test is something other that just building or install
@@ -320,6 +321,7 @@ my %option_map = (
320 321
321 "PATCHCHECK_TYPE" => \$patchcheck_type, 322 "PATCHCHECK_TYPE" => \$patchcheck_type,
322 "PATCHCHECK_START" => \$patchcheck_start, 323 "PATCHCHECK_START" => \$patchcheck_start,
324 "PATCHCHECK_CHERRY" => \$patchcheck_cherry,
323 "PATCHCHECK_END" => \$patchcheck_end, 325 "PATCHCHECK_END" => \$patchcheck_end,
324); 326);
325 327
@@ -3181,9 +3183,16 @@ sub patchcheck {
3181 3183
3182 my $start = $patchcheck_start; 3184 my $start = $patchcheck_start;
3183 3185
3186 my $cherry = $patchcheck_cherry;
3187 if (!defined($cherry)) {
3188 $cherry = 0;
3189 }
3190
3184 my $end = "HEAD"; 3191 my $end = "HEAD";
3185 if (defined($patchcheck_end)) { 3192 if (defined($patchcheck_end)) {
3186 $end = $patchcheck_end; 3193 $end = $patchcheck_end;
3194 } elsif ($cherry) {
3195 die "PATCHCHECK_END must be defined with PATCHCHECK_CHERRY\n";
3187 } 3196 }
3188 3197
3189 # Get the true sha1's since we can use things like HEAD~3 3198 # Get the true sha1's since we can use things like HEAD~3
@@ -3197,24 +3206,38 @@ sub patchcheck {
3197 $type = "boot"; 3206 $type = "boot";
3198 } 3207 }
3199 3208
3200 open (IN, "git log --pretty=oneline $end|") or 3209 if ($cherry) {
3201 dodie "could not get git list"; 3210 open (IN, "git cherry -v $start $end|") or
3211 dodie "could not get git list";
3212 } else {
3213 open (IN, "git log --pretty=oneline $end|") or
3214 dodie "could not get git list";
3215 }
3202 3216
3203 my @list; 3217 my @list;
3204 3218
3205 while (<IN>) { 3219 while (<IN>) {
3206 chomp; 3220 chomp;
3221 # git cherry adds a '+' we want to remove
3222 s/^\+ //;
3207 $list[$#list+1] = $_; 3223 $list[$#list+1] = $_;
3208 last if (/^$start/); 3224 last if (/^$start/);
3209 } 3225 }
3210 close(IN); 3226 close(IN);
3211 3227
3212 if ($list[$#list] !~ /^$start/) { 3228 if (!$cherry) {
3213 fail "SHA1 $start not found"; 3229 if ($list[$#list] !~ /^$start/) {
3230 fail "SHA1 $start not found";
3231 }
3232
3233 # go backwards in the list
3234 @list = reverse @list;
3214 } 3235 }
3215 3236
3216 # go backwards in the list 3237 doprint("Going to test the following commits:\n");
3217 @list = reverse @list; 3238 foreach my $l (@list) {
3239 doprint "$l\n";
3240 }
3218 3241
3219 my $save_clean = $noclean; 3242 my $save_clean = $noclean;
3220 my %ignored_warnings; 3243 my %ignored_warnings;