On 02/19/2013 05:58 PM, Nishanth Aravamudan wrote:
Fairly basic tests. They work so far with FC18, and I'm working on
testing with RHEL & SLES.

Nice, great start! Minor comments follow:

diff --git a/kdump/kdump.py b/kdump/kdump.py
new file mode 100644
index 0000000..0a626f5
--- /dev/null
+++ b/kdump/kdump.py
@@ -0,0 +1,25 @@
+from autotest.server import test, autotest_remote
+from autotest.client.shared import error, software_manager
+
+client_control_file = """from autotest.client.shared import software_manager
+s = software_manager.SoftwareManager()
+if not s.check_installed('kexec-tools'):
+    s.install('kexec-tools')
+"""

^ Great - what you can do here, in case the package name differs among distros, is to have a mapping distro/package names, get the os vendor with autotest.client.utils.get_os_vendor(), then select the package name based on it.

+class kdump(test.test):
+    version = 1
+
+    def execute(self, host):
+        try:
+            at = autotest_remote.Autotest()
+            at.run(client_control_file, host=host)
+            
host.reboot(kernel_args='crashkernel=512M-2G:64M,2G-8G:128M,8G-:256M')
+            # assumes you have built a kernel first and are running that kernel
+            host.run('ln -s /boot/vmlinux-autotest /boot/vmlinuz-`uname -r`')
+            host.run('service kdump start')
+            host.run('echo c > /proc/sysrq-trigger', ignore_status=True)
+
+            host.wait_up(timeout=600)
+        except Exception, e:

I'd say error.AutoservError here is better than the catch all.

+            raise error.TestError("Verify failed: " + str(e))
diff --git a/kexec/control b/kexec/control
new file mode 100644
index 0000000..a770d0d
--- /dev/null
+++ b/kexec/control
@@ -0,0 +1,18 @@
+NAME = 'Kexec Test'
+AUTHOR = '[email protected] (Nish Aravamudan)'
+TIME = 'SHORT'
+TEST_CLASS = 'Software'
+TEST_CATEGORY = 'Functional'
+TEST_TYPE = 'server'
+RUN_VERIFY = False
+
+DOC = """
+Runs a simple kexec of the existing kernel and initrd.
+"""
+
+def run(machine):
+    host = hosts.create_host(machine, initialize=False)
+    job.run_test('kexec', host=host, disable_sysinfo=True)
+
+job.parallel_simple(run, machines)
+
diff --git a/kexec/kexec.py b/kexec/kexec.py
new file mode 100644
index 0000000..83eed91
--- /dev/null
+++ b/kexec/kexec.py
@@ -0,0 +1,23 @@
+from autotest.server import test, autotest_remote
+from autotest.client.shared import error, software_manager
+
+client_control_file = """from autotest.client.shared import software_manager
+s = software_manager.SoftwareManager()
+if not s.check_installed('kexec-tools'):
+    s.install('kexec-tools')
+"""

Same comment about distro mapping applies.

+class kexec(test.test):
+    version = 1
+
+    def execute(self, host):
+        try:
+            at = autotest_remote.Autotest()
+            at.run(client_control_file, host=host)
+            # assumes you have built a kernel first

What about providing a test that can (optionally) build a kernel from git and then use kexec?

+            host.run('kexec -l --initrd=/boot/initrd-autotest 
/boot/vmlinux-autotest --append=`cat /proc/cmdline`')
+            host.run('kexec -e', ignore_status=True)
+
+            host.wait_up(timeout=300)
+        except Exception, e:
+            raise error.TestError("Verify failed: " + str(e))


_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to