ktest: Add POST_INSTALL to allow initrds to be created
authorSteven Rostedt <srostedt@redhat.com>
Tue, 2 Nov 2010 18:58:33 +0000 (14:58 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Thu, 18 Nov 2010 16:23:08 +0000 (11:23 -0500)
Add a POST_INSTALL option that runs after the build and install
but before rebooting to the test kernel. This alls the user to
run a script that will install an initrd (or anything else that may
be special) before booting.

An environment variable KERNEL_VERSION is set.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
tools/testing/ktest/ktest.pl
tools/testing/ktest/sample.conf

index 1f28c45f15b8c26a5e8c809c666f55d234d7960c..687a85475af511ed817d18a72bfdb040ce1808f8 100644 (file)
@@ -58,6 +58,7 @@ my $grub_menu;
 my $grub_number;
 my $target;
 my $make;
+my $post_install;
 my $noclean;
 my $minconfig;
 my $addconfig;
@@ -489,6 +490,15 @@ sub install {
        dodie "failed to tar modules";
 
     run_command "ssh $target rm -f /tmp/$modtar";
+
+    return if (!defined($post_install));
+
+    my $save_env = $ENV{KERNEL_VERSION};
+
+    $ENV{KERNEL_VERSION} = $version;
+    run_command "$post_install";
+
+    $ENV{KERNEL_VERSION} = $save_env;
 }
 
 sub check_buildlog {
@@ -1055,6 +1065,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
     $addconfig = set_test_option("ADD_CONFIG", $i);
     $reboot_type = set_test_option("REBOOT_TYPE", $i);
     $grub_menu = set_test_option("GRUB_MENU", $i);
+    $post_install = set_test_option("POST_INSTALL", $i);
     $reboot_script = set_test_option("REBOOT_SCRIPT", $i);
     $reboot_on_error = set_test_option("REBOOT_ON_ERROR", $i);
     $poweroff_on_error = set_test_option("POWEROFF_ON_ERROR", $i);
index 42f803fe4a8de709b9df9cc8ab199d147a8e3747..0115a6762a6de39f8442fafede9c3f1b6d287570 100644 (file)
 # If you are building a 32bit x86 on a 64 bit host
 #MAKE_CMD = CC=i386-gcc AS=i386-as make ARCH=i386
 
+# If you need an initrd, you can add a script or code here to install
+# it. The environment variable KERNEL_VERSION will be set to the
+# kernel version that is used.
+#POST_INSTALL = ssh user@target /sbin/mkinitrd --allow-missing -f /boot/initramfs-test.img $KERNEL_VERSION
+
 # Way to reboot the box to the test kernel.
 # Only valid options so far are "grub" and "script"
 # (default grub)