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

Configure Feed

Select the types of activity you want to include in your feed.

ktest: Fix kernelrevision with POST_BUILD

The PRE_BUILD and POST_BUILD options of ktest are added to allow the
user to add temporary patch to the system and remove it on builds. This
is sometimes use to take a change from another git branch and add it to
a series without the fix so that this series can be tested, when an
unrelated bug exists in the series.

The problem comes when a tagged commit is being used. For example, if
v3.2 is being tested, and we add a patch to it, the kernelrelease for
that commit will be 3.2.0+, but without the patch the version will be
3.2.0. This can cause problems when the kernelrelease is determined for
creating the /lib/modules directory. The kernel booting has the '+' but
the module directory will not, and the modules will be missing for that
boot, and may not allow the kernel to succeed.

The fix is to put the creation of the kernelrelease in the POST_BUILD
logic, before it applies the POST_BUILD operation. The POST_BUILD is
where the patch may be removed, removing the '+' from the kernelrelease.

The calculation of the kernelrelease will also stay in its current
location but will be ignored if it was already calculated previously.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

authored by

Steven Rostedt and committed by
Steven Rostedt
683a3e64 36be5051

+11
+11
tools/testing/ktest/ktest.pl
··· 66 66 67 67 my $ktest_config; 68 68 my $version; 69 + my $have_version = 0; 69 70 my $machine; 70 71 my $ssh_user; 71 72 my $tmpdir; ··· 1703 1702 1704 1703 sub get_version { 1705 1704 # get the release name 1705 + return if ($have_version); 1706 1706 doprint "$make kernelrelease ... "; 1707 1707 $version = `$make kernelrelease | tail -1`; 1708 1708 chomp($version); 1709 1709 doprint "$version\n"; 1710 + $have_version = 1; 1710 1711 } 1711 1712 1712 1713 sub start_monitor_and_boot { ··· 1831 1828 my $save_no_reboot = $no_reboot; 1832 1829 $no_reboot = 1; 1833 1830 1831 + # Calculate a new version from here. 1832 + $have_version = 0; 1833 + 1834 1834 if (defined($pre_build)) { 1835 1835 my $ret = run_command $pre_build; 1836 1836 if (!$ret && defined($pre_build_die) && ··· 1893 1887 undef $redirect; 1894 1888 1895 1889 if (defined($post_build)) { 1890 + # Because a post build may change the kernel version 1891 + # do it now. 1892 + get_version; 1896 1893 my $ret = run_command $post_build; 1897 1894 if (!$ret && defined($post_build_die) && 1898 1895 $post_build_die) { ··· 3482 3473 # Do not reboot on failing test options 3483 3474 $no_reboot = 1; 3484 3475 $reboot_success = 0; 3476 + 3477 + $have_version = 0; 3485 3478 3486 3479 $iteration = $i; 3487 3480