Skip to content

Commit a5e7163

Browse files
committed
ktest.pl: Add new PATCHCHECK_SKIP option to skip testing individual commits
When testing a series of commits that also includes changes to the Linux tools directory, it is useless to test the changes in tools as they may not affect the kernel itself. Doing tests on the kernel for changes that do not affect the kernel is a waste of time. Add a PATCHCHECK_SKIP that takes a series of shas that will be skipped while doing the individual commit tests. For example, the runtime verification may have a series of commits like: $ git log --abbrev-commit --pretty=oneline fac5493~1..HEAD 3d3800b rv: Remove rv_reactor's reference counter 3d3c376 rv: Merge struct rv_reactor_def into struct rv_reactor 24cbfe1 rv: Merge struct rv_monitor_def into struct rv_monitor b0c08dd rv: Remove unused field in struct rv_monitor_def 58d5f0d (debiantesting-x86-64/trace/rv/core) rv: Return init error when registering monitors 560473f verification/rvgen: Organise Kconfig entries for nested monitors 9efcf59 tools/dot2c: Fix generated files going over 100 column limit 1160cca tools/rv: Stop gracefully also on SIGTERM f60227f tools/rv: Do not skip idle in trace f3735df verification/rvgen: Do not generate unused variables 6fb37c2 verification/rvgen: Generate each variable definition only once 8cfcf9b verification/rvgen: Support the 'next' operator fac5493 rv: Allow to configure the number of per-task monitor Where the first commit touches the kernel followed by a series of commits that do not, and ends with commits that do. Instead of having to add multiple patchcheck tests to handle the gaps, just include the commits that should not be tested: $ git log --abbrev-commit --pretty=oneline fac5493~1..HEAD | grep -e verification -e tools/ | cut -d' ' -f1 | while read a ; do echo -n "$a "; done 560473f 9efcf59 1160cca f60227f f3735df 6fb37c2 8cfcf9b Then set PATCHCHECK_SKIP to that, and those commits will be skipped. PATCHCHECK_SKIP = 560473f 9efcf59 1160cca f60227f f3735df 6fb37c2 8cfcf9b Cc: John 'Warthog9' Hawley <[email protected]> Cc: Dhaval Giani <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Steven Rostedt <[email protected]>
1 parent 23a2d4c commit a5e7163

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

tools/testing/ktest/ktest.pl

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@
218218
my $patchcheck_start;
219219
my $patchcheck_cherry;
220220
my $patchcheck_end;
221+
my $patchcheck_skip;
221222

222223
my $build_time;
223224
my $install_time;
@@ -382,6 +383,7 @@
382383
"PATCHCHECK_START" => \$patchcheck_start,
383384
"PATCHCHECK_CHERRY" => \$patchcheck_cherry,
384385
"PATCHCHECK_END" => \$patchcheck_end,
386+
"PATCHCHECK_SKIP" => \$patchcheck_skip,
385387
);
386388

387389
# Options may be used by other options, record them.
@@ -3537,11 +3539,37 @@ sub patchcheck {
35373539
@list = reverse @list;
35383540
}
35393541

3542+
my %skip_list;
3543+
my $will_skip = 0;
3544+
3545+
if (defined($patchcheck_skip)) {
3546+
foreach my $s (split /\s+/, $patchcheck_skip) {
3547+
$s = `git log --pretty=oneline $s~1..$s`;
3548+
$s =~ s/^(\S+).*/$1/;
3549+
chomp $s;
3550+
$skip_list{$s} = 1;
3551+
$will_skip++;
3552+
}
3553+
}
3554+
35403555
doprint("Going to test the following commits:\n");
35413556
foreach my $l (@list) {
3557+
my $sha1 = $l;
3558+
$sha1 =~ s/^([[:xdigit:]]+).*/$1/;
3559+
next if (defined($skip_list{$sha1}));
35423560
doprint "$l\n";
35433561
}
35443562

3563+
if ($will_skip) {
3564+
doprint("\nSkipping the following commits:\n");
3565+
foreach my $l (@list) {
3566+
my $sha1 = $l;
3567+
$sha1 =~ s/^([[:xdigit:]]+).*/$1/;
3568+
next if (!defined($skip_list{$sha1}));
3569+
doprint "$l\n";
3570+
}
3571+
}
3572+
35453573
my $save_clean = $noclean;
35463574
my %ignored_warnings;
35473575

@@ -3556,6 +3584,11 @@ sub patchcheck {
35563584
my $sha1 = $item;
35573585
$sha1 =~ s/^([[:xdigit:]]+).*/$1/;
35583586

3587+
if (defined($skip_list{$sha1})) {
3588+
doprint "\nSkipping \"$item\"\n\n";
3589+
next;
3590+
}
3591+
35593592
doprint "\nProcessing commit \"$item\"\n\n";
35603593

35613594
run_command "git checkout $sha1" or

tools/testing/ktest/sample.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,8 @@
10171017
# Note, PATCHCHECK_CHERRY requires PATCHCHECK_END to be defined.
10181018
# (default 0)
10191019
#
1020+
# PATCHCHECK_SKIP is an optional list of shas to skip testing
1021+
#
10201022
# PATCHCHECK_TYPE is required and is the type of test to run:
10211023
# build, boot, test.
10221024
#

0 commit comments

Comments
 (0)