Add install_vmlinux flag to rpm_kernel class in client/bin/kernels.py
Copied functionality from server/rpm_kernel.py. If this flag
is set, it installs a vmlinux image from the RPM. This allows oprofile
to collect kernel stats during the test.
>From ncrao@google.com
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3276 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/bin/kernel.py b/client/bin/kernel.py
index dcfdf65..2ce41ec 100755
--- a/client/bin/kernel.py
+++ b/client/bin/kernel.py
@@ -640,7 +640,7 @@
@log.record
@tee_output_logdir_mark
- def install(self, tag='autotest'):
+ def install(self, tag='autotest', install_vmlinux=True):
self.installed_as = tag
self.image = None
@@ -682,6 +682,17 @@
errmsg = "specified rpm file(s) don't contain /boot/vmlinuz"
raise error.TestError(errmsg)
+ # install vmlinux
+ if install_vmlinux:
+ for rpm_pack in self.rpm_package:
+ vmlinux = utils.system_output(
+ 'rpm -q -l -p %s | grep /boot/vmlinux' % rpm_pack)
+ utils.system('cd /; rpm2cpio %s | cpio -imuv .%s'
+ % (rpm_pack, vmlinux))
+ if not os.path.exists(vmlinux):
+ raise error.TestError('%s does not exist after installing %s'
+ % (vmlinux, rpm_pack))
+
def add_to_bootloader(self, tag='autotest', args=''):
""" Add this kernel to bootloader