Signed-off-by: Pradeep K Surisetty <[email protected]>
----
diff -uprN autotest/client/virt/tests/softlockup.py 
autotest-new/client/virt/tests/softlockup.py
--- autotest/client/virt/tests/softlockup.py    1970-01-01 05:30:00.000000000 
+0530
+++ autotest-new/client/virt/tests/softlockup.py        2011-06-24 
07:51:52.564365352 +0530
@@ -0,0 +1,78 @@
+import logging, os, signal, time, socket, signal
+from autotest_lib.client.common_lib import error
+from autotest_lib.client.bin import utils
+from autotest_lib.client.virt import aexpect, virt_utils
+
+def run_softlockup(test, params, env):
+    """
+    Network stress test with netperf.
+
+    1) Boot up a VM 
+    2) Build stress on host and guest 
+    3) run heartbeat with the given options on server and host 
+    3) Run for longer duration. ex: 12 or ,18 or 24 hours. 
+    4) Output the test result and observe drift. 
+
+    @param test: KVM test object.
+    @param params: Dictionary with the test parameters.
+    @param env: Dictionary with test environment.
+    """
+    softlockup_dir = os.path.join(os.environ['AUTODIR'], "tests/softlockup")
+    setup_cmd = params.get("stress_setup_cmd")
+    stress_cmd = params.get("stress_cmd")
+    server_setup_cmd = params.get("server_setup_cmd")
+    threshold = int(params.get("stress_threshold"))
+    file = params.get("file")
+    test_stress_cmd = params.get("check_stress_cmd")
+    test_druation = 3600 * int(params.get("test_duration"))
+    vm = env.get_vm(params["main_vm"])
+    login_timeout = int(params.get("login_timeout", 360))
+
+    def client():
+        #vm = env.get_vm(params["main_vm"])
+        vm.verify_alive()
+        #login_timeout = int(params.get("login_timeout", 360))
+        session = vm.wait_for_login(timeout=login_timeout)
+
+       #get required files and copy from host to guest
+        for i in params.get("softlockup_files").split():
+            vm.copy_files_to(os.path.join(softlockup_dir, i), "/tmp")
+       host_ip = get_host_ip()
+
+        logging.info("Setup client, run stress and heartbeat on guest")
+       #setup guest 
+        session.cmd(setup_cmd % "/tmp", timeout=200)
+        #start heartbeat on guest 
+       session.cmd(params.get("client_setup_cmd") % ("/tmp", host_ip))
+       #where <num_threads> should be twice the number of vcpus allocated to 
the guest.
+       num_threads = 2* int(params.get("smp", 1))
+       #run stress test
+       session.cmd(stress_cmd % num_threads, timeout=test_druation)
+        session1 = vm.wait_for_login(timeout=login_timeout)
+
+    def server():
+        #get number of threads to run stress. where <num_threads> should be 
twice the number of hardware/hyper threads the h
+       threads = 2 * utils.count_cpus()
+        logging.info("Setup server, run stress and heartbeat on host")
+       
+       #setup server
+       utils.run(setup_cmd % softlockup_dir)
+       #run heartbeat script
+       utils.run(server_setup_cmd %(softlockup_dir, threshold, file))
+       #run  stress test, as it generats several types of stress (CPU,IO, 
network)
+       utils.run(stress_cmd % threads, timeout=test_druation)
+       
+    def wait_for_timeout():
+       session2 = vm.wait_for_login(timeout=login_timeout)
+       session2.cmd("pkill -f stress")
+       session2.cmd("pkill -f heartbeat")
+       utils.run("pkill -f stress")
+       utils.run("pkill -f heartbeat") 
+
+    def get_host_ip():
+       ipaddr = socket.gethostbyname(socket.gethostname())
+       return ipaddr
+    
+    server()
+    client()
+    wait_for_timeout()  
---
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to