diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2014-09-19 20:10:39 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2014-09-19 20:10:39 -0400 |
commit | 23a0e1611b880bd8d94bbebcb3577c9f78029435 (patch) | |
tree | 7c8cf99dfaebe721c4b4f94387f120e5d90a140a /tools/testing | |
parent | 9e82bf014195d6f0054982c463575cdce24292be (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')
-rwxr-xr-x | tools/testing/ktest/ktest.pl | 35 | ||||
-rw-r--r-- | tools/testing/ktest/sample.conf | 10 |
2 files changed, 39 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 | ||
195 | my $patchcheck_type; | 195 | my $patchcheck_type; |
196 | my $patchcheck_start; | 196 | my $patchcheck_start; |
197 | my $patchcheck_cherry; | ||
197 | my $patchcheck_end; | 198 | my $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; |
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf index 911e45ad657a..6c58cd8bbbae 100644 --- a/tools/testing/ktest/sample.conf +++ b/tools/testing/ktest/sample.conf | |||
@@ -906,6 +906,16 @@ | |||
906 | # | 906 | # |
907 | # PATCHCHECK_END is the last patch to check (default HEAD) | 907 | # PATCHCHECK_END is the last patch to check (default HEAD) |
908 | # | 908 | # |
909 | # PATCHCHECK_CHERRY if set to non zero, then git cherry will be | ||
910 | # performed against PATCHCHECK_START and PATCHCHECK_END. That is | ||
911 | # | ||
912 | # git cherry ${PATCHCHECK_START} ${PATCHCHECK_END} | ||
913 | # | ||
914 | # Then the changes found will be tested. | ||
915 | # | ||
916 | # Note, PATCHCHECK_CHERRY requires PATCHCHECK_END to be defined. | ||
917 | # (default 0) | ||
918 | # | ||
909 | # PATCHCHECK_TYPE is required and is the type of test to run: | 919 | # PATCHCHECK_TYPE is required and is the type of test to run: |
910 | # build, boot, test. | 920 | # build, boot, test. |
911 | # | 921 | # |