Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+39 -6
+29 -6
tools/testing/ktest/ktest.pl
··· 194 194 195 195 my $patchcheck_type; 196 196 my $patchcheck_start; 197 + my $patchcheck_cherry; 197 198 my $patchcheck_end; 198 199 199 200 # set when a test is something other that just building or install ··· 321 320 322 321 "PATCHCHECK_TYPE" => \$patchcheck_type, 323 322 "PATCHCHECK_START" => \$patchcheck_start, 323 + "PATCHCHECK_CHERRY" => \$patchcheck_cherry, 324 324 "PATCHCHECK_END" => \$patchcheck_end, 325 325 ); 326 326 ··· 3183 3181 3184 3182 my $start = $patchcheck_start; 3185 3183 3184 + my $cherry = $patchcheck_cherry; 3185 + if (!defined($cherry)) { 3186 + $cherry = 0; 3187 + } 3188 + 3186 3189 my $end = "HEAD"; 3187 3190 if (defined($patchcheck_end)) { 3188 3191 $end = $patchcheck_end; 3192 + } elsif ($cherry) { 3193 + die "PATCHCHECK_END must be defined with PATCHCHECK_CHERRY\n"; 3189 3194 } 3190 3195 3191 3196 # Get the true sha1's since we can use things like HEAD~3 ··· 3206 3197 $type = "boot"; 3207 3198 } 3208 3199 3209 - open (IN, "git log --pretty=oneline $end|") or 3210 - dodie "could not get git list"; 3200 + if ($cherry) { 3201 + open (IN, "git cherry -v $start $end|") or 3202 + dodie "could not get git list"; 3203 + } else { 3204 + open (IN, "git log --pretty=oneline $end|") or 3205 + dodie "could not get git list"; 3206 + } 3211 3207 3212 3208 my @list; 3213 3209 3214 3210 while (<IN>) { 3215 3211 chomp; 3212 + # git cherry adds a '+' we want to remove 3213 + s/^\+ //; 3216 3214 $list[$#list+1] = $_; 3217 3215 last if (/^$start/); 3218 3216 } 3219 3217 close(IN); 3220 3218 3221 - if ($list[$#list] !~ /^$start/) { 3222 - fail "SHA1 $start not found"; 3219 + if (!$cherry) { 3220 + if ($list[$#list] !~ /^$start/) { 3221 + fail "SHA1 $start not found"; 3222 + } 3223 + 3224 + # go backwards in the list 3225 + @list = reverse @list; 3223 3226 } 3224 3227 3225 - # go backwards in the list 3226 - @list = reverse @list; 3228 + doprint("Going to test the following commits:\n"); 3229 + foreach my $l (@list) { 3230 + doprint "$l\n"; 3231 + } 3227 3232 3228 3233 my $save_clean = $noclean; 3229 3234 my %ignored_warnings;
+10
tools/testing/ktest/sample.conf
··· 906 906 # 907 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 919 # PATCHCHECK_TYPE is required and is the type of test to run: 910 920 # build, boot, test. 911 921 #