aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2012-05-18 13:34:35 -0400
committerSteven Rostedt <rostedt@goodmis.org>2012-05-18 14:27:51 -0400
commit683a3e6481a5cffc58496a590decf65909d0454b (patch)
tree0c00e2379b586747c080c92107e2ec7c7f4fa345 /tools
parent36be50515fe2aef61533b516fa2576a2c7fe7664 (diff)
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>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/ktest/ktest.pl11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 4915408f6a98..50b6726c3865 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -66,6 +66,7 @@ my %default = (
66 66
67my $ktest_config; 67my $ktest_config;
68my $version; 68my $version;
69my $have_version = 0;
69my $machine; 70my $machine;
70my $ssh_user; 71my $ssh_user;
71my $tmpdir; 72my $tmpdir;
@@ -1702,10 +1703,12 @@ sub install {
1702 1703
1703sub get_version { 1704sub get_version {
1704 # get the release name 1705 # get the release name
1706 return if ($have_version);
1705 doprint "$make kernelrelease ... "; 1707 doprint "$make kernelrelease ... ";
1706 $version = `$make kernelrelease | tail -1`; 1708 $version = `$make kernelrelease | tail -1`;
1707 chomp($version); 1709 chomp($version);
1708 doprint "$version\n"; 1710 doprint "$version\n";
1711 $have_version = 1;
1709} 1712}
1710 1713
1711sub start_monitor_and_boot { 1714sub start_monitor_and_boot {
@@ -1828,6 +1831,9 @@ sub build {
1828 my $save_no_reboot = $no_reboot; 1831 my $save_no_reboot = $no_reboot;
1829 $no_reboot = 1; 1832 $no_reboot = 1;
1830 1833
1834 # Calculate a new version from here.
1835 $have_version = 0;
1836
1831 if (defined($pre_build)) { 1837 if (defined($pre_build)) {
1832 my $ret = run_command $pre_build; 1838 my $ret = run_command $pre_build;
1833 if (!$ret && defined($pre_build_die) && 1839 if (!$ret && defined($pre_build_die) &&
@@ -1887,6 +1893,9 @@ sub build {
1887 undef $redirect; 1893 undef $redirect;
1888 1894
1889 if (defined($post_build)) { 1895 if (defined($post_build)) {
1896 # Because a post build may change the kernel version
1897 # do it now.
1898 get_version;
1890 my $ret = run_command $post_build; 1899 my $ret = run_command $post_build;
1891 if (!$ret && defined($post_build_die) && 1900 if (!$ret && defined($post_build_die) &&
1892 $post_build_die) { 1901 $post_build_die) {
@@ -3474,6 +3483,8 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
3474 $no_reboot = 1; 3483 $no_reboot = 1;
3475 $reboot_success = 0; 3484 $reboot_success = 0;
3476 3485
3486 $have_version = 0;
3487
3477 $iteration = $i; 3488 $iteration = $i;
3478 3489
3479 my $makecmd = set_test_option("MAKE_CMD", $i); 3490 my $makecmd = set_test_option("MAKE_CMD", $i);